绘制直方图上的平均速度

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

我想要做的事情在理论上非常简单:

dataset <- data.frame(angle = c(10.1,-10.1,20.5,83.2),
                     speed = c(20,40,10,30))

a <- ggplot(data = dataset, aes( x = angle))+
  geom_histogram( stat ="bin", bins =100, aes(color = mean(speed))) +
  coord_polar( start =3.14,  direction = 1 ,theta = "x")+
  theme_pander(lp = 'top')+
  xlim(-150,150)+
  scale_colour_pander()#starts at Pi

我目前得到的:

enter image description here

我想将每个箱子的平均速度应用为每个箱子的颜色。任何帮助,将不胜感激。

谢谢!

r ggplot2
1个回答
0
投票

只是想知道,在你的图表上,计数是0-1乘以.25,我是一个nub R用户,但这是我尝试你的问题:

ggplot(data = dataset, aes( x = angle))+
geom_histogram( stat ="bin", bins =100, aes(color = mean(speed))) +
coord_polar( start =3.14,  direction = 1 ,theta = "x")+
xlim(-150,150)+
geom_line(data = dataset, aes(x=angle, mean(speed)/100), lwd = 2, col = "blue")

我拿出的台词是因为找不到它们。这绘制了一条0.25的曲线,你的意思是/ 100,当你拿出它时它没有显示你的其他情节。希望能帮助到你。

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