如何在R中绘制坐标极坐标图

问题描述 投票:-1回答:1

我是Rstudio的新手,正在努力制作如下图:polar diagram

我的数据集看起来像这样

dataset:

我已经下载了ggplot2软件包,并且尝试键入一些我在互联网上看到的代码,但是,我无法使其正常工作。

非常感谢您!!

r polar-coordinates
1个回答
0
投票
使用mtcars作为示例数据,可以像这样实现所需的绘图:

library(ggplot2) library(dplyr) library(tidyr) ## Replace the following three lines with your data df <- mtcars %>% count(gear, cyl, name = "value") %>% unite(type, gear, cyl) ggplot(df, aes(x = type, y = value, fill = factor(type))) + geom_col(color = "white") + coord_polar(start = 0) + labs(title = "Title", subtitle = "Subtitle", caption = "Your caption", x = NULL, y = NULL) + theme_minimal() + theme(legend.position = "none") + theme(axis.text.y = element_blank())

“”

reprex package(v0.3.0)在2020-03-15创建

© www.soinside.com 2019 - 2024. All rights reserved.