[R] summary for tick marks

Erin Hodgess hodgess at uhddx01.dt.uh.edu
Thu Oct 26 22:32:09 CEST 2000


Dear R People:

In case anyone is interested, here are some of the answers
I received regarding tick marks:

 plot(0,0)
 axis(1, pos=0)
 axis(2, pos=0)

   O__  ---- Peter Dalgaard             Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

From: Ross Ihaka <ihaka at stat.auckland.ac.nz>


On Thu, Oct 26, 2000 at 11:29:18AM -0500, Erin Hodgess wrote:

> I am drawing graphs for a College Algebra class. I would like to have
> the x and y axes, along with the lines that I am plotting.  So I leave
> off the axes, and use xlim and ylim.  Then I add my abline(v=0).
> 
> However, I would like to have tick marks on the abline.  How would I do
> that, please?

Here is an example of drawing a cubic with axes in the middle of the
plot.
	
	#  Draw the basic curve (limits were established by trial and error).
	#  The axes are turned off blank axis labels used.
	 
	curve(x * (2 * x - 3) * (2 *  x + 3), from = -1.85, to = 1.85,
	      xlim = c(-2, 2), ylim = c(-10, 10),
	      axes = FALSE, xlab = "", ylab = "")
	
	#  Draw the axes at the specified positions (crossing at (0, 0)).
	#  The ticks positions are specified (those at (0,0) are omitted). 
	#  Note the use of las=1 to produce horizontal tick labels on the
	#  vertical axis.
	
	axis(1, pos = 0, at = c(-2, -1, 1, 2))
	axis(2, pos = 0, at = c(-10, -5, 5, 10), las = 1)
	
	#  Use the mathematical annotation facility to label the plot.
	
	title(main = expression(italic(y==x * (2 * x - 3) * (2 * x + 3))))

Ross

Thanks again to all!

Sincerely,
Erin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list