[R] different coloured axis title labels for different axes

Dalthorp, Daniel ddalthorp at usgs.gov
Mon Jan 11 18:52:55 CET 2016


How about this:

plot(0,0,xlab='',ylab='')
mtext(side=1,line=3,text='x axis',col=4)
mtext(side=2,line=3,text='y axis',col=2)

-Dan

On Mon, Jan 11, 2016 at 7:44 AM, Evan Cooch <evan.cooch at gmail.com> wrote:

> Consider a simple plot of X vs Y.  There are elements on the plot that
> represent X, or Y, that are presented in different colours (say, blue
> for X,   red for Y). Rather than use a legend, I would like to have the
> title label for the X-axis be in blue, and the title label for the
> Y-axis be in red.
>
> While it is trivial to change the color of the axis title labels for
> *both* axes at the same time, I haven't figured out how to trick thing
> into generating a blue title label for the X-axis, and a red title label
> for the Y- axis (i.e., different colours on different axes).
>
> I'm sure this is out there on searchable pages, but, I haven't managed
> to stumble across the appropriate search phrase(s).
>
> Pointers to the obvious solution welcomed in advance.
>
>
> Cheers....
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>



-- 
Dan Dalthorp, PhD
USGS Forest and Rangeland Ecosystem Science Center
Forest Sciences Lab, Rm 189
3200 SW Jefferson Way
Corvallis, OR 97331
ph: 541-750-0953
ddalthorp at usgs.gov

	[[alternative HTML version deleted]]



More information about the R-help mailing list