python - Matplotlib colorbar extensions, show values -


I am trying to create a contour so that the user can specify a contour border so that they focus on a certain value Able range Depending on the data, users will be priced outside the specified threshold. I changed this code to clarify my question:

This code plots values ​​from 0 to 2, but I have the contour range 'V' (0.1 to 1.5) So that there will be value outside the contour and I am using the extension (extension = both) to extend the contour so that the value outside the range is shown as color (to ensure that someone White areas are not). I want to display the maximum value (2) and the minimum value (-0.1) on the contour scale on the summation scale so that they also appear on the scale, how can I do this?

There is at least one more way

  NMP import as import matplotlib.pyplot plt xi = np.array ([0, 0.5, 1.0] ) Yi = np.array ([0, 0.5, 1.0]) zi = np.array ([[0, 1.0, 2.0], [0., 1.0, 2.0], [- 0.1, 1.0, 2.0]]) V = np.linspace (0.1, 1.5, 10, and point = true) #set so that the value outside the contour plt.contour (xi, yi, zi, v, linewidths = 0.5, colors = 'k') plt.contourf Xi, yi, zi, v), cmap = plt.cm.jet, extension = 'both') cbar = plt.colorbar (ticks = v, extendrect = 'true') plt.show ()  

see image

What do I need for data minimizing value and data One for maximum price Display on the extension.

I have modified the code for the contour label to include the lowest value, contour level and T of the contour, the maximum number of contour is the minimum and maximum value color bar (the updated image below) Zi.min () is does not appear at -0.1 and zi.max () 2.
I checked y-ticks: print cbar.ax.get_yticks (): Creates values ​​from 0 to 1 print cbar.ax.get_ylim (): values ​​-0.11 and 1.11 (the end of the extension bars) Produces

How do I reveal the minimum and maximum values? Can I use yticks / ylim information?

as nppy import matplotlib.pyplot as import plt xi = np.array ([0, 0.5, 1.0]) yi = np.array ([0, 0.5, 1.0] ) Zi = np.array ([[0, 1.0, 2.0], [0., 1.0, 2.0], [-0.1, 1.0, 2.0]] v = np.linspace (0.1, 1.5, 10, end point = True) #contro levelplat.contour (xi, yi, zi, v, linewidths = 0.5, colors = 'k') plt.contourf (xi, yi, zi, v, cmap = plt cm.jet, extension = 'both 'Cbarticks = np.hstack ([zi.min (), v, zi.max ()] # Contour tick label cbar = plt.colorbar (ticks = cbarticks, extendrect =' true ', extended =' auto ', Difference = 'proportional') print cbar.ax.get_ylim () print cbar.ax.get_yticks () # plt.show ()

  xi = np.array ([0, 0.5, 1.0]) yi = Np.array ([0, 0.5, 1.0]) zi = np.array ([[0, 1.0, 2.0], [0., 1.0, 2.0], [- 0.1, 1.0, 2.0]]) v = np .linspace (0.1, 1.5, 10, endpoint = true) tick = v.flatten () tick = np.interest (tick, [0,10], [- 0.1, 2.0]) cs = pl.T. contourf (xi, Yi, zi, len (tic), semi = plt.cm (jet, level = tick) c = plt. Contour (xi, yi, zi, len (tick), color = 'black', level = tick) plt. Colorbar (cs, shrinkage = 0.5, aspect = 5, tics = tick) plt.show ()  


Comments

Popular posts from this blog

ios - Form Sheet content disappearing -

MySql variables and php -

php - Laravel - Overriding a resource route into a different route filter group -