plotting graphs with flipped y axes

25 views
Skip to first unread message

David Bremner

unread,
May 3, 2020, 1:31:06 PM5/3/20
to Racket Users

Does anyone know how to achieve plots like the attached with racket's
plot module? I'm stuck trying to invert the y axis. I'd like the smaller
y values to be at the top of the plot.

wt8.pdf

Alex Harsanyi

unread,
May 3, 2020, 8:39:41 PM5/3/20
to Racket Users
I am not aware of any plot parameter which would allow flipping the axis, but you can transform the data to be flipped and use an axis transform for the axis itself.  I wrote a blog post which is somewhat related: https://alex-hhh.github.io/2020/02/dual-axis-plots.html, the post covers plotting a second data series which has a different scale than the first. The same technique of making "guest" transforms can be used to flip an axis: you would call
(make-guest-transform base-min base-max base-max base-min) to obtain the "flip" transform and only plot the "guest" which would be flipped.

Hope this helps,
Alex.



Reply all
Reply to author
Forward
0 new messages