轴箭头的ggplot主题参数突然不起作用

发布于 01-17 09:59 字数 531 浏览 2 评论 0原文

我有一个自定义的GGPLOT主题,现在已经使用了一段时间了。本周,我在使用此主题进行图时开始遇到

错误我以前用过将轴线变成箭头的参数。我能够重现下面的错误,但是我很困惑为什么现在会发生这种错误。有人知道为什么会发生这种情况或可能为将轴线变为箭头的一些替代方案吗?

例如:

library(ggplot2)
dat <- mtcars

ggplot(data = dat) +
  geom_point(aes(x = wt, y = mpg)) + 
  theme(axis.line = element_line(color = "black", arrow = arrow(length = unit(0.3, "lines"), type = "closed")))

编辑:

加载图形库(library(Graphics))临时修复了问题。但是,编织降价文件会产生与上面相同的错误。似乎我的示例不是重现错误,但是即使在重新安装rstudio并更新所有软件包之后,我的计算机仍在我的计算机上持续存在。

I have a custom ggplot theme that I have been using for a while now. This week I started getting an error when making plots using this theme stating that plot.new has not been called yet

I've traced the error to an axis.line() argument which i've used before to turn my axis lines into arrows. I was able to reproduce the error below, but i'm confused why this is happening now. Does anyone know why this could be happening or possibly provide some alternatives to changing axis lines to arrows?

Eg:

library(ggplot2)
dat <- mtcars

ggplot(data = dat) +
  geom_point(aes(x = wt, y = mpg)) + 
  theme(axis.line = element_line(color = "black", arrow = arrow(length = unit(0.3, "lines"), type = "closed")))

EDIT:

loading the graphics library (library(graphics)) fixed the issue temporarily. However knitting the markdown file produces the same error as above. It seems my example is not reproducing the error, however it's persisting on my computer even after re-installing RStudio AND updating all packages.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文