Hello, my question is if I have two axes in a graphics as I can put him a different color al axis and to the number of the scale. ? Thanks. Ruben
On Mon, 2003-09-01 at 09:42, solares at unsl.edu.ar wrote:> Hello, my question is if I have two axes in a graphics as I can put him a > different color al axis and to the number of the scale. ? Thanks. RubenI am not entirely sure if you want the actual axis lines and tick marks in different colors or simply the axis labels at the tick mark locations in different colors or perhaps both. So I will combine both approaches in a single example: # Generate a simple plot # Do not draw the axes or axis labels plot(1:10, axes = FALSE, ann = FALSE) # Now draw x axis in red, but do not draw the tick mark # labels. axis(1, labels = FALSE, col = "red") # Now draw the labels in "blue" # Use axTicks() to get default tick locations at = axTicks(1) mtext(side = 1, text = at, at = at, col = "blue", line = 1) # Now draw x axis label mtext(side = 1, text = "X Axis Label", line = 3) # Now do the same for the Y axis, this time # use 1:10 for the axis tick marks and labels # and reverse the colors at = 1:10 axis(2, labels = FALSE, at = at, col = "blue") mtext(side = 2, text = at, at = at, col = "red", line = 1) mtext(side = 2, text = "Y Axis Label", line = 3) For more information see ?plot, ?plot.default, ?axis, ?mtext and ?axTicks. Hope that helps, Marc Schwartz
See ?axis On Mon, 1 Sep 2003 solares at unsl.edu.ar wrote:> Date: Mon, 1 Sep 2003 11:42:30 -0300 (ART) > From: solares at unsl.edu.ar > To: R-help at stat.math.ethz.ch > Subject: [R] Axis color > > Hello, my question is if I have two axes in a graphics as I can put him a > different color al axis and to the number of the scale. ? Thanks. Ruben > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >-- Cheers, Kevin ------------------------------------------------------------------------------ "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." -- Charles Babbage (1791-1871) ---- From Computer Stupidities: http://rinkworks.com/stupid/ -- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki)