Finally had some time to play with this in detail. First, it's very cool, and thanks for doing all this work. I noticed a few things:

The path-clipping approach that simply removes negative-valued vertices doesn't always work, particularly if a line segment begins in the negative and ends up in the visible part of the plot, the entire line segment will disappear. Instead, it would make more sense to make use of the clipping algorithm already in matplotlib (and implemented in fast C++) that will actually splice the line segments at the boundary. I've attached a patch for this.

The display at the bottom that says "Cursor at: X, Y" is in pixels, not in data units. It would be great if this could display data units, though being general enough to support custom scales (eg. log) and projections (eg. polar) may be tricky without making a round-trip to the server.

If I resize the plotting area (using either the "+" or "arrows" icon), the area where the mouse cursor can draw a zooming rectangle does not seem to be updated.

Minor point: I seem to get a traceback when "text.usetex" is True.

Thinking more broadly -- how difficult would it be to just use the plotting area part of the display, and not the plot selection and layout buttons along the top? I think a really great use case of this backend would be to embed plots in a web page, and have an interactive plot inline in the document. In that case, the extra layout features may be unnecessary. Also, (and I'm getting a bit out of my depth here as I haven't done a lot of web development), how hard would it be to integrate this inside of a WSGI-based webapp, perhaps a Django app? The standalone server this is nice for demos, but I can see this becoming very useful as part of a larger web application.

Mike

On 06/21/2010 09:19 AM, Simon Ratcliffe wrote:
Hello,

Our HTML5 based matplotlib backend is now available at:

http://code.google.com/p/mplh5canvas/

There are some basic installation instructions and included examples
to get going. Keep in mind that the weakest link at this stage is
browser support.

We recommend Chrome for the most hassle free experience.

This is very much a beta release and has not seen action outside of
our internal testing, so we expect some teething troubles :)

Please let us know what works for you, and what doesn't, and we will
try and fix things as they come up.

Cheers,

Simon and Ludwig

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

Index: mplh5canvas/backend_h5canvas.py
===================================================================
--- mplh5canvas/backend_h5canvas.py     (revision 7)
+++ mplh5canvas/backend_h5canvas.py     (working copy)
@@ -247,9 +247,6 @@
             # This happens because HTML Canvas defines (0, 0) as the *top left* of a pixel instead of the center,
             # which causes all integer-valued coordinates to fall exactly between pixels
             points += 0.5
-            # Ignore directives with negative coordinates (sanity check that gets rid of some drawing artifacts)
-            if (points < 0).any():
-                continue
             if code == Path.MOVETO:
                 ctx.moveTo(points[0], points[1])
                 current_point = (points[0], points[1])
@@ -298,7 +295,11 @@
             self._do_path_clip(ctx, clip)
             self._last_clip = clip
         if clip is None and clippath is None and (self._last_clip is not None or self._last_clip_path is not None): self._reset_clip()
-        self._path_to_h5(ctx, path, transform, None, dashes=gc.get_dashes())
+        if rgbFace is None and gc.get_hatch() is None:
+            figure_clip = (0, 0, self.width, self.height)
+        else:
+            figure_clip = None
+        self._path_to_h5(ctx, path, transform, figure_clip, dashes=gc.get_dashes())
         if rgbFace is not None:
             ctx.fill()
             ctx.fillStyle = '#000000'
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to