ggplot(clients, # data I am usingaes(x = program, # x is programfill = program)) +# fill is also programgeom_bar() # use bars
Stacked Bar Chart
Show the code
ggplot(clients, # data I am usingaes(x =1, # x is now 1 for everyonefill = program)) +# fill is programgeom_bar() # use bars
Pie Chart
Show the code
ggplot(clients, # data I am usingaes(x =1, # x is now 1 for everyonefill = program)) +# fill is programgeom_bar() +# use barscoord_polar(theta ="y") +# use polar coordinatestheme_void() # blank theme for pie charts
Two Dimensions of Data (program X gender)
Stacked Bar Chart
Show the code
ggplot(clients, # data I am usingaes(x = program, # x is back to programfill = gender)) +# fill is gendergeom_bar() # use bars
Unstack the Bars
Show the code
ggplot(clients, # data I am usingaes(x = program, # x is back to programfill = gender)) +# fill is gendergeom_bar(position ="dodge2") # unstack ('dodge') the bars
Pie Chart
One approach …
Show the code
# position = position_fill() makes the slices# fill the pie in each facetggplot(clients, # data I am usingaes(x =1, # x is back to 1fill = gender)) +# fill is gendergeom_bar(position =position_fill()) +# use barscoord_polar(theta ="y") +# polar coordinatesfacet_wrap(~program) +# facet wrap on programtheme_void() # blank theme for pie charts