編集:これはあなたの問題の解決策ではないことを認識しています. ただし、あなたのコードは私の解決に役立ちました。したがって、これをファセットに膨らませる方法を検討します。データも含める必要があります。
I have a solution for this problem.
I've been working on depth profiles for a class. I've found that you can mess up super bad if you are not careful. I've narrowed this down to one graphic for the sake of my example. I will also include my dataframe.
Dataframe
date station depth abs conc
1 9/28/2019 S4.5 0 0.049 36.69231
2 9/28/2019 S4.5 10 0.049 36.69231
3 9/28/2019 S4.5 20 0.054 40.53846
4 9/28/2019 S4.5 30 0.054 40.53846
5 9/28/2019 S4.5 40 0.056 42.07692
6 9/28/2019 S4.5 50 0.062 46.69231
7 9/28/2019 S4.5 75 0.065 49.00000
8 9/28/2019 S4.5 100 0.085 64.38462
9 9/28/2019 S4.5 125 0.094 71.30769
10 9/28/2019 S4.5 150 0.089 67.46154
Please note the headings "date","station","depth","abs","conc"
#treat conc as a function of depth and then reverse later
ggplot(data,aes(x=depth,y=conc))+
#set up the asthetics, the line must be broken because this is technically discrete data
geom_line(color="red",size=1, linetype=2)+
geom_point()+
#reverse depth so it starts at zero
scale_x_reverse()+
#put the y axis labes on the opposite side so when its flipped it will appear at top
scale_y_continuous(position="right")+
#this is how you reverse the look and order or the coordinates for the graph
coord_flip()
I found that by simply reversing the y scale you have have behaviour that transforms how the data is projected if you are doing other transformations.
Some additions that are required according to my class is having the value at the top start at 0. To do this you will need to set a limit for the "x" axis. This is done by adding arguments to coordinate flip.
...
#The order of the y lim matters! the vector must be ordered first value last value
coord_flip(ylim = c(<yourfirstvalue>,<yourlastvalue>))
...
As far as I can tell other transformations do not project the data in a way that makes sense to my markers. If others have a better description of a solution to this problem please feel free to correct me.