3
$\begingroup$

I need to produce a plot that looks something like this:

enter image description here

from a function definition where z (the vertical axis) is the independent variable. I can easily invert the function, so making the vertical axis the dependent variable is easy. But I can't find a way to orient the system as it is in the picture, with x values increasing from left to right, and y values from top to bottom, with the axes as shown. I've found several related questions on this site, but nothing that specifically addresses this issue, nor can I find a Plot option that solves my problem.

$\endgroup$

2 Answers 2

4
$\begingroup$
LogLinearPlot[Exp[x], {x, .1, 100},
 Epilog -> {
   Lighter@Blue, Line[{{-3, -15.0}, {Log@100, 0}}], 
      Text[Style["Lake 1", Lighter@Blue], {0.5, -10}],
   Darker@Red, Line[{{-3, -22.5}, {Log@100, 0}}], 
      Text[Style["Lake 2", Darker@Red], {0.5, -15}],
   Darker@Green, Line[{{-3, -30.0}, {Log@100, 0}}], 
      Text[Style["Lake 3", Darker@Green], {0.5, -20}]
   },
 AspectRatio -> 1,
 AxesLabel -> {100*l[z]/l[0], z},
 ImageSize -> 400,
 PlotRange -> {{0, 100}, {-30, 0}},
 Ticks -> {Automatic, Map[{-#, #} &, Range[0, 30, 5]]}]

enter image description here

$\endgroup$
1
  • $\begingroup$ So the trick (which I should have seen) is to make the vertical axis actually the negative of what you want and just relabel it. Cute. $\endgroup$
    – rogerl
    Commented Dec 22, 2015 at 21:04
6
$\begingroup$

you need to work with Frame and FrameTicks, something like this:

LogLinearPlot[30 - 30 Exp[-x], {x, .1, 100}, 
 Frame -> {{True, False}, {False, True}},
 PlotRange -> {{.1, 100}, {0, 30}},
 FrameTicks -> {{Table[{i, 30 - i}, {i, 0, 30, 5}], None},
   {None, {.1, 1, 10, 100}}},
 Epilog -> Table[Line[{{Log[.1], 30 - s},
     {Log[100], 30}}], {s, {15, 22, 30}}]]

note plot thinks the vertical axis goes from 0 at the bottom to 30 at the top, so we fix the ticks to {{0, 30}, {5, 25}, {10, 20},... and also transform the function as 30-f[x]. Quit a bit of fiddling required but unfortunately i don't think there is a more direct way.

enter image description here

$\endgroup$
3
  • $\begingroup$ OP also wants the y-axis flipped. $\endgroup$
    – march
    Commented Dec 22, 2015 at 16:51
  • $\begingroup$ see edit.. .... $\endgroup$
    – george2079
    Commented Dec 22, 2015 at 16:59
  • $\begingroup$ Seems like a pretty common request; I'm surprised there's no easier way. But this works great. Thanks. $\endgroup$
    – rogerl
    Commented Dec 22, 2015 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.