phs phs - 1 month ago 21
Python Question

Plot maximum of whats remaining on plot after xlim

I am plotting a contour on matplotlib using the contourf command.
I get huge numbers at the start of frequency, but lower peaks after that.
xlim only works in hiding the higher numbers - but I want the lower peaks to become the maximum on the colorbar (not shown in my images).
How to rescale the contour after the xlim has hidden the unrequired contour? Basically, the light blue (cool) portion of should become the red (hot) area after applying xlim(10,100)
enter image description here enter image description here

Answer

Without providing any code it's hard to give you a code example of what you should do, but I'm assuming you are providing contourplot some 2d numpy array of values that drives the visualization. What I would suggest is then to set the x-limit in that data-structure rather than providing the limit to matplotlib. If Xis your datastructure, then just do plt.contour(X[:10, :]).