Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Break R expression into two lines along axis [duplicate]

$
0
0

I have this plot with a really long label along the y axis using 'expression', however, it gets distorted when I try to break it into two lines, see below:

year = seq(1980,1990)
irrig.area = seq(1,11)
ylab.text = expression("This label is really long label but is  " ~ ""<= 100 ~ "characters in total 
length")
plot(year,irrig.area,xlab="Year",ylab=ylab.text)

The label is really long but works as expected with 'expression'

enter image description here

By trying to add a new line like so:

ylab.text = expression("This label is really\n long label but is  " ~ ""<= 100 ~ "characters in 
total length")
plot(year,irrig.area,xlab="Year",ylab=ylab.text)

My y axis label gets cut off. What am I doing wrong?

enter image description here


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>