We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to add a line break in the plot title using the LaTeX command \newline, however it didn't produce the figure as expectation.
\newline
library(plyr) library(ggplot2) x <- seq(0, 4, length.out=100) alpha <- 1:5 data <- mdply(alpha, function(a, x) data.frame(v=a*x^a, x=x), x) p <- ggplot(data, aes(x=x, y=v, color=X1)) + geom_line() + ylab(TeX('$\\alpha x^\\alpha$, where $\\alpha \\in 1\\ldots 5$')) + ggtitle(TeX('Using $\\LaTeX$ for plotting in ggplot2. $\\newline$ I $\\heartsuit$ ggplot!')) + coord_cartesian(ylim=c(-1, 10)) + guides(color=guide_legend(title=NULL)) + scale_color_discrete(labels=lapply(sprintf('$\\alpha = %d$', alpha), TeX)) print(p)
The text was updated successfully, but these errors were encountered:
Hi caijun, I can add support for that. In the meantime, you should be able to simply use \n to force a newline.
\n
Sorry, something went wrong.
I tried \n, but it didn't work.
library(plyr) library(ggplot2) x <- seq(0, 4, length.out=100) alpha <- 1:5 data <- mdply(alpha, function(a, x) data.frame(v=a*x^a, x=x), x) p <- ggplot(data, aes(x=x, y=v, color=X1)) + geom_line() + ylab(TeX('$\\alpha x^\\alpha$, where $\\alpha \\in 1\\ldots 5$')) + ggtitle(TeX('Using $\\LaTeX$ for plotting in ggplot2. \n I $\\heartsuit$ ggplot!')) + coord_cartesian(ylim=c(-1, 10)) + guides(color=guide_legend(title=NULL)) + scale_color_discrete(labels=lapply(sprintf('$\\alpha = %d$', alpha), TeX)) print(p)
No branches or pull requests
I would like to add a line break in the plot title using the LaTeX command
\newline
, however it didn't produce the figure as expectation.The text was updated successfully, but these errors were encountered: