[R] identifying what labels have been created in a plot

2009-01-30 Thread Dennis Fisher

Colleagues

R 2.8.0; OS X, Vista, Ubuntu Linux

In some instances, when I create a graphic using plot(XVAR, YVAR), it  
would be valuable to know the values that R will display on the y-axis  
(e.g., if the range of data is 0-70, it might display 0, 10, 30, 50,  
70).   Is there a simple means to access these values?


Also, in some instances, additional ticks appear between the displayed  
values (in this case, at 20, 40, 60).  Can I obtain the list of the  
positions of all ticks?


Access to this information permits me to tailor the ticks and labels  
in a particular manner.


Thanks for any suggestions.

Dennis


Dennis Fisher MD
P  (The P Less Than Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] identifying what labels have been created in a plot

2009-01-30 Thread jim holtman
It might be easier to generate the plot without the y-axis and then
add you data with 'axis' using whatever tick marks you want.

On Fri, Jan 30, 2009 at 11:51 AM, Dennis Fisher fis...@plessthan.com wrote:
 Colleagues

 R 2.8.0; OS X, Vista, Ubuntu Linux

 In some instances, when I create a graphic using plot(XVAR, YVAR), it would
 be valuable to know the values that R will display on the y-axis (e.g., if
 the range of data is 0-70, it might display 0, 10, 30, 50, 70).   Is there a
 simple means to access these values?

 Also, in some instances, additional ticks appear between the displayed
 values (in this case, at 20, 40, 60).  Can I obtain the list of the
 positions of all ticks?

 Access to this information permits me to tailor the ticks and labels in a
 particular manner.

 Thanks for any suggestions.

 Dennis


 Dennis Fisher MD
 P  (The P Less Than Company)
 Phone: 1-866-PLessThan (1-866-753-7784)
 Fax: 1-415-564-2220
 www.PLessThan.com

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] identifying what labels have been created in a plot

2009-01-30 Thread Marc Schwartz
on 01/30/2009 10:51 AM Dennis Fisher wrote:
 Colleagues
 
 R 2.8.0; OS X, Vista, Ubuntu Linux
 
 In some instances, when I create a graphic using plot(XVAR, YVAR), it
 would be valuable to know the values that R will display on the y-axis
 (e.g., if the range of data is 0-70, it might display 0, 10, 30, 50,
 70).   Is there a simple means to access these values?
 
 Also, in some instances, additional ticks appear between the displayed
 values (in this case, at 20, 40, 60).  Can I obtain the list of the
 positions of all ticks?
 
 Access to this information permits me to tailor the ticks and labels in
 a particular manner.
 
 Thanks for any suggestions.
 
 Dennis

See ?axis, where in the Details, it will lead you to ?axTicks

plot(c(0, 70), c(0, 70))

# Y axis tick marks
 axTicks(2)
[1]  0 10 20 30 40 50 60 70


pretty() will also get you similar information, save when using log scaling:

 pretty(c(0, 70))
[1]  0 10 20 30 40 50 60 70


Keep in mind that you can always explicitly call axis() using the 'at'
argument to specify the locations of the tick marks and labels, after
plotting something without the axes being drawn by default.

HTH,

Marc Schwartz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] identifying what labels have been created in a plot

2009-01-30 Thread David Winsemius
You might want to look at the pretty function. The code that I have  
seen often calls that function for the creation of axis tick levels  
with min and max as arguments. And its help page suggests that axTicks  
may give you exactly what you were seeking.


--
David Winsemius

On Jan 30, 2009, at 11:51 AM, Dennis Fisher wrote:


Colleagues

R 2.8.0; OS X, Vista, Ubuntu Linux

In some instances, when I create a graphic using plot(XVAR, YVAR),  
it would be valuable to know the values that R will display on the y- 
axis (e.g., if the range of data is 0-70, it might display 0, 10,  
30, 50, 70).   Is there a simple means to access these values?


Also, in some instances, additional ticks appear between the  
displayed values (in this case, at 20, 40, 60).  Can I obtain the  
list of the positions of all ticks?


Access to this information permits me to tailor the ticks and labels  
in a particular manner.


Thanks for any suggestions.

Dennis


Dennis Fisher MD
P  (The P Less Than Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.