作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想要一个圆形条形图,如下所示:
但现在,我只有:
为此,我在 R 中使用了以下代码:
require(ggplot2)
ggplot(PolarPlot,aes(x,y,
fill=x))+
geom_bar(width=1,stat="identity")+
coord_polar() + xlab("")+ylab("")+
theme(legend.position = "none" , axis.text.y = element_blank() ,
axis.ticks = element_blank()
PolarPlot <- structure(list(x = structure(1:7, .Label = c("Class1", "Class2",
"Class3", "Class4", "Class5", "Class6", "Class7"), class = "factor"),
y = c(2L, 8L, 17L, 56L, 28L, 7L, 2L)), .Names = c("x", "y"),
class = "data.frame", row.names = c(NA, -7L))
最佳答案
您首先创建一个条形图,然后将其转换为极坐标(这很好)来生成您的图。如果您不希望条形图从极坐标图中的中心开始,那么您需要确保它们不会从条形图中的底部开始。
我的意思最容易通过实际展示来解释。首先,我以与您相同的方式创建条形图,但我扩展了 y 轴以达到负值:
p <- ggplot(PolarPlot, aes(x, y, fill=x)) +
geom_bar(width=1,stat="identity") +
xlab("") + ylab("") +
theme(legend.position = "none" , axis.text.y = element_blank() ,
axis.ticks = element_blank()) +
scale_y_continuous(limits = c(-50, 60))
p + coord_polar()
limits
的值来修改中心间隙的大小。在
scale_y_continuous()
.
关于r - 极柱图,最内圈为空 使用 R,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38659150/
所以我一直在使用 JFreeChart 来尝试创建 spiderWebPlot,到目前为止它运行良好: 我想知道是否可以为可能值添加圆圈,所以它看起来更像一个真正的蜘蛛网,类似于: 最佳答案 按照建议
我正在尝试像在 jsfiddle 中一样创建一个响应式圆圈,其中有一个内圆圈。如果我调整页面大小,我希望外圈和内圈自动调整。 我怎样才能实现这种行为? 这是我尝试过的:http://jsfiddle.
我是一名优秀的程序员,十分优秀!