如何在 R 中使用 ggplot2 生成新型图形

How to generate a new type of graphics with ggplot2 in R

如果我想生成一种ggplot2没有的新型图形,我该怎么做。我的意思是,如果我想生成一个没有网格的 3D 轴,而只有轴(如图所示),我该如何生成它,我只需要使用 ggplot2。我可以导入某种图形,或使用特定字体的线条字符,或导入任何类型的数据或扩展名来生成新图形吗?

换句话说,为什么 ggplot2 有奇特的情节而 R base 没有。它是否使用特殊字符或图像来生成线条?

哪里可以看一些关于它的issues,就是答个作业,有没有lecture o example让我看懂的?

感谢您的提问!!!

尝试ggplot2 + gg3D

如果你没有 gg3D - 通过 devtools::install_github("AckerDWM/gg3D")

安装

我给你举个例子,我想,你明白了。

qplot(x=1, y=0, z=1, geom="blank") + 
theme_void() +
axes_3D() +
geom_segment(aes(x = 0, y = 0.13, xend = 0, yend = 0.5),
               arrow = arrow(length = unit(3, "mm"), type = "closed"), size = 1) +
geom_segment(aes(x = 0, y = 0.135, xend = -0.346, yend = -0.14),
             arrow = arrow(length = unit(3, "mm"), type = "closed"), size = 1) +
geom_segment(aes(x = 0, y = 0.135, xend = 0.346, yend = -0.14),
             arrow = arrow(length = unit(3, "mm"), type = "closed"), size = 1) +
labs_3D(labs=c("z", "x", "y"),
        hjust=c(0,1,-2), vjust=c(1, 1, 0.5), angle=c(0, 0, 0))