Coder Social home page Coder Social logo

ggpie's People

Contributors

showteeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ggpie's Issues

label info to include legend

@showteeth,

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.

Change border thickness

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

Error on "count column is missing in your data"

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 numbertocount? 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.

Fix and request

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.

label text wrap in ggrosepie

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"

000054

Adding options for easy pie label order

@showteeth,

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;

Rplot01

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

I get a following pie;
Rplot

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))

Rplot02

Could you possible add the easier option to reverse the order of pie slices and corresponding legend ?

Thanks again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.