From: James B. <bo...@ll...> - 2005-01-12 20:56:04
|
I have a mesh of irregular polygons, like a finite element mesh. Each polygon has an associated value. So, I have defined a color map with a appropriate normalization to define a color for each value and then built a collection consisting of the polygon vertices and colors. The resulting plot looks pretty good. This technique would seem to be useful for FE grids and Delaunay triangles. Two questions: (1) I want to attach a colorbar to the figure, but as of yet I have not worked out how to do it. images such as scatter, imshow, pcolor are mappable and will accept a color bar but my simple polygon fill will not. (2) How do I eliminate the edge lines about each polygon? I can make them very thin but a width of zero does not appear to work. I recall this being discussed on the list, but now I cannot find the reference. Thanks for any help. --Jim |
From: Alan G I. <ai...@am...> - 2005-01-13 00:57:19
|
On Wed, 12 Jan 2005, James Boyle apparently wrote: > (2) How do I eliminate the edge lines about each polygon? I can make > them very thin but a width of zero does not appear to work. > I recall this being discussed on the list, but now I cannot find the > reference. I recall John suggesting to also set the edge color (to the same color, of course). I hope a true zero width will implemented. However note that interpreting a linewidth of zero as a 1 pixel wide line is what PostScript does. So the only way to get a true zero width for PostScript output is to fill the polygon without stroking it. hth, Alan Isaac |
From: James B. <bo...@ll...> - 2005-01-13 17:53:46
|
To reply to my own post: On question (1): I modified the call to colorbar in pylab.py to accept a color map and norm keyword arguments. It was this functionality that was needed from the mappable image. So if the keywords are provided colorbar uses them, otherwise it looks for a mappable image. This modification disables the observer feature for now if the color map is a keyword, a bit more work should get this going. It looks like it would be easily doable, but I need something for the exigencies of work and will get back to this later. This also would allow for a colorbar key for coloring contours and vectors. I would also like to code up a floating color bar. Often I make 4/5 images per page with a common colormap and normalization. It is handy just to plop the reference colorbar in a central location not attached to a particular figure. On question (2): Alan Isaac pointed out that using the same edgecolor as the fillcolor would make the borders invisible. --Jim On Jan 12, 2005, at 12:55 PM, James Boyle wrote: > I have a mesh of irregular polygons, like a finite element mesh. Each > polygon has an associated value. > So, I have defined a color map with a appropriate normalization to > define a color for each value and then > built a collection consisting of the polygon vertices and colors. > The resulting plot looks pretty good. This technique would seem to be > useful for FE grids and Delaunay triangles. > > Two questions: > (1) I want to attach a colorbar to the figure, but as of yet I have > not worked out how to do it. > images such as scatter, imshow, pcolor are mappable and will accept a > color bar but my simple polygon fill will not. > > (2) How do I eliminate the edge lines about each polygon? I can make > them very thin but a width of zero does not appear to work. > I recall this being discussed on the list, but now I cannot find the > reference. > > Thanks for any help. > > --Jim > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: John H. <jdh...@ac...> - 2005-01-15 22:59:32
|
>>>>> "James" == James Boyle <bo...@ll...> writes: James> To reply to my own post: On question (1): I modified the James> call to colorbar in pylab.py to accept a color map and norm James> keyword arguments. It was this functionality that was Perhaps it would be cleaner simply to derive a custom class from ScalarMappable that does your fill calls and stores your cmap and norm instances; then you would get the observer stuff for free. If you decide to go this route, perhaps you could submit the example. James> I would also like to code up a floating color bar. Often I James> make 4/5 images per page with a common colormap and James> normalization. It is handy just to plop the reference James> colorbar in a central location not attached to a particular James> figure. I just committed changes to CVS to support this -- you can now place a colorbar in a custom axes, and I added an orientation kwarg to support horizontal or vertical colorbar layout. Make sure you get pylab.py revision 1.21 or later. Here is an example from pylab import * ax = axes([0.1, 0.3, 0.8, 0.6]) im = imshow(rand(12,12), interpolation='nearest') cax = axes([0.1, 0.1, 0.8, 0.15]) colorbar(cax=cax, orientation='horizontal') show() James> On question (2): Alan Isaac pointed out that using the same James> edgecolor as the fillcolor would make the borders James> invisible. Yep. JDH |