是否可以在R中的一个图中添加多个PIE3D图表?

发布于 2025-02-07 08:07:31 字数 189 浏览 0 评论 0原文

我确实在R. 1中制作了三个PIE3D(plotrix)图片,

  • 人口为整个人口
  • 的成年人
  • 现在是人口儿童的成年人1

,这是三个单独的数字。是否可以将它们添加到1个数字中?

Ggarange将行不通,因为PIE3D不是GGPLOT函数。 有人知道其他选择吗?

I did made three pie3D (plotrix) pictures in R.

  • 1 with the population as a whole
  • 1 for the adults of the population
  • 1 for children of the population

Now, it are three separate figures. Is it possible to add them together to 1 figure?

ggarange will not work because pie3D is not a ggplot function.
Does anybody knows other options?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨巷深深 2025-02-14 08:07:31

在r基础绘图中,您可以使用par设置一些图形参数来确定输出。在控制台中键入PAR以查看帮助文件。以下是帮助文件的摘录:

mfcol,mfrow

  • c(nr,nc)的向量。随后的数字将分别通过列(MFCOL)或行(MFROW)在设备上的NR-NC数组中绘制。

使用以下代码和模型数据,您可以将三个图安排在一个3“列”的行

library(plotrix)

## some mocked up data
x1 <- c(4, 5, 9, 3, 6)
x2 <- c(7, 2, 1, 1, 4)
x3 <- c(5, 5, 2, 1, 1)
## some common labels
labels <- c("a", "b", "c", "d", "e")

## set to 1 row, 3 columns
par(mfrow = c(1, 3))
pie3D(x1, labels = labels, explode = .1)
pie3D(x2, labels = labels, explode = .1)
pie3D(x3, labels = labels, explode = .1)
## re-set to 1 row, 1 column
par(mfrow = c(1, 1))

产生此图:

请让我知道这是否是您想要的。

In R base plotting you can set some graphical parameters with par to determine the output. Type ?par in the console to see the help file. The following is an excerpt from the helpfile:

mfcol, mfrow

  • A vector of the form c(nr, nc). Subsequent figures will be drawn in an nr-by-nc array on the device by columns (mfcol), or rows (mfrow), respectively.

With the following code and mockup data, you can arrange the three plots in a row of 3 "columns"

library(plotrix)

## some mocked up data
x1 <- c(4, 5, 9, 3, 6)
x2 <- c(7, 2, 1, 1, 4)
x3 <- c(5, 5, 2, 1, 1)
## some common labels
labels <- c("a", "b", "c", "d", "e")

## set to 1 row, 3 columns
par(mfrow = c(1, 3))
pie3D(x1, labels = labels, explode = .1)
pie3D(x2, labels = labels, explode = .1)
pie3D(x3, labels = labels, explode = .1)
## re-set to 1 row, 1 column
par(mfrow = c(1, 1))

yielding this graph:
enter image description here

Please let me know whether this is what you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文