0

Okay, similar questions have been asked, but I haven't found what I am looking for.... Completely new to R so please be gentle. Looking for sth like this (How can I plot with 2 different y-axes?), but in ggplot because I just think it looks way nicer and that's, after all, the reason I use R.

So for a basic biochemical experiment (HPLC of Peptides), I increase the concentration of Acetonitrile over time, while measuring the absorption of my sample. I would like both curves in one ggplot, with two different y labels:

  • Two lines in different colors ( % Acetonitrile vs Time, Absorption vs Time)
  • Two y-axes, one left, one right, different scales, different labels
  • One x-axis

The information of the plot should be the time at which an absorption peak occurs and the corresponding concentration of Acetonitrile at that time point.

Thanks in advance!

Community
  • 1
  • 1
Fridolin
  • 9
  • 2
  • Take a look here https://rpubs.com/kohske/dual_axis_in_ggplot2 – adaien Mar 28 '16 at 23:48
  • The linked "solution" by kohske is likely as "easy" as you're going to get. The question you linked to contained a reference to a [ggplot2 specific](http://stackoverflow.com/q/3099219/324364). discussion of this that outlines why dual y axes are essentially impossible in ggplot2 without significant tinkering at the grid level. – joran Mar 29 '16 at 01:03

0 Answers0