I think I read the answer in some place but I cant find it. Is there a way to remove the legend but keeping the space associate to it?
I have two plots in the same window. The legend is the same for both, so I only want to display it in the first plot. The problem is that if I use opts(legend.position="none") for the second plot, then this second plot is bigger.
> I think I read the answer in some place but I cant find it. Is there a
> way to remove the legend but keeping the space associate to it?
> I have two plots in the same window. The legend is the same for both,
> so I only want to display it in the first plot. The problem is that if
> I use opts(legend.position="none") for the second plot, then this
> second plot is bigger.
I can think of two situations but it's hard to tell without reproducible code,
1) the page layout is a result of facetting (possibly with a dummy
factor) or wrapping, in which case there should be one common legend
and its default position should be nicely aligned in the page
2) you don't want to use the first option, so you've placed two
unrelated ggplots on a page using grid.layout or other viewport
functions. Perhaps you can do something like this,
On Thu, May 21, 2009 at 5:43 AM, Dani Linares <danilina...@gmail.com> wrote:
> Hi all,
> I think I read the answer in some place but I cant find it. Is there a
> way to remove the legend but keeping the space associate to it?
> I have two plots in the same window. The legend is the same for both,
> so I only want to display it in the first plot. The problem is that if
> I use opts(legend.position="none") for the second plot, then this
> second plot is bigger.
> I can think of two situations but it's hard to tell without reproducible code,
> 1) the page layout is a result of facetting (possibly with a dummy
> factor) or wrapping, in which case there should be one common legend
> and its default position should be nicely aligned in the page
> 2) you don't want to use the first option, so you've placed two
> unrelated ggplots on a page using grid.layout or other viewport
> functions. Perhaps you can do something like this,
Yes, that was the case. I used grid.layout. I should have specified
that. The below solution you proposed works. Thanks a lot.
> On Thu, May 21, 2009 at 5:43 AM, Dani Linares <danilina...@gmail.com> wrote:
>> Hi all,
>> I think I read the answer in some place but I cant find it. Is there a
>> way to remove the legend but keeping the space associate to it?
>> I have two plots in the same window. The legend is the same for both,
>> so I only want to display it in the first plot. The problem is that if
>> I use opts(legend.position="none") for the second plot, then this
>> second plot is bigger.