Hi,
I am right now using matplotlib to plot some of my simulation results into contour graphs. My problems is:
I have several simulation run results (three sets of results from three simulation runs). I plotted the results into contours graphs. Now I want to have the same colorbar scale for all three contours. For example, the first graph data ranges from 0 to 3, second from 0 to 5, and third is 0 to 9. I want to fix the colorbar for each graph from 0 to 9 (instead of different scales for each graph as is the default), and change the contour plot accordingly. How can I do that? Many many thanks!!!
Here is the part of my code for plotting:
I am right now using matplotlib to plot some of my simulation results into contour graphs. My problems is:
I have several simulation run results (three sets of results from three simulation runs). I plotted the results into contours graphs. Now I want to have the same colorbar scale for all three contours. For example, the first graph data ranges from 0 to 3, second from 0 to 5, and third is 0 to 9. I want to fix the colorbar for each graph from 0 to 9 (instead of different scales for each graph as is the default), and change the contour plot accordingly. How can I do that? Many many thanks!!!
Here is the part of my code for plotting:
Code:
fig = plt.figure(figsize=(15, 5))
fig.subplots_adjust(top=0.85)
fig.add_subplot(121,title='Packet loss')
CS1 = plt.contourf(topo,100, cmap=my_cm)
# topo is an array with data inside
CS1.set_clim(CS1.cvalues[0], CS1.cvalues[-2])
CB1 = plt.colorbar(CS1)
CB1.ax.set_ylabel('[%]')
plt.yticks(range(sqr_node))
plt.xticks(range(sqr_node))
plt.show()
Comment