I've just upgraded to 2.0.1 and was taken by surprise by the changes
in graphical parameter handling for lattice plots. I'd previously
been using 1.9.1. The old settings seem to have been replaced by a
daunting number of new options. I've poked around a bit and have not
seen any discussion of the changes in the newsletter or on r-help but
maybe I'm overlooking something?
Specifically, I have some code that in the past changed the relative
proportions of text versus the plot area using:
trellis.par.set('fontsize', list(text=8))
which caused all text to get smaller, and the plot area to grow to
fill the larger available space. Now, the plot area does not grow on
its own. I've tried fiddling with layout.heights, layout.widths, and
axis.components but there are dozens of settings available. For many
of these settings, I have no idea what quantity I'm actually changing,
other than by trial and error. Is there an easier way?
-- Dave
New trellis settings
7 messages · David Hinds, Xin Qi, Deepayan Sarkar
On Monday 29 November 2004 22:39, dhinds at sonic.net wrote:
I've just upgraded to 2.0.1 and was taken by surprise by the changes in graphical parameter handling for lattice plots. I'd previously been using 1.9.1. The old settings seem to have been replaced by a daunting number of new options.
Not really. The old settings are essentially what they were, the new 'options' are for things that used to be hard-coded in previous versions.
I've poked around a bit and have not
seen any discussion of the changes in the newsletter or on r-help but
maybe I'm overlooking something?
Specifically, I have some code that in the past changed the relative
proportions of text versus the plot area using:
trellis.par.set('fontsize', list(text=8))
which caused all text to get smaller, and the plot area to grow to
fill the larger available space. Now, the plot area does not grow on
its own.
That does seem to have been a side-effect in 1.9.1, but it was never intended. I would consider that behaviour a bug, not a feature.
I've tried fiddling with layout.heights, layout.widths, and axis.components but there are dozens of settings available. For many of these settings, I have no idea what quantity I'm actually changing, other than by trial and error. Is there an easier way?
Not really. The recommended thing to change is the settings (not the options) which all default to 1:
str(trellis.par.get()$layout.heights)
List of 18 $ top.padding : num 1 $ main : num 1 $ main.key.padding : num 1 $ key.top : num 1 $ key.axis.padding : num 1 ... I was hoping that the names would be enough of a hint. Anything with 'padding' in the name is space, and probably the ones you want to change. Deepayan
On Mon, Nov 29, 2004 at 11:23:35PM -0600, Deepayan Sarkar wrote:
Specifically, I have some code that in the past changed the relative
proportions of text versus the plot area using:
trellis.par.set('fontsize', list(text=8))
which caused all text to get smaller, and the plot area to grow to
fill the larger available space. Now, the plot area does not grow on
its own.
That does seem to have been a side-effect in 1.9.1, but it was never intended. I would consider that behaviour a bug, not a feature.
It was a pretty convenient bug! ;)
str(trellis.par.get()$layout.heights)
List of 18 $ top.padding : num 1 $ main : num 1 $ main.key.padding : num 1 $ key.top : num 1 $ key.axis.padding : num 1 ... I was hoping that the names would be enough of a hint. Anything with 'padding' in the name is space, and probably the ones you want to change.
I've fiddled with these and can pretty much get what I want. But without really understanding what I'm doing. It isn't clear to me, for instance, why the "key" settings affect my plot when no key is drawn. -- Dave
On Tuesday 30 November 2004 13:33, David Hinds wrote:
On Mon, Nov 29, 2004 at 11:23:35PM -0600, Deepayan Sarkar wrote:
Specifically, I have some code that in the past changed the
relative proportions of text versus the plot area using:
trellis.par.set('fontsize', list(text=8))
which caused all text to get smaller, and the plot area to grow
to fill the larger available space. Now, the plot area does not
grow on its own.
That does seem to have been a side-effect in 1.9.1, but it was never intended. I would consider that behaviour a bug, not a feature.
It was a pretty convenient bug! ;)
str(trellis.par.get()$layout.heights)
List of 18 $ top.padding : num 1 $ main : num 1 $ main.key.padding : num 1 $ key.top : num 1 $ key.axis.padding : num 1 ... I was hoping that the names would be enough of a hint. Anything with 'padding' in the name is space, and probably the ones you want to change.
I've fiddled with these and can pretty much get what I want. But without really understanding what I'm doing. It isn't clear to me, for instance, why the "key" settings affect my plot when no key is drawn.
It shouldn't (unless you have messed with lattice.options()). Can you
provide an example? The following doesn't do anything unusual for me:
xyplot(1~1,
par.settings =
list(layout.heights = list(key.top = 100, key.bottom = 100)))
(I'm running r-devel though, so there's a small chance something might
be different.)
Deepayan
On Tue, Nov 30, 2004 at 04:33:50PM -0600, Deepayan Sarkar wrote:
I've fiddled with these and can pretty much get what I want. But without really understanding what I'm doing. It isn't clear to me, for instance, why the "key" settings affect my plot when no key is drawn.
It shouldn't (unless you have messed with lattice.options()). Can you
provide an example? The following doesn't do anything unusual for me:
xyplot(1~1,
par.settings =
list(layout.heights = list(key.top = 100, key.bottom = 100)))
(I'm running r-devel though, so there's a small chance something might
be different.)
I'm only talking about the *.padding options, like:
xyplot(1:4~1:4,
par.settings=list(layout.heights=list(key.axis.padding=10)))
-- Dave
On Tuesday 30 November 2004 17:01, David Hinds wrote:
On Tue, Nov 30, 2004 at 04:33:50PM -0600, Deepayan Sarkar wrote:
I've fiddled with these and can pretty much get what I want. But without really understanding what I'm doing. It isn't clear to me, for instance, why the "key" settings affect my plot when no key is drawn.
It shouldn't (unless you have messed with lattice.options()). Can
you provide an example? The following doesn't do anything unusual
for me:
xyplot(1~1,
par.settings =
list(layout.heights = list(key.top = 100, key.bottom =
100)))
(I'm running r-devel though, so there's a small chance something
might be different.)
I'm only talking about the *.padding options, like:
xyplot(1:4~1:4,
par.settings=list(layout.heights=list(key.axis.padding=10)))
Ah. Well, the layout always contains a row for the key (with height 0), even if the key is not actually there (the same holds for all the other components). Not having it would mean a lot of headache for me (as the programmer) since I would have to keep track of a lot of information to know which row in the layout corresponds to what. So, for instance, the space above the plot area (assuming no key, no main) would be [the space at the top] + [space between the 0-height main and the 0-height key] + [space between the key and the top axes]. Deepayan