Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Box Plot Embedded in Violin Plot

Raw

ds                                                                    %>%
  mutate(year=factor(format(ds$date, "%Y")))                          %>%
  ggplot(aes(x=year, y=max_temp, fill=year))                           +
  geom_violin()                                                        +
  geom_boxplot(width=.5, position=position_dodge(width=0))             +
  theme(legend.position="none")

Figure 2.11: Caption

\includegraphics[width=\textwidth]{figures/onepager/ggplot2:violin_box_plot-1}

We can overlay the violin plot with a box plot to show the quartiles.

ds                                                                    %>%
  mutate(year=factor(format(ds$date, "%Y")))                          %>%
  ggplot(aes(x=year, y=max_temp, fill=year))                           +
  geom_violin()                                                        +
  geom_boxplot(width=.5, position=position_dodge(width=0))             +
  theme(legend.position="none")


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.