Professional Documents
Culture Documents
5 Ways To Enhance Your GGPLOT Visualizations
5 Ways To Enhance Your GGPLOT Visualizations
Get unlimited access to the best of Medium for less than $1/week. Become a member
13
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 1 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
Using Themes
One way to improve your ggplot visualizations is by leveraging themes.
Themes provide a consistent and professional appearance to your plots by
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 2 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
Themes are added to a plot by adding the theme at the end of your plot
code. p + theme_minimal() . If there other custom theme elements that you
want to add you should do that after calling the theme function.
ggplot themes
GGPLOT comes with a built-in set of themes. Below are some of the ones
that I like the most. You can see how using them improves the look of the
plot without doing much.
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 3 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
ggthemes
Theme packages like ggthemes can help you easily recreate popular
charting styles.
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 4 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
tvthemes
Tvthemes is a fun package that uses a the colors from popular tv shows to
syle your charts.
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 5 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
Using themes is an easy way to quickly improve the look and feel of your
charts. You can also develop your own themes by creating a function that
defines the theme elements you need.
library(ggplot2)
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 6 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
print(p)
Color Selection
Colors play a vital role in data visualization, as they can convey meaning,
highlight patterns, and differentiate between data points. When choosing
colors for your ggplot visualizations, consider the nature of your data and
the message you want to convey. You should avoid using colors that are too
similar or clash with each other, as this can lead to confusion. Instead, opt
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 7 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
for color palettes that are visually pleasing and effectively represent your
data.
Using the teamcolors package, I am easily able to add the NBA team primary
color to the chart with only a single extra line to my chart. By looking at the
two charts below you can see how using the NBA colors makes it easier for
the viewer to get meaning from the data. The legend is less important
because you can get a general sense of what the team is by the color of the
point.
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 8 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
2. viridis: Offers color maps that are perceptually uniform and suitable for
both colorblind individuals and printing in black and white.
10. ggthemes: Offers color palettes and themes inspired by popular data
visualization libraries and software, such as Excel, Tableau, and Stata.
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 9 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
I like to use this when I am looking at a very large dataset or the data are
highly concentrated. By showing all the points in a plot, you are able to
really demonstrate the distributions and see any irregularities in the data.
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 10 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 11 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 12 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
By incorporating these tips into your ggplot visualizations, you can take
your data analysis to the next level. Whether you’re enhancing the
appearance, selecting appropriate colors, adding jitter to point-based plots,
freeing the axes when faceting, or iterating and refining, these strategies
will help you create visualizations that are both aesthetically pleasing and
informative. With practice and exploration, you’ll become proficient in
creating impactful ggplot visualizations that effectively communicate your
data insights.
If you are using RStudio, check out this addon package that lets you edit the
theme of your plot with a GUI interface.
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 13 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
78 Followers
25 1 8
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 14 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
84 34
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 15 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
ChatGPT Cheat Sheet for Data 20% of EDA Plots Data Scientists
Science with R Use 80% of the Time
Data science is a field that combines domain All the plots you need to know for EDA
expertise, programming skills, and…
knowledge of mathematics and statistics to
2 min read · Dec 10, 2023
extract… 5 min read · Dec 22, 2023
674 2
Lists
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 16 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
343 2 424 4
21 12 1
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 17 of 18
5 Ways to Enhance Your GGPLOT Visualizations | by Dan Larson | Medium 3/01/24, 09:13
Help Status About Careers Blog Privacy Terms Text to speech Teams
https://medium.com/@danlarson_74954/5-ways-to-enhance-your-ggplot-visualizations-7ecb044fa9d9 Page 18 of 18