Italics in title of Lattice graph

雨燕双飞 提交于 2019-12-01 02:15:18

There argument you are passing to main needs a couple of changes.

  • To use R's plotmath specials (i.e. things like italic()), it should be an expression object rather than a character string. That means doing something like this:

    main = expression(paste("Length-Freq of", italic("E. coruscans"), "by Gear"))
    

    instead of this:

    main = paste("Length-Freq of", italic("E. coruscans"), "by Gear")
    
  • In addition, you are wanting to italicize i's value rather than its name, but if you just type italic(i), lattice will render i's name as a little italic "i" for each species. Use bquote() or substitute() to substitute in i's value instead, as demonstrated here:

    i <- "E. coruscans"
    xyplot(1:10~1:10,
        main = substitute(expr = expression(paste("Species name: ", italic(i))), 
                          env = list(i=i)))
    

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