Include text control characters in plotmath expressions

本小妞迷上赌 提交于 2019-11-27 23:56:43

As you have figured plotmath does not support newlines within, but you can use mtext with bquote, to write each line. For example I create a list of lines :

Lines <- list(bquote(paste( "Plot of " , phi , " of: "  , .(lab))),
              bquote(paste("Functional form: " , .(form)))

mtext(do.call(expression, Lines),side=3,line=1:0)

if you use grid graphics, then the following grob can be useful to space the lines according to their height,

library(devtools)
source_gist(2732693)
grid.expr(as.expression(Lines))

(using agstudy's Lines)

plannapus

For the sake of completeness, here's another solution using unicode and no expressions (adapted from here and here):

plot(x, y, type="b")
title(main=paste("Plot of \u03A6 of:", lab, "\nFunctional form:", form), adj=0)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!