I have a data set as follows and am creating a bubbleplot using symbols, with the Z column used as bubble size:
我有一个数据集如下,我正在使用符号创建一个气泡图,Z列用作气泡大小:
X Y Z TITLE
151.2 31.5 51023 xyz
160.2 51.8 4912 xyz
191.7 2.1 874201 abc
radius <- sqrt(data$z/pi)
symbols(data$x,data$y,circles=radius,inches=0.35,
cex.axis=1.5,cex.lab=1.5,xlab="xlab", ylab="ylab")
I then would like to have a second bubbleplot with any Title of "abc" removed. However, when I do this, the bubbles then resize themselves in comparison to the original plot. How can I normalize bubble size between plots?
然后,我想要第二个气泡图,删除任何“abc”标题。但是,当我这样做时,与原始图相比,气泡会自行调整大小。如何在图之间标准化气泡大小?
1 个解决方案
#1
1
Try something like
尝试类似的东西
data$radius <- sqrt(data$Z/pi)/50
with(data[data$TITLE != "abc",],
symbols(x = X, y = Y, circles = radius,
inches = FALSE, asp = 1,
xlim = c(140, 240), ylim = c(-10, 60)))
and
和
with(data,
symbols(x = X, y = Y, circles = radius,
inches = FALSE, asp = 1,
xlim = c(140, 240), ylim = c(-10, 60)))
If you specify inches = 0.35
, the circles are scaled to make largest circle dimension 0.35 inches. Read more at ?symbols
如果指定inches = 0.35,则缩放圆圈以使最大圆尺寸为0.35英寸。阅读更多?符号
#1
1
Try something like
尝试类似的东西
data$radius <- sqrt(data$Z/pi)/50
with(data[data$TITLE != "abc",],
symbols(x = X, y = Y, circles = radius,
inches = FALSE, asp = 1,
xlim = c(140, 240), ylim = c(-10, 60)))
and
和
with(data,
symbols(x = X, y = Y, circles = radius,
inches = FALSE, asp = 1,
xlim = c(140, 240), ylim = c(-10, 60)))
If you specify inches = 0.35
, the circles are scaled to make largest circle dimension 0.35 inches. Read more at ?symbols
如果指定inches = 0.35,则缩放圆圈以使最大圆尺寸为0.35英寸。阅读更多?符号