SourceForge logo
SourceForge logo
Menu

[matplotlib-devel] banded pcolor

From: John H. <jdh...@ac...> - 2003年11月11日 21:51:32
The GTK and wx backends have the same problem with pixel rounding on
pcolor. I just cured it with GTK and I bet you can do the same for
wx. The trick is to floor the positions and ceil the scales. This
will make it much more likely that the left edge of one rectangle will
align with the right edge of another. Eg, for the GTK backend
 def draw_rectangle(self, gc, filled, x, y, width, height):
 """
 Draw a rectangle at lower left x,y with width and height
 If filled=True, fill the rectangle with the gc foreground
 gc is a GraphicsContext instance
 """
 self.gdkDrawable.draw_rectangle(
 gc.gdkGC, filled, int(x), self.height-int(y+height),
 int(math.ceil(width)), int(math.ceil(height)))
This worked great on my test code.
Secondly, I am considering making a minor backend change for drawing
2D solids (arcs, rectangles, polygons) in the Renderer. Rather than
calling the functions twice, once for edge and once for face, I would
like to define them like
 def draw_rectangle(self, gcEdge, x, y, width, height, gcFace=None):
that is, the gcFace takes the place of fill. If None, don't fill,
otherwise fill with the gc in gcFace.
This will avoid 2 function calls per patch (once on the patch.py end
and once in the backend forwarding it to the underlying renderer, and
will enable backends, eg, postscript, to take advantage of a native
fill commands. For PS, this will at least halve the size of pcolor
output files, which are currently obscenely large.
Comments?
JDH

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /