Stream: python-questions

Topic: Plotting Merra2 Data


view this post on Zulip Brendan Myers (Apr 27 2022 at 16:56):

Hello everyone! This feels like it should be a simple thing to fix but I can't get it to work for some reason so I figure maybe another set of eyes on my code could help. I'm just trying to adjust my y-axis to stop at 200mb and I feel like line 26 should take care of this but no matter what I set the upper limit of the y-axis to, it won't get smaller than 100mb... Thoughts?
image.png
image.png

view this post on Zulip Katie Dagon (Apr 27 2022 at 18:10):

@Brendan Myers I think it is because the ax.set_yticklabels and ax.set_yticks arguments use an np.arange that goes from 1000 to 100, so it might be overriding the set_ylim argument. Try changing the np.arange to (1000,100,-100) and see if that works.

view this post on Zulip Ryan May (Apr 27 2022 at 19:56):

Try changing line 26 to ax.set_ylim(cross['lev'].max(), 200). set_ylim() takes two arguments for min and max, not a list. Also, you can pass None if you don't care about one of them, like ax.set_ylim(None, 200).

view this post on Zulip Brendan Myers (Apr 27 2022 at 21:10):

@Katie Dagon & @Ryan May those did the trick! Thank you both so much!


Last updated: May 16 2025 at 17:14 UTC