From: Eric F. <ef...@ha...> - 2012-04-09 17:27:08
|
On 04/09/2012 02:22 AM, Mathew Topper wrote: > Dear matplotlib-users, > > I have a spatial data set that has coded values for each cell, which are > limited to just a few numbers, ie -8888, 0, 100, and 9999. I would like > to display this data with a plot similar to pcolor, but I don't want a > colorbar, I want a legend showing the colors for each code and an > explanation for what each code represents. I would like to be able to > choose a subset of the codes as well, for example just plotting the 0 > and 100 codes and ignoring the -8888 and 9999 codes. > > I have seen a few similar attempts that used BoundaryNorm, but I don't > want to show a range of values I just want to set colors for a few > explicit values. Those examples also had a colorbar and, as I said, I > would prefer a legend. > > Can anyone offer any tips? For the plot itself you can use pcolor if your data are on a quadrilateral grid, or a PathCollection or PolyCollection otherwise. For the legend, you can use proxy artists: http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist Eric > > Thanks > > Mat > |