如何从ggplot2包中仅绘制geom_point中的一系列值? [英] How to draw only a range of values in geom_point from the ggplot2 package?
问题描述
大家好,
我有以下熔化的数据:
X变量值
1 StationA SAR11.cluster 0.001309292
2 StationB SAR11.cluster 0.002712237
3 StationC SAR11。 cluster 0.002362708
4 StationD SAR11.cluster 0.002516751
5 StationE SAR11.cluster 0.004301075
6 StationF SAR11.cluster 0.0
。
。
。
等
等
我使用下面的代码来绘制一个泡泡图的数据:
ggplot(foomelt,aes(x = foomelt $ Station,y = variable,angle = 45,size = (value)))+
+ geom_point()+ opts(theme_bw(),axis.text.x = theme_text(size = 10,angle = 70))
+ scale_area()
除了我想忽略0(零)值并且仅用于点值的缩放在所有那些比零和最大值更大的粒子之间。
我不想从数据中删除零值行,因为为了证明一个点,我希望包含所有的站点和变量,并将零值保留为空白。
我设法使用它来忽略零值,但缩放不起作用:
ggplot(foomelt,aes(x = foomelt $ Station,y = variable,angle = 45,size =(value> 0)))+
+ geom_point()+ opts(theme_bw(),axis.text。 x = theme_text(size = 10,angle = 70))
+ scale_area(Ratio)+ scale_size_identity()
任何帮助将不胜感激。
我不确定这是您的目标因为,但是在绘制点时忽略零值的一种方法是将geom_point()语句修改为
geom_point(subset =。(value> 0))
这行只传递数据fram中的非零值e被绘制。
Hello All, I have the following molten data:
X variable value
1 StationA SAR11.cluster 0.001309292
2 StationB SAR11.cluster 0.002712237
3 StationC SAR11.cluster 0.002362708
4 StationD SAR11.cluster 0.002516751
5 StationE SAR11.cluster 0.004301075
6 StationF SAR11.cluster 0.0
.
.
.
etc.
etc.
I used the following code to chart a bubblechart of the data:
ggplot(foomelt, aes(x=foomelt$Station, y=variable, angle=45, size=(value))) +
+geom_point() + opts(theme_bw(), axis.text.x = theme_text(size=10, angle = 70))
+ scale_area()
All is well except that I want to ignore the 0 (zero) values and only use for the scaling of the dots values between all those that are grater than zeroes and the max value. I don't want to delete the zero values rows from the data because in order to prove a point I want all the stations and variables to be included and to have those with the zero value left blank.
I managed to use this to ignore the zero values but scaling does not work:
ggplot(foomelt, aes(x=foomelt$Station, y=variable, angle=45, size=(value>0))) +
+ geom_point() + opts(theme_bw(), axis.text.x = theme_text(size=10, angle = 70))
+ scale_area("Ratio") + scale_size_identity()
any help would be greatly appreciated.
i am not sure if this is what you are looking for, but one approach to ignore the zero values while plotting the points is to modify your geom_point() statement to
geom_point(subset = .(value > 0))
this line passes only the non zero values in the data frame to be plotted.
这篇关于如何从ggplot2包中仅绘制geom_point中的一系列值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!