KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am plotting a PatchCollection in matplotlib with coords and patch color values read in from a file. The problem is that matplotlib seems to automatically scale the color range to the min/max of the data values. How can I manually set the color range? E.g. if my data range is 10-30, but I want to scale this to a color range of 5-50 (e.g. to compare to another plot), how can I do this? My plotting commands look much the same as in the api example code: patch_collection.py colors = 100 * pylab.rand(len(patches)) p = PatchCollection(patches, cmap=matplotlib.cm.jet, alpha=0.4) p.set_array(pylab.array(colors)) ax.add_collection(p) pylab.colorbar(p) pylab.show()
Tags (comma-separated)
Save Edits
Cancel