如何在R中使点阵xyplot()成为灰度? [英] How to make lattice xyplot() grayscale in R?

查看:84
本文介绍了如何在R中使点阵xyplot()成为灰度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最简单的方法是使此绘图成为灰度(或者可能是黑白)而不是默认的多色:

What is the simplest way to make just this plot grayscale (or perhaps black and white) rather than the default multi-colour:

xyplot(y1 + y2 ~ x, mydata, auto.key=TRUE)

我已经看到关于创建新图形设备或更改所有图的选项的讨论,但是我是否可以在xyplot()函数本身中包含将绘图转换为灰度的选项?

I've seen discussion of creating new graphics devices or changing options for all plots, but is there an option that I can include perhaps in the xyplot() function itself that will convert the plot to grayscale?

推荐答案

library(lattice)
bwtheme <- standard.theme("pdf", color=FALSE)
mydata <- data.frame(y1=rnorm(10), y2=rnorm(10), x=1:10)
xyplot(y1 + y2 ~ x, mydata, auto.key=TRUE, par.settings=bwtheme)

为进行比较:

这篇关于如何在R中使点阵xyplot()成为灰度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆