Share the Gallery !Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

Stacked area chart are often use to represent time series. These examples are inspired from the cookbook for R. Check the dataviz catalog to better understand what is a stacked area graph! Let’s build some data for the next examples:

#136_stacked_area_graph_1This is the basic stacked area plot proposed by ggplot2.

#136_stacked_area_graph_2You can easily change the color palette:

#136_stacked_area_graph_3To reverse the stacking order, you have to change the order in the initial data frame

#136_stacked_area_graph_4Thus you can give a specific order, still reordering the dataframe as needed:

#136_stacked_area_graph_5You can also draw a proportional stacked area graph: the sum of each year is always equal to hundred and value of each group is represented through percentages. To make it, you have to calculate these percentages first:

 


Not what you are looking for ? Make a new search !


Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz