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 ______________________________________________ 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.