st2 tas
st2 tas

Reputation: 91

How to plot 'outside' of the a matplotlib plot?

I have values 1 through 5000 along the x-axis and percentage along the y-axis, however, I only want the values from 1-150 to be visible along the x-axis (in order to make the scale more usable), but I'm having trouble figuring out how to do it.

Originally, I was just excluding the data with values over 150, but that obviously doesn't work with percentages.

Upvotes: 0

Views: 46

Answers (1)

Martin Valgur
Martin Valgur

Reputation: 6312

You can achieve this by limiting the range of the x-axis (or y-axis) of the plot: plt.xlim(1, 150) or ax.set_xlim(1, 150).

Upvotes: 1

Related Questions