Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 用geom_散射器缩放x和y_R_Ggplot2_Scatter Plot_Scaletransform - Fatal编程技术网

R 用geom_散射器缩放x和y

R 用geom_散射器缩放x和y,r,ggplot2,scatter-plot,scaletransform,R,Ggplot2,Scatter Plot,Scaletransform,我的ggplot里有些馅饼很小,里面看不到“波特”的重新分配。我的第二个问题是,第一个馅饼彼此非常接近,所以我们不知道它们有多少,我想把这个情节讲清楚。但是当我使用log10刻度时,我得到了一个错误:“seq.default(min,max,by=by)中的错误:'from'必须是一个有限的数字” 以下是我的情节: 以下是我的数据: industry comt cattt volll Filiale MCI Visa Natio

我的ggplot里有些馅饼很小,里面看不到“波特”的重新分配。我的第二个问题是,第一个馅饼彼此非常接近,所以我们不知道它们有多少,我想把这个情节讲清楚。但是当我使用log10刻度时,我得到了一个错误:“seq.default(min,max,by=by)中的错误:'from'必须是一个有限的数字”

以下是我的情节:

以下是我的数据:

       industry            comt        cattt    volll   Filiale MCI   Visa  National UPI Amex
 1     Appl, Furni, Mate   23606.424   1181598   6219    1708   359   1516     2636   9    1
 2     Business expenses    4726.499    183885   3592    1163   131    686     1612   9  654
 3              Clothing   47893.360   1918793  15939    3187  1218   4993     6532  86   86
 4  Education and health   62877.728   2754194  37736   10743  2132   8301    16551  19 5428
 5                Luxury  358699.815  20129817 192014   63765 16257  44096    67810   8    0
 6                others  103460.838   6927711  65699   10968  4924  26728    23060   7    0
 7     Personal services   78880.119   3112051  28755    6207  2718   7656    12165 124    0
 8           Restaurants  218580.788   8892880  88280   15171 10357  34500    27591   2    0
 9                Retail  702095.418  40652702 524690  157434 39082 125088   202876   5    0
 10          Technology    65161.087   3573220  28920    8154  1784   5656    13324  39    0
 11       Transportation   61907.204  20052011  38831    9570  6363   7063    15830   0    0
 12               Travel 2338812.925 103582243 293428   12839 68019 173803    33300   0    0
这是我的代码:

p <- ggplot(dt, aes(cattt, comt))
kk = p + geom_scatterpie(aes(x=cattt/23, y=comt, r= volll),
                data = dt, cols = c("Filiale", "MCI", "Visa","National", 'UPI','Amex'),color=NA, alpha=.6)+
guides(fill=guide_legend(title="Type \n Porteur"))+
geom_scatterpie_legend(dt$volll, x=500000, y=2500000)

p一种方法是将数值乘以或除以一个因子,例如3。您可以将“coord_fixed”参数添加到绘图中以拉伸x轴。我不确定这是否会影响饼图

p + geom_scatterpie(aes(x=cattt/23, y=comt,r= volll*3) + 
coord_fixed(ratio = 3/1) +  data = dt, cols = c("Filiale", "MCI", "Visa","National", 'UPI','Amex'),color=NA, alpha=.6) +
guides(fill=guide_legend(title="Type \n Porteur"))+
geom_scatterpie_legend(dt$volll, x=500000, y=2500000)

p + geom_scatterpie(aes(x=cattt/23, y=comt, r = volll/3) + 
coord_fixed(ratio = 3/1) +  data = dt, cols = c("Filiale", "MCI", "Visa","National", 'UPI','Amex'),color=NA, alpha=.6) +
guides(fill=guide_legend(title="Type \n Porteur"))+
geom_scatterpie_legend(dt$volll, x=500000, y=2500000)