r main.font不与CDPLOT()一起使用 - 是否有人知道在CDPLOT图标题中从粗体变成平原的解决方法?
在基础r中,图的主要标题的默认字体面是粗体:
plot(1:10, main = "Foo")
我可以将字体的面更改为普通的,
plot(1:10, main = "Foo", font.main = 1)
但是,将大胆更改为平原的相同方法不适用于CDPLOT()
## NASA space shuttle o-ring failures
fail <- factor(c(2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1,
1, 2, 1, 1, 1, 1, 1),
levels = 1:2, labels = c("no", "yes"))
temperature <- c(53, 57, 58, 63, 66, 67, 67, 67, 68, 69, 70, 70,
70, 70, 72, 73, 75, 75, 76, 76, 78, 79, 81)
## CD plot
cdplot(fail ~ temperature, main="bw = default", font.main = 1)
标题仍然大胆,我得到了错误消息“额外的参数'font.main'将被忽略” 。我还尝试了expression(plain(“ foo”))
,但问题在于我有一个前面生成很多图,标题来自main = paste(“某些文本) “,i)
和表达式(plain ...
无法处理峰要将标题字体面更改为简单吗?
In base R the default font face for the main title of a plot is bold:
plot(1:10, main = "Foo")
I can change the font face to plain using
plot(1:10, main = "Foo", font.main = 1)
However, the same method for changing bold to plain does not work with cdplot()
## NASA space shuttle o-ring failures
fail <- factor(c(2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1,
1, 2, 1, 1, 1, 1, 1),
levels = 1:2, labels = c("no", "yes"))
temperature <- c(53, 57, 58, 63, 66, 67, 67, 67, 68, 69, 70, 70,
70, 70, 72, 73, 75, 75, 76, 76, 78, 79, 81)
## CD plot
cdplot(fail ~ temperature, main="bw = default", font.main = 1)
The title remains bold and I get the error message "extra argument ‘font.main’ will be disregarded". I have also tried expression(plain("Foo"))
but the problem is that I have a for-loop generating lots of plots, the title comes from main = paste("some text", i)
and expression(plain...
can't handle the iterable, so the title of each plot will then be "some text i". Does anyone know some other workaround to change the title font face to plain, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来
cdplot()
没有将更多的图形参数传递给par
。因此,您需要使用其他低级图形功能(例如title()
)来自定义图。It seems that
cdplot()
doesn't pass further graphical parameters topar
. Hence, you need to use other low-level graphical functions (e.g.title()
) to customize your plot.