Hi Barry, Sorry for not being clear.
"Not work" == "Doesn't add the text to the ylab" My initial example was intended with no line breaks. Here it is again with variations: plot(1) title(ylab = expression(paste("test loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong (% of 360" *degree, ")"))) # won't work plot(1) title(ylab = expression(paste("test looooooooooooooooooooooooooooooong (% of 360" *degree, ")")), cex.lab = 1) # works plot(1) title(ylab = expression(paste("test looooooooooooooooooooooooooooooong (% of 360" *degree, ")")), cex.lab = 3) # doesn't work My point is that in regular text, ylab plots it where it then goes outside the borders. With the use of expressions - the text just doesn't show up. Originally I thought it was because of my miss-use of expressions, until I figured it was the level of cex.lab I was using. The problem is that when you can't see the text, you don't have a sense of how much to decrease the cex.lab so the text will fit. I hope I was now clearer. Tal ----------------Contact Details:------------------------------------------------------- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Tue, Sep 28, 2010 at 11:29 AM, Barry Rowlingson < b.rowling...@lancaster.ac.uk> wrote: > On Tue, Sep 28, 2010 at 10:03 AM, Tal Galili <tal.gal...@gmail.com> wrote: > > Hello, > > > > It seems that there is a problem when plotting an expression in the ylab > of > > a plot in case it is too long. > > > > Example: > > > > plot(1) > > title(ylab = "test > > > looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong > > ") # work > > plot(1) > > title(ylab = expression(paste("test (% of 360" *degree, ")"))) # works > > plot(1) > > title(ylab = expression(paste("test looooooooooooooooooooooooooong (% of > > 360" *degree, ")"))) # doesn't work > > what does 'work/doesn't work' mean? > > I see some problems with the appearance of the label, and they seem > related to the line breaks in the label. A single line label: > > > plot(1) > > > title(ylab="looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong > cat is looooooooooooooooooooooooooooooooooooooooooooooooong") > > (where any line breaks you see are due to mail clients linebreaking) > works fine (except of course the label is truncated at the start and > end). > > However if I do: > > > plot(1) > > > title(ylab="looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong > cat is\n looooooooooooooooooooooooooooooooooooooooooooooooong") > > (with a newline char \n in there) > > I only see the last "looo*oong" because the first line is out of my > margin area. I can actually see the descender of the 'g', so I know > it's there. > > I think the 'doesn't work' you are having is because there's a > newline on the end of your continuation string: > > > plot(1) > > title(ylab="foo > + ") # has a newline at end > > title(ylab="foo") # doesn't > > You can give more label space by using par(mar=, for example: > > > par(mar=c(5,8,4,2)) > > plot(1) > > title(ylab="long\ncat\nis\nlong") > > But of course you need to know how many lines your ylab will be > before you make the plot... > > Barry > [[alternative HTML version deleted]] ______________________________________________ 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.