Img2 = pyplot.imshow(zvals,interpolation='nearest', If you want a gradient and not a discrete color map, make a color map by linearly interpolating through a series of colors: fig = pyplot.figure(2)Ĭmap2 = _list('my_colormap', The alternative is to set origin="lower", so that first point is plotted in the lower left corner. The default is 'upper left', which is why in my posted plot the y axis has 0 in the upper left and 99 (not shown) in the lower left. You should note, that imshow accepts the origin keyword, which sets the where the first point is assigned. It explains that the number of boundaries need to be one larger then then number of colors. The details for the color bar setup were taken from a matplotlib example: colorbar_only.py. Img = pyplot.imshow(zvals,interpolation='nearest', # tell imshow about color map so that only set colors are used # make values from -5 to 5, for this exampleĬmap = () Matplotlib has the imshow method for plotting arrays: import matplotlib as mpl
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |