From: Jeff W. <js...@fa...> - 2004-12-28 12:23:59
|
How do I suppress drawing a line around the polygon when using fill? I've tried fill(x,y,'gray',linewidth=0), but I still get a little tiny line (which is especially noticeable when using the postscript backend). -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449 325 Broadway Web : http://www.cdc.noaa.gov/~jsw Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124 |
From: John H. <jdh...@ac...> - 2004-12-28 13:25:30
|
>>>>> "Jeff" == Jeff Whitaker <js...@fa...> writes: Jeff> How do I suppress drawing a line around the polygon when Jeff> using fill? I've tried fill(x,y,'gray',linewidth=0), but I Jeff> still get a little tiny line (which is especially noticeable Jeff> when using the postscript backend). Just make the facecolor and edgecolor the same >>> fill(x,y, edgecolor='gray', facecolor='gray) or whatever color you want them to be. You can also use aliases >>> fill(x,y, ec='gray', fc='gray) FYI, the new set/get introspection is designed to help you find these things, by printing property names and the values they accept In [3]: p, = fill(x,y) In [4]: p Out[4]: <matplotlib.patches.Polygon instance at 0x3b5ec60> In [5]: set(p) alpha: float antialiased or aa: [True | False] clip_box: a matplotlib.transform.Bbox instance clip_on: [True | False] edgecolor or ec: any matplotlib color - see help(colors) facecolor or fc: any matplotlib color - see help(colors) figure: a matplotlib.figure.Figure instance fill: [True | False] label: any string linewidth or lw: float lod: [True | False] transform: a matplotlib.transform transformation instance visible: [True | False] zorder: any number Hope this helps, JDH |
From: Alan G I. <ai...@am...> - 2004-12-28 22:33:07
|
>>>>>> "Jeff" == Jeff Whitaker <js...@fa...> writes: > Jeff> How do I suppress drawing a line around the polygon when > Jeff> using fill? I've tried fill(x,y,'gray',linewidth=0), but I > Jeff> still get a little tiny line (which is especially noticeable > Jeff> when using the postscript backend). On Tue, 28 Dec 2004, John Hunter apparently wrote: > Just make the facecolor and edgecolor the same I'll chime in here because I know someone is creating arrows using polygons. I have found that *any* width along the edge is a problem for arrows: they must be *only* filled and not stroked or they look like they point to the wrong point. (Perhaps 0.3 point unscaled would not be a serious problem for many uses, but remember there is a join at the tip!) So: is it possible to fill a polygon without stroking the edge (or to set the edge with to approximate 0)? By way of comment: this was a real problem in gnuplot up to version 3.8. (I've been meaning to check whether it was fixed in 4.0.) The arrows were stroked as well as filled, and they often looked very wrong. fwiw, Alan Isaac |
From: Jeff W. <js...@fa...> - 2004-12-28 23:11:28
|
John Hunter wrote: >>>>>>"Jeff" == Jeff Whitaker <js...@fa...> writes: >>>>>> >>>>>> > > Jeff> How do I suppress drawing a line around the polygon when > Jeff> using fill? I've tried fill(x,y,'gray',linewidth=0), but I > Jeff> still get a little tiny line (which is especially noticeable > Jeff> when using the postscript backend). > >Just make the facecolor and edgecolor the same > > > John: Thanks - I figured that one out myself about 5 minutes after I sent the message. I'm currently working on a map plotting module. I've added the ability to plot filled continents on various map projections, using the GSHHS coastline polygon dataset (http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html). This dataset provides polygon segments that define continental outlines. However, before I post it here I'd like to also provide the capability to fill the 'wet' areas as well. In order to do this I need to figure out how to fill the area between the polygons. Looks like this module (http://www.dezentral.de/soft/Polygon/index.html) would do the trick, but it requires the generaly polygon clipping C library. Do you have any suggestions? Thanks for you help, -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/CDC R/CDC1 Email : Jef...@no... 325 Broadway Web : www.cdc.noaa.gov/~jsw Boulder, CO, USA 80303-3328 Office : Skaggs Research Cntr 1D-124 |
From: John H. <jdh...@ac...> - 2004-12-29 03:44:23
|
>>>>> "Jeff" == Jeff Whitaker <js...@fa...> writes: Jeff> I'm currently working on a map plotting module. I've added Jeff> the ability to plot filled continents on various map Jeff> projections, using the GSHHS coastline polygon dataset Jeff> (http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html). This Jeff> dataset provides polygon segments that define continental Jeff> outlines. However, before I post it here I'd like to also Jeff> provide the capability to fill the 'wet' areas as well. In Jeff> order to do this I need to figure out how to fill the area Jeff> between the polygons. Looks like this module Jeff> (http://www.dezentral.de/soft/Polygon/index.html) would do Jeff> the trick, but it requires the generaly polygon clipping C Jeff> library. Do you have any suggestions? agg actually includes a wrapper for gpc, as well as the gpc code itself, but gpc is GPLd and I haven't included it in matplotlib for that reason. Agg separately implements a "scanline boolean algebra" which I haven't studied in detail but which I understand basically does the same thing: allow clipping to arbitrary polygons, and supports boolean operations on polygons -- http://www.antigrain.com/demo/index.html#PAGE_DEMO_scanline_boolean We have to expose the functionality such that it is available for use by other backends, much as we use agg for image across backends. If this is an area that you want to dive into, by all means. Otherwise, it's on the list of things to do (I just added it to the goals page in my tree, so it will appear on the site docs in the not-too-distant-future. JDH |