This post describes how to build a dual Y axis chart using R and ggplot2.It uses the sec.axis attribute to add the second Y axis. Note that this kind of chart has major drawbacks.
Ideally, the graph should look aesthetically pleasing (hence the use of ggplot2!) yet similar in form to the line graphs shown below. I don't understand how to plot multiple lines onto a single graph using the gggplot2 library. My current knowledge of / skill with the ggplot2 library is low but I have included my fledgling efforts below.
The %>% operator can also be used to pipe the dplyr output into ggplot. This creates a unified exploratory data analysis (EDA) pipeline that is easily customizable. This method is faster than doing the aggregations internally in ggplot and has the added benefit of avoiding unnecessary intermediate variables. library (dplyr) library (ggplot
title to use in legend/axis labels to use in legend/axis breaks to use in legend/axis range of values to include in mapping GENERAL PURPOSE SCALES Use with most aesthetics scale_*_continuous() - map cont’ values to visual ones scale_*_discrete() - map discrete values to visual ones scale_*_identity() - use data values as visual ones
. 351 833 765 531 859 433 788 664