showteeth / ggpie Goto Github PK
View Code? Open in Web Editor NEWggpie - A ggplot2 extension to create pie, donut and rose pie plot
Home Page: https://showteeth.github.io/ggpie
License: Other
ggpie - A ggplot2 extension to create pie, donut and rose pie plot
Home Page: https://showteeth.github.io/ggpie
License: Other
Could you include legend as a label info choice in addition to count, ratio, and all ? Also it will be super if it is possible to pick label info choices, for example legend and ratio, or legend and count, or all.
Thanks.
Hi,
Great package with very useful settings, I wonder if it was possible to make the borders of the pir chart thicker? Am I missing something, since I could not find that flag/option?
Thanks.
Danvor
Appreciate for creating such a good package. I meet up with a problem when using ggpie with summarized data.
I have my data like this:
dt <- data.frame(
Name = c("A", "B", "C","D","E"),
number = c(40, 35, 30,25,20)
)
and this is a summarized data. According to the document mentioned in https://showteeth.github.io/ggpie/reference/ggpie.html
it seemed that I can directly use number
as the proportion for the pie chart by setting count_type = "count"
, but it is confused that how to assign the count
column and after I run my code like this:
ggdonut(data = dt, group_key = "Name", count_type = "count",
label_info = c("all"), label_type = "horizon",
label_size = 4, label_pos = "out", label_threshold = 15)
an error occurs:
Error in PrepareData(data = data, group_key = group_key, count_type = count_type, : count column is missing in your data.
How to solve the problem? Should I rename the column number
tocount
? And I suggest that there should be some examples with count_type = "count"
in the readme document to show how to deal with wide data instead of long data.
Hi,
Thanks for your package. It seems to have exactly what I need: labels outside the plot when they are below a certain threshold. I do have one fix for the function ggpie
. Please observe the items from the documentation in bold:
labal_threshold Threashold of the ratio to determine label position (in/out pie). Default: NULL.
I think it should be label_threshold
.
One other question, regarding the placement of the label outside the plot. Is it possible to provide the y value (probably > 1.5) ourselves to place the label closer to the plot? I really want to limit the length of the space between the label (and the subsequent line to the segment). Hope I have explained this well enough.
Hi @showteeth
I wanna customize my labels, not 'count' or 'freq'. How can I do it?
Thanks!!
Hello,
how can I please do label text wrapping in ggrosepie, below the code.
ggrosepie(survey, group_key = "x2_what_size_of_organization_do_you_work_for", count_type = "full", label_info = "all",
show_tick=F,donut_frac=NULL, label_size = 3)
also, how I can customize the legend box title "x2_what_size_of_organization_do_you_work_for"
I have a following count table (data.table obj) ;
p
TCR.clonotype count
<ord> <int>
1: clonotype1 29
2: clonotype2 22
3: clonotype3 19
4: clonotype4 19
5: clonotype5 18
6: clonotype7 16
7: clonotype6 16
8: clonotype9 15
9: clonotype8 14
10: clonotype11 14
11: clonotype12 14
12: clonotype10 13
13: clonotype14 12
14: clonotype13 12
15: clonotype15 12
16: clonotype16 11
17: clonotype17 11
I created a pie chart by following;
ggpie(p,
group_key = "TCR.clonotype",
count_type = "count",
label_info = c("group" , "ratio"),
fill_color = P50[1:17],
label_pos = "out",
label_type = "horizon",
nudge_x = 0.2)
A resulting figure is as follows;
It looks great except that I want a clockwise direction from the largest to the smallest. I could sort p
according to the decreasing order of count
, as follows;
>p.rev<-p[order(-TCR.clonotype)]
> p.rev
TCR.clonotype count
<ord> <int>
1: clonotype17 11
2: clonotype16 11
3: clonotype15 12
4: clonotype13 12
5: clonotype14 12
6: clonotype10 13
7: clonotype12 14
8: clonotype11 14
9: clonotype8 14
10: clonotype9 15
11: clonotype6 16
12: clonotype7 16
13: clonotype5 18
14: clonotype4 19
15: clonotype3 19
16: clonotype2 22
17: clonotype1 29
Labelling flipped but not the pie. In order to get the right pie, I have to a following;
> p.rev[, TCR.clonotype :=fct_rev(TCR.clonotype)]
#checking a reversed factor level
> str(p.rev)
Classes ‘data.table’ and 'data.frame': 17 obs. of 2 variables:
$ TCR.clonotype: Ord.factor w/ 17 levels "clonotype17"<..: 1 2 3 4 5 6 7 8 9 10 ...
$ count : int 11 11 12 12 12 13 14 14 14 15 ...
- attr(*, ".internal.selfref")=<externalptr>
#plotting needs "guide" to reverse an order of the legend
> ggpie(p.rev,
+ group_key = "TCR.clonotype",
+ count_type = "count",
+ label_info = c("group" , "ratio"),
+ fill_color = P50[1:17],
+ label_pos = "out",
+ label_type = "horizon",
+ nudge_x = 0.2)
+ guides(fill=guide_legend(reverse = T))
Could you possible add the easier option to reverse the order of pie slices and corresponding legend ?
Thanks again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.