Multi-line y label in plot
data-visualization, r
Solution
You need to set the margins using `mar` or `mgp`:
l <- 10
op <- par(mar=c(5, 6, 4, 2) + 0.1)
plot(0:l, (0:l), type='l',
yaxt='n',
xlab='Index',
ylab='Cumulative sum\nof the sorted weights')
par(op)
Problem
Is there a way to create multi-line labels for the y axis in an R plot? I have tried adding a `\n` where the newline should be, but then the first line of the label gets clipped: ``` l <- 10 plot(0:l, (0:l), type='l', yaxt='n', xlab='Index', ylab='Cumulative sum\nof the sorted weights') ``` This happens both with the `tikzDevice` and inside RStudio. Also, I tried some of the `par()` options with no luck. How to do it properly? (The oversized uper margin bothers me, too...)