2

some pies in my ggplot are very small and cant see the repartition of the "porteur" inside. my second problem is that the first pies are very close to each other so we cant know how much they are, i want to make this plot clear. but when i use log10 scale i get the error : "Error in seq.default(min, max, by = by) : 'from' must be a finite number".

here's my plot :

enter image description here

here's my data :

       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

and here's my code :

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)

1 Answer 1

0

One way would be to scale the values by multiplying or dividing by a factor e.g. 3. You could add the "coord_fixed" argument to your plot to stretch the x axis. I am not sure if this would affect the pie charts.

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)

or

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.