[R] How to make the labels of pie chart are not overlapping?

Ista Zahn istazahn at gmail.com
Fri Mar 15 17:52:36 CET 2013


On Fri, Mar 15, 2013 at 12:30 PM, Bert Gunter <gunter.berton at gene.com> wrote:
> Simple -- don't make a pie chart.

This is great advice. But it you (or your boss) insists on pie charts,
then you should provide us with a reproducible example that
illustrates your problem.

dat <- read.table(text="Product    predicted_MarketShare
Predicted_MS_Percentage
A                    2.827450e-02                             2.8
B                    4.716403e-06                             0.0
C                    1.741686e-01                             17.4
D                   1.716303e-04                             0.0",
                  header=TRUE)

pie(dat[[2]], labels=dat[[1]])

Does not give overlapping labels, so I don't yet have an example of
the problem you are trying to solve.

Best,
Ista

>
> -- Bert
>
> (Seriously -- this is an awful display. Consider, instead, a bar plot
> plotting cumulative sums of percentages with products/bars ordered from
> largest percentage to smallest; or plotting just the percentages in that
> order, depending on which is more informative.)
>
> On Fri, Mar 15, 2013 at 6:58 AM, Tammy Ma <metal_licaling at live.com> wrote:
>
>> I have the following dataframe:
>>
>> Product    predicted_MarketShare  Predicted_MS_Percentage
>> A                    2.827450e-02                             2.8
>> B                    4.716403e-06                             0.0
>> C                    1.741686e-01                             17.4
>> D                   1.716303e-04                             0.0
>> .......
>>
>> Because there are so many products, and most of predicted Market share is
>> around 0%.
>> When I make pie chart, the labels of those product with 0% market share
>> are overlapping.
>> How do I make the labels are not overlapping?
>>
>> Kind regards.
>> Tammy
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list