RE: [R] Create a plot legend in a new window

2004-12-10 Thread Petr Pikal
Hi Michael

I cannot find other option than 

1.  to go through legend code and modify it according to your 
wish (especially drawing parts)

2.  to use rect and text for making your own legend 

3.  experiment with legend settins to produce what you want

Cheers
Petr


On 9 Dec 2004 at 13:57, michael watson (IAH-C) wrote:

 Following on from this, what I want is to create a new window and fill
 up the entire window with my legend.
 
 I have tried:
 
 plot.new()
 par(mar=c(0,0,0,0))
 legend()
 
 But that still puts legend wherever I specify x and y.  So after I
 have set mar to c(0,0,0,0), how do I tell R to make the legend fill
 the entire window, starting at the top-left?
 
 Thanks
 Mick
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of michael watson
 (IAH-C) Sent: 09 December 2004 11:52 To: [EMAIL PROTECTED]
 Subject: [R] Create a plot legend in a new window
 
 
 Hi
 
 I have a complicated plot which has a potentially large legend.  What
 I want to do is actually create the legend in a new window.  Has
 anyone done this before?  I'd like to be able to create a window with
 just the legend in it, and have it so the window is just the right
 size etc.  I'm sure someone must have done this already?  If not, any
 tips would be welcome.
 
 Thanks
 Mick
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Create a plot legend in a new window

2004-12-10 Thread michael watson \(IAH-C\)
Just for the records (and if anyone ever wants to find the solution),
I solved my own problem (well sort of) through imaginative use of the
barplot command:


barplot(rep(1,4),horiz=TRUE,names.arg=rev(c(this,is,my,legend)),
col=rev(rainbow(4)), axes=FALSE,las=2)

Produces a very nice, re-sizeable legend in a new window :-D

Mick

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of michael watson
(IAH-C)
Sent: 09 December 2004 13:57
To: [EMAIL PROTECTED]
Subject: RE: [R] Create a plot legend in a new window


Following on from this, what I want is to create a new window and fill
up the entire window with my legend.

I have tried:

plot.new()
par(mar=c(0,0,0,0))
legend()

But that still puts legend wherever I specify x and y.  So after I have
set mar to c(0,0,0,0), how do I tell R to make the legend fill the
entire window, starting at the top-left?

Thanks
Mick

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of michael watson
(IAH-C)
Sent: 09 December 2004 11:52
To: [EMAIL PROTECTED]
Subject: [R] Create a plot legend in a new window


Hi

I have a complicated plot which has a potentially large legend.  What I
want to do is actually create the legend in a new window.  Has anyone
done this before?  I'd like to be able to create a window with just the
legend in it, and have it so the window is just the right size etc.  I'm
sure someone must have done this already?  If not, any tips would be
welcome.

Thanks
Mick

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Create a plot legend in a new window

2004-12-09 Thread Henrik Andersson
par(xpd=NA) will allow you to click outside your figure and create the 
legend there:

Short example:
par(mfrow=c(1,2),xpd=NA)
plot(1:5)
legend(locator(1),pch=1,legend=TEST)
Good luck, Henrik
michael watson (IAH-C) wrote:
Hi
I have a complicated plot which has a potentially large legend.  What I
want to do is actually create the legend in a new window.  Has anyone
done this before?  I'd like to be able to create a window with just the
legend in it, and have it so the window is just the right size etc.  I'm
sure someone must have done this already?  If not, any tips would be
welcome.
Thanks
Mick
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
-
Henrik Andersson
Netherlands Institute of Ecology -
Centre for Estuarine and Marine Ecology
P.O. Box 140
4400 AC Yerseke
Phone: +31 113 577473
[EMAIL PROTECTED]
http://www.nioo.knaw.nl/ppages/handersson
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Create a plot legend in a new window

2004-12-09 Thread michael watson \(IAH-C\)
Following on from this, what I want is to create a new window and fill
up the entire window with my legend.

I have tried:

plot.new()
par(mar=c(0,0,0,0))
legend()

But that still puts legend wherever I specify x and y.  So after I have
set mar to c(0,0,0,0), how do I tell R to make the legend fill the
entire window, starting at the top-left?

Thanks
Mick

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of michael watson
(IAH-C)
Sent: 09 December 2004 11:52
To: [EMAIL PROTECTED]
Subject: [R] Create a plot legend in a new window


Hi

I have a complicated plot which has a potentially large legend.  What I
want to do is actually create the legend in a new window.  Has anyone
done this before?  I'd like to be able to create a window with just the
legend in it, and have it so the window is just the right size etc.  I'm
sure someone must have done this already?  If not, any tips would be
welcome.

Thanks
Mick

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Create a plot legend in a new window

2004-12-09 Thread Petr Pikal
Hi Michael

If on windows (what you did not tell us) use

1.  plot your graph

2.  windows() # to create new grapfic template

3.  click on it to make it active

4.  plot(1,1,type=n)

5.  place your legend somewhere on the second plot e.g. by 
legend(locator(1), )

BTW

help.search(window) reveals that there is ts function window, 
but also graphic function windows. Maybe on the window help 
page could be mentioned link to this quite similar (by name) 
graphic function, even if it is completely unrelated.

Cheers
Petr


On 9 Dec 2004 at 11:52, michael watson (IAH-C) wrote:

 Hi
 
 I have a complicated plot which has a potentially large legend.  What
 I want to do is actually create the legend in a new window.  Has
 anyone done this before?  I'd like to be able to create a window with
 just the legend in it, and have it so the window is just the right
 size etc.  I'm sure someone must have done this already?  If not, any
 tips would be welcome.
 
 Thanks
 Mick
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html