0

I'm making a big plot to compare forecast-models. But how can one add additional text to a label? For example this is one of the plots that I need additional text beside the y-label.

(qplot(y = VaR90_n_roll1, x = 507:1006, geom = 'line')
                     + geom_line(color = 'green')
                     + geom_point(aes(x = 507:1006, y = sp500_logreturns[507:1006]))
                     + coord_cartesian(ylim = c(-0.065,0.05))
                     + labs(y = c('Log returns', 
                            'Model 1'), x = '')
                     + ggtitle("")
                     + theme(plot.title = element_text(hjust = 0.5)))

Which gives me this: enter image description here

But I need this: enter image description here

1 Answer 1

3

It this what you are looking for?

library(ggplot2)

ggplot(mtcars, aes(wt, mpg))+
  geom_point()+
  labs(y = expression(atop(bold(Model~1), scriptstyle(Log~returns))))+
  theme(axis.title.y = element_text(size = 14))

Created on 2020-05-24 by the reprex package (v0.3.0)

Sign up to request clarification or add additional context in comments.

6 Comments

That looks fine to me, but how do I change the font to bold in the 'outer' label?
You have two options now with @user20350's alternative
It's getting better and better. Now, lastly, is it possible to make it bigger (like the standard ggtitle)?
Sorry, I meant without making the "Model" bigger.
I think there was a disconnect between your written question and the image you wanted! But this seems to fit the bill?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.