r - How can I use facet_wrap using pie charts? -
seasons frequency1 frequency2 djf 497 500 jja 999 700 mam 695 2000 son 245 1000 hi, making multiple pie charts using dataframe (one using frequency1, using frequency2). know how use melt , facet_wrap(~id). here have pool data (don't know how express it). don't want facet_wrap seasons.
how can melt data in way can make 2 pie charts side side. have made 1 using frequency1.

thanks!
if want melt , use facets, then:
library(reshape2) molten_df <- melt(your_df, id.var='seasons') now molten_df have column called 'variable' can use facets:
+facet_grid(facets=.~variable) however, if want 2 charts side side, can arrange them. find gridextra package handy this:
library(gridextra) # load grid package. install these if needed. # creating charts plot1 <- ... #your code here plot2 <- ... #your code here # side side grid.arrange (plot1, plot2, ncol=2)
Comments
Post a Comment