Re: [Matplotlib-users] Happy Valentine's Day

2014-02-15 Thread Jason Grout
On 2/14/14 4:13 PM, Benjamin Root wrote:
> I rolled a 20 today for necromancer, so I am going to do a thread
> resurrection.  Given recent improvements in matplotlib, we should
> definitely make this web-enabled. That way, we can share our nerdiness
> with our non-nerdy significant others.

Here's one try, with the experimental CommFigure IPython comm-based 
matplotlib backend I tweaked a few months ago:

http://sagecell.sagemath.org/?q=vcycko

(it responds to mouse motion, so move your mouse around.  Change the 
duration line at the top to change how fast the heart beats.)

Thanks,

Jason


--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] indicating directions on stereographic projection.

2013-11-06 Thread Jason Grout
On 11/6/13 1:10 PM, Paul Hobson wrote:
> I am **very far** from a GIS expert, but I believe that the cardinal
> directions are ambiguous at the poles. In other words, if you're
> standing on the North Pole, it'd difficult to head in any direction
> that's not towards the south pole.
>
> Curious to hear if I'm wrong, though.

I'm sure I'm even farther from being a GIS expert (and probably farther 
from one as well :), but I think you raise an interesting point.  My 
compass would give me directions at the geographic north pole, given 
that the magnetic north pole is different from the geographic north 
pole.  I'm curious how valid it would be to use magnetic north to assign 
directions at the geographic north pole.  My guess is not very valid, 
but kind of cool nonetheless.

Jason


--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Reports from SciPy 2013

2013-07-02 Thread Jason Grout
On 7/1/13 9:33 AM, Michael Droettboom wrote:
> SciPy 2013 was a great success.  I didn't get good headcount at the
> matplotlib BOF, but it was a good number, and we had 15 participants at
> various points during the sprints.  It was nice to see the diversity of
> experience with matplotlib at the sprints, and I hope we oldtimers were
> helpful to the newtimers getting started so they can continue to
> contribute in the future.  It was also great to put some faces to many
> of the talented names I've been seeing on github and the mailing list
> lately.
>

On a slightly different, but related topic: is there any chance the 
entries (or at least the winning entries) to the plotting contest could 
be posted online?

Thanks,

Jason


--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3d performance question

2012-12-18 Thread Jason Grout
On 12/18/12 6:53 AM, Sturla Molden wrote:
> Interactive 2D plots can be sluggish too, if you have enough objects in
> them. It is not the backend that is sluggish. Replacing the backend does
> not speed up the frontend.
>
> OpenGL is only 'fast' if you have a frontend that exploits it (e.g. uses
> vertex buffers and vertex shaders). If you just use OpenGL for
> bitblitting an image or drawing vertices individually (glVertex*), it is
> not going to help at all.
>
> My impression is that whenever Matplotlib is 'too slow', I have to go
> down to the iron and use OpenGL directly. It tends to happen when there
> are too many objects to draw, and the drawing has to happen in 'real-time'.
>
> Observe that if we let OpenGL render to a frame buffer, we can copy its
> content into a Matplotlib canvas. Unless we are doing some really heavy
> real-time graphics, displaying the image is not going to be the speed
> limiting factor. Even though using OpenGL to swap framebuffers will be
> 'faster', you will not be able to tell the difference in an interactive
> Matplotlib plotting.

I'm curious: how come Chaco is so much faster for real-time plots?  What 
are the main technical differences to enable it to plot things much more 
quickly?

Thanks,

Jason


--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] IPython receives $1.15 million from Alfred P. Sloan Foundation

2012-12-12 Thread Jason Grout
Hi everyone,

Just FYI, IPython just received $1.15 million in funding from the Alfred 
P. Sloan Foundation to support development over the next 2 years. 
Fernando talks more about this in his post to the IPython mailing list:

http://mail.scipy.org/pipermail/ipython-dev/2012-December/010799.html

It's great to see a significant open-source python project that many of 
us use on a day-to-day basis get such great funding!

Thanks,

Jason

--
Jason Grout


--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting time series of bits

2012-12-06 Thread Jason Grout
On 12/5/12 8:36 PM, Dale Lukas Peterson wrote:
> I have a time series of 32-bit unsigned integers in the form of a
> numpy array with dtype=numpy.uint32.  The bits of each integer in
> array correspond to various boolean states collected during an
> experiment.  I would like to make a plot this data in the following
> way:
> 1)  time on the horizontal axis (I have a time array of the same
> length as my integer array)
> 2)  bit position N on the vertical axis (0-1 corresponds to bit 0, 1-2
> corresponds to bit 1, etc.)
> 3)  a solid filled rectangle from (t1, N) to (t1+dt, N+1) whenever the
> bit is high.
>
> I been able to use the bitwise_and() and right_shift() on the data to
> get individual arrays which are populated with only 0's and1's.
>
> What I'm not clear on is now how to get the solid filled rectangle for
> areas where the bit is high and nothing when the bit is low.
>
> Is there already this functionality somewhere in matplotlib?  I looked
> in the gallery and couldn't find anything quite like what I'm looking
> for, though I may have simply missed it.  If there isn't, I'm sure
> there is a way to do it, does anybody have any recommendations as to
> the path of least resistance?

Just FYI, this reminds me a lot of the recent EventRaster discussion:

http://thread.gmane.org/gmane.comp.python.matplotlib.devel/11458/focus=11655

Thanks,

Jason



--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colormap shift

2012-11-05 Thread Jason Grout
On 11/5/12 3:50 PM, klo uo wrote:
> You can see there how to use Gimp and create mpl colormap and then later
> there is nifty code that will allow you to shift colormaps with a slider

Nice!  I couldn't resist doing a Sage interact version of the slider thing:

http://aleph.sagemath.org/?q=89b0c945-2ce3-4645-bf61-dbe0eed2c5cd&lang=sage


Thanks,

Jason

--
Jason Grout


--
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting a circle while also changing the limits of the axes

2012-11-05 Thread Jason Grout
On 11/5/12 3:19 PM, Benjamin Root wrote:
>
>
> On Mon, Nov 5, 2012 at 3:51 PM, Brad Malone  > wrote:
>
> Hello,
>
> I am trying to plot some small circles in my plotting window, in
> addition to the curves I'm already plotting. If I don't want to set
> my x- and y- axis scales equal to each other, a naive drawing of a
> circle results in an ellipse.  To fix this problem I found some nice
> example code online here :
> 
> http://stackoverflow.com/questions/9230389/why-is-matplotlib-plotting-my-circles-as-ovals,
> which solves the problem by basically plotting an ellipse, but an
> ellipse which will look like a circle in the display window.
>
> That works all fine for me, but then, if I change my xlim or ylim
> using ax1.set_xlim((something1,something2)) then the solution no
> longer works, and I get an ellipse.
>
> A minimal example showing the breaking behavior can be seen below.
>
>
> I am probably gonna reply to that stackoverflow question with a better
> response...
>
> Essentially, you want a similar behavior to the markers in the scatter
> plots, right?  As you zoom or resize the plot, the circle markers stay
> as circles and have the same size relative to the size of the figure.
> If that is what you want, the way to do that is very easy.
>
> ax1.scatter([0.5], [0.5], s=30)
>
> Or whatever size you want (units of points).

I think the units are points^2, i.e., area of the circle...

Thanks,

Jason


--
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] XKCD style graphs?

2012-10-05 Thread Jason Grout
On 10/4/12 2:16 AM, Fernando Perez wrote:
> This would make for an awesome couple of examples for the gallery, the
> mathematica solutions look really pretty cool:
>
> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs
>
> The matlab and R version not quite so much, still for reference:
>
> http://stackoverflow.com/questions/12701841/xkcd-style-graphs-in-matlab
> http://stackoverflow.com/questions/12675147/xkcd-style-graphs-in-r

Just FYI, wolfram now has a blog post up about it: 
http://blog.wolfram.com/2012/10/05/automating-xkcd-diagrams-transforming-serious-to-funny/

Thanks,

Jason



--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] XKCD style graphs?

2012-10-04 Thread Jason Grout
On 10/4/12 9:11 AM, Michael Droettboom wrote:
> Yes -- this would be a great application for the path filtering
> infrastructure that matplotlib has.


Is that the same as the path effects features, like 
http://matplotlib.org/examples/pylab_examples/patheffect_demo.html ?

Thanks,

Jason


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] XKCD style graphs?

2012-10-04 Thread Jason Grout
On 10/4/12 4:02 AM, Pierre Haessig wrote:
> Hi Fernando,
>
> Le 04/10/2012 09:16, Fernando Perez a écrit :
>> This would make for an awesome couple of examples for the gallery, the
>> mathematica solutions look really pretty cool:
>>
>> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs
> I've never used Mathematica so that it's pretty difficult for me to
> understand the following lines of code which I guess do the main job of
> distorting the image
>
> xkcdDistort[p_] := Module[{r, ix, iy},
> r = ImagePad[Rasterize@p, 10, Padding -> White];
> {ix, iy} =
>  Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~
>GaussianMatrix[10], {2}];
> ImagePad[ImageTransformation[r,
>   # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange ->
> Full], -5]];
>
>
> Is there somebody there that can describe this algorithm with words
> (English or Python ;-)) ?

f@r means f(r)

a~ImageConvolve~b means ImageConvolve(a,b)  (~ treats an operator as infix)

Table[..., {2}] means [... for i in range(2)]

#+1& is a lambda function lambda x: x+1

So I think it goes something like:

def xkcdDistort(p):
 r = ImagePad(Rasterize(p), 10, Padding='White')
 (ix, iy) = [ImageConvolve(RandomImage([-1,1], ImageDimensions(r)),
   GaussianMatrix(10))
 for i in range(2)]
 return ImagePad(ImageTransformation(r,
 lambda coord: (coord[0]+15*ImageValue(ix, coord),
coord[1]+15*ImageValue(iy, coord)),
  DataRange='Full'),
   -5)


Thanks,

Jason


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] who (F/OSS science) uses matplotlib?

2012-06-05 Thread Jason Grout
On 6/3/12 6:41 PM, Kevin Hunter wrote:
> I'm especially interested in open source/science/  projects that use
> matplotlib.

Sage (sagemath.org) uses matplotlib for nearly all its 2d graphics.

Jason


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] FancyArrowPatch -|> style doesn't have solid arrowhead when linestyle='dashed'

2012-04-17 Thread Jason Grout
On 4/15/12 10:12 AM, Jae-Joon Lee wrote:
> Unfortunately, this is something that I haven't considered when
> implementing the FancyArrowPatch.
> As you may know, FancyArrowPatch is a single patch object (at least
> viewed from outside), so you cannot have multiple linestyles that can
> be set by users.
>
> So, one option is to change the implementation to use a hard-coded
> line style for arrow heads, but this is not straight forward in fact.

That was my conclusion as well.  Thanks for confirming.

>
> Another option is to use custom path effects. Attached is a modified
> version of your script with this approach.
> Although this makes your code more complicated, this could be the most
> straight forward way.

Awesome.  I've submitted a patch to Sage with your example (and credited 
you as an author): http://trac.sagemath.org/sage_trac/ticket/12852

Thanks,

Jason

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] FancyArrowPatch -|> style doesn't have solid arrowhead when linestyle='dashed'

2012-04-12 Thread Jason Grout
When the -|> style was added to FancyArrowPatch, the purpose was to add 
an arrow style with a certain style shaft, but a solid head [1]. 
However, since the given linestyle is used for the outline of the head, 
we can have arrowheads that look very odd.  Here is the example input 
and output:

http://aleph.sagemath.org/?q=0b7e7b41-e6cc-4cfe-b176-e42ece3565c9

from matplotlib.pyplot import figure, show
from matplotlib.patches import FancyArrowPatch

fig = figure()
ax = fig.add_subplot(111,autoscale_on=False,)
p = FancyArrowPatch((0,0), (1,1), 
arrowstyle='-|>,head_width=8,head_length=16',lw=3,fc='k',ec='k',linestyle='dashed')
ax.add_patch(p)
show()

Is there an easy fix to make the arrowhead have a solid linestyle, even 
if the shaft is dashed?  Is this desirable to anyone else besides me?

Thanks,

Jason

[1] http://sourceforge.net/mailarchive/message.php?msg_id=21133511

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question(s) for new MAC 10.7 User

2012-02-21 Thread Jason Grout
On 2/21/12 9:24 AM, Lou Pecora wrote:
> To William Jennings.
>
> I would suggest you look at the SAGE python package
> (http://www.sagemath.org/). Like Enthought it's an all-in-one package.
> My package uses Python 2.6.4. Current versions may be higher. It has a
> LOT of stuff, but you don't need to use it all and can ignore it (lots
> on symbolic math, but if you don't need it just ignore it). It contains
> matplotlib, numpy, scipy and lots of other scientific packages. Lots of
> other stuff too, like IPython, ctypes, Cython, and a SAGE notebook
> (looks good, but I haven't messed much with it). Too much to list. IIRC
> it does not include wxPython, though. If you need that, you should
> check. I think you can install it (see below)
>
> Cost? It's free.
>
> I've compiled several versions of it on my Macs with no hitch, but I
> think you can just download Mac binary packages in a .zip file,
> decompress them, and put them in the Applications folder and you're
> ready to go. You can set up the sage env variable and point to the
> python in the SAGE application instead of the Mac one. You can install
> more in the SAGe package if you want. Just point to sage python instead
> of python in the install scripts.
>
> I've been using it for 1 1/2 years and have been very happy with it.
> It's a tour de force package of packages. Beats manual installs for my
> needs any day.


Noticing the title says OSX 10.7---We are working on getting Sage to 
compile on 10.7.  I believe you can download the 10.6 binaries and they 
work for 10.7, though.  If you have any troubles, be sure to post to the 
sage-support mailing list:

http://groups.google.com/group/sage-support?pli=1

or ask on ask.sagemath.org.

Thanks,

Jason

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How matplotlib got me a job

2012-02-08 Thread Jason Grout
On 2/8/12 2:53 AM, Paul Ivanov wrote:
> Patrick Marsh, on 2012-02-07 13:58,  wrote:
>> As I continue to mature as a Python person, I want to give back
>> explicitly to the community that's given so much to me. The problem
>> is, I don't know how. I'm intimidated by the awesomeness of what I see
>> being done around me that I don't even know where to begin. How does
>> one even begin to learn how to understand the deep intricacies of MPL,
>> Numpy, and Scipy so that I'd begin to develop a comfort level that
>> would allow me to begin to actively contribute? I know pretty much
>> everyone on these listservs, including myself, is busy. (I'm in the
>> midst of a 30-day PhD General Exam, and probably shouldn't even be
>> reading the listservs and/or typing this email! *wink*) But if there
>> are those out there that are willing to take a little time and invest
>> in me, and I'm sure there are others like me, I'd gladly become an
>> active contributor instead of a lurker.
>
> One simple, minimally intimidating way to contribute is by making
> improvements to the documentation. Here's a relevant pitch I just
> made on the IPython lists about how easy, yet valuable such
> improvements can be.
>
> http://mail.scipy.org/pipermail/ipython-user/2012-February/009428.html
>
> Another would be to send the colleagues whom your helping here to
> these lists, that way any effort you put in to help them has a
> good chance of helping others, thanks to search engines and
> archives.
>
> Yet another would be to go through some the active issues on the
> tracker and trying to make a test for them.
>
> Yet another still would be to test the various active pull
> requests - and confirm that the fixes or new functionality they
> provide actually work - look through patches and ask questions -
> we have a lot PRs that get very few eyes or comments on them
> (Last [academic] year, I consciously made an effort to be more
> active on this list, and though I haven't pitched in as much
> lately, perhaps the rest of this year I should focus my efforts
> on incoming PRs)


Another big way we've seen new people contribute to the Sage community 
is to answer questions on the ask.sagemath.org site.  Scipy has a 
similar ask.scipy.org site, but it seems relatively quiet.

Jason

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Jason Grout
On 2/7/12 2:47 PM, Michael Droettboom wrote:
> since this would never be full-fledged HTML anyway [1].

Famous last words, right?

I'm curious: for the SVG backend, or a possible html5 canvas backend, 
can we already include html?  I don't know, but I'm curious.

Jason

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] my pie charts gotta pop!

2011-12-14 Thread Jason Grout
On 12/14/11 6:33 PM, Justin wrote:

> Any suggestions or places to find a gorgeous pie chart, let me know...

I'd probably use Excel or OpenOffice if I were you.

Jason

--
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Line2D drawstyle

2011-05-30 Thread Jason Grout
In the docs for Line2D, it says that the linestyle can be "any drawstyle 
in combination with a linestyle, e.g. 'steps--'."  However, this doesn't 
seem to work in practice.  I believe I have matplotlib 1.0.1 here:

In [2]: from matplotlib import lines

In [3]: line=lines.Line2D([0,1,2],[0,1,4], linestyle='steps--')

In [4]: line.get_drawstyle()
Out[4]: 'default'

In [5]: line.get_linestyle()
Out[5]: '--'


Note that if I specifically set the linestyle using set_linestyle, it 
appears to parse out the drawstyle:

In [11]: line.set_linestyle('steps--')

In [12]: line.get_drawstyle()
Out[12]: 'steps'


However, if I plot the line using the plot() command, the drawstyle is 
correctly set to 'steps'.


In [6]: from matplotlib import pyplot

In [7]: line2=pyplot.plot([0,1,2],[0,1,4], linestyle='steps--')

In [8]: line2
Out[8]: []

In [9]: line2[0].get_drawstyle()
Out[9]: 'steps'

In [10]: line2[0].get_linestyle()
Out[10]: '--'

Should Line2D parse out the drawstyle from the linestyle, or are the 
docs wrong about the Line2D linestyle parameters, or am I just 
misunderstanding something here?

Thanks,

Jason

--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Boundary edges of a set of points

2011-04-28 Thread Jason Grout
On 4/28/11 9:03 PM, gary ruben wrote:
> http://stackoverflow.com/questions/1920145/how-to-find-duplicate-elements-in-array-using-for-loop-in-python-like-c-c
> i.e.
> dups = [x for x in list_a if list_a.count(x)>  1]

That involves iterating through your list_a a number of times to look 
for elements.  It probably would be much faster to use something like 
the Counter class to just get the items that occur once or more than once:

http://docs.python.org/library/collections.html#counter-objects

Thanks,

Jason


--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] GraphicsArray

2011-03-31 Thread Jason Grout
On 3/31/11 3:32 AM, T J wrote:
> Any chance matplotlib can get functionality similar to GraphicsArray
> in Mathematica?  It'd be nice to make a single method to draw whatever
> you want and then do this in a list comprehension.  At the end, you
> can arrange all those plots however you want.
>
> It looks like Sage has implemented something like this (built on top
> of matplotlib, I presume).  Would it be difficult to port this to
> "pure" matplotlib?
>
> 
> http://ask.sagemath.org/question/308/can-i-convert-a-graphicsarray-object-to-a-graphics


Sage does indeed have a (somewhat crufty) GraphicsArray object [1], 
which I've been meaning to convert to use the new GridSpec functionality 
[2].  It is built on top of matplotlib, but the code is fragile and easy 
to "break".  See 
http://doxdrum.wordpress.com/2010/08/12/graphics-array-in-sagemath/, for 
example.

One thing that would be really nice in GridSpec is if we could plot 
things recursively.  As I understand it right now, using GridSpec, we 
can arrange a bunch of axes in a grid.  However, what if we wanted to 
put a grid inside of one of the spots in the grid?  (I think the same 
question is: what if we wanted to embed a figure inside another axes?)

Jason


[1] 
http://www.sagemath.org/doc/reference/sage/plot/plot.html#sage.plot.plot.graphics_array

[2] http://matplotlib.sourceforge.net/users/gridspec.html; 
http://matplotlib.sourceforge.net/api/gridspec_api.html

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] built docs contain .pyc files

2011-03-02 Thread Jason Grout
I tried building the standalone html docs using:

cd doc
python make.py html

I notice that there are around 30 .pyc files left in the 
build/html/pyplots/ directory.  Are these needed in the html 
documentation build directory?

Also, it seems that the files in _images are redundant, as they are 
referenced in their original directory, not _images.

from the build/html directory:

% find . -name multiline.pdf
./_images/multiline.pdf
./plot_directive/mpl_examples/pylab_examples/multiline.pdf
% grep -ri "multiline.pdf" *
examples/pylab_examples/multiline.html:[source 
code, hires.png,
 
pdf]

Any comments about trimming down the size of the build/html directory?

Thanks,

Jason

--
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Any update on streamline plot

2011-02-12 Thread Jason Grout
On 2/11/11 3:06 PM, Ray Speth wrote:
> Hi,
>
> I wrote a script to generate streamline plots using matplotlib a while
> ago, and this post inspired me to finally clean it up a bit. The code is
> available at http://web.mit.edu/speth/Public/streamlines.py and you can
> see an example of its output at
> http://web.mit.edu/speth/Public/streamlines.png
>
> I'd be happy to have it find a home in matplotlib if it would be useful
> to other people there.


Could you put a license statement on the file you posted?  Even if it 
isn't included in matplotlib, I think we would love to include it in 
Sage.  I've wanted to have streamline plots in Sage for a long time, and 
your plots look great!

Thanks,

Jason

--
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Is it possible to plot axes with arrows ?

2011-02-03 Thread Jason Grout
On 2/2/11 8:51 AM, Francois Maltey wrote:
> Hello,
>
> I use matplolib by the mathematical system Sage in order to plot a function.
> The Sage code calls matplotlib and uses its options : The Sage command is
>
> plot (sin, x, -5, 5)
>
> I add labels par axes_labels or remove axes by :
>
> plot (sin(x), x, -5, 5, axes_label = ['x', 'y'])
> plot (sin(x), x, -5, 5, axes=false)
>
> French users (and maybe others) uses arrows and not lines for axes.
> I'm looking for a plot (sin(x), x, -5, 5, axes="arrows")
> Is there a pretty way to get these arrows. The result of this code isn't
> so fine.
> length, width and color don't match.
>
> plot (sin(x), x, -5, 5, axes=false) + arrow ((-5,0),(5,0)) + arrow
> ((0,-1),(0,1))
>
> What options do you propose ?


I've made a Sage ticket for this:

http://trac.sagemath.org/sage_trac/ticket/10740

As a clumsy workaround, you could use the .matplotlib() method for Sage 
graphics objects to get the matplotlib figure object for the graphics 
object.  Then you could:

1. figure out which spine was being used as the drawn axes
2. use that spine's transform to place an arrow at the end of the spine 
(using the example code that was just posted in another message to draw 
the arrow).
3. Draw the figure

Thanks,

Jason

--
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] latex ' (prime)

2011-02-03 Thread Jason Grout
Observe the following image:

import pylab
pylab.plot([0,1],[1,2],label="$\sigma'_0$")
pylab.legend()
pylab.savefig('test.png')


Notice that the \prime introduced by the single quote in the legend is 
not raised above the \sigma, like it would be in TeX (i.e., in TeX, 
$\sigma'_0$ is equivalent to $\sigma^\prime_0$, IIRC).  Is this a design 
decision, or is it easy to fix?  This is with matplotlib 1.0.0.

Thanks,

Jason


--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] latex ' (prime)

2011-02-01 Thread Jason Grout
On 2/1/11 11:40 AM, Darren Dale wrote:
> On Tue, Feb 1, 2011 at 12:29 PM, Jason Grout
>   wrote:
>> Observe the following image:
>>
>> import pylab
>> pylab.plot([0,1],[1,2],label="$\sigma'_0$")
>> pylab.legend()
>> pylab.savefig('test.png')
>>
>>
>> Notice that the \prime introduced by the single quote in the legend is
>> not raised above the \sigma, like it would be in TeX (i.e., in TeX,
>> $\sigma'_0$ is equivalent to $\sigma^\prime_0$, IIRC).  Is this a design
>> decision, or is it easy to fix?
>
> Did you try:
>
> pylab.plot([0,1],[1,2],label="$\sigma^\prime_0$")

Yes, both that and

pylab.plot([0,1],[1,2],label="$\sigma^'_0$")

work fine.  So we know a (somewhat clumsy) workaround.

Jason

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] latex ' (prime)

2011-02-01 Thread Jason Grout
Observe the following image:

import pylab
pylab.plot([0,1],[1,2],label="$\sigma'_0$")
pylab.legend()
pylab.savefig('test.png')


Notice that the \prime introduced by the single quote in the legend is 
not raised above the \sigma, like it would be in TeX (i.e., in TeX, 
$\sigma'_0$ is equivalent to $\sigma^\prime_0$, IIRC).  Is this a design 
decision, or is it easy to fix?  This is with matplotlib 1.0.0.

Thanks,

Jason


--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Possible to get variable spacing between certain subplots?

2010-12-14 Thread Jason Grout
On 10/28/10 1:18 PM, Will Grover wrote:
> Hello matplotlib-users,
>
> I'm using subplots to make an array of plots, but because some of the plots
> have wider y-axis tick labels than others, some of the subplots end up
> looking too close to each other.  Here's an image that shows what I mean:
>
>http://web.mit.edu/wgrover/www/spacing.png
>
> I'm currently using pylab.subplots_adjust(hspace = __, vspace = __) to
> adjust the subplot spacing, but since that applies to all subplots, no one
> setting looks right for the entire array of plots.  Is there any way to set
> the spacing so that the subplots *plus tick labels* are evenly distributed?
>   Or can I manually specify the spacing between each subplot?  Thanks,


(to those more knowledgeable than me...)

Is this something that ImageGrid would solve?

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axes-grid1

Also, could you use subplotpar to adjust spacing in each subplot?

http://matplotlib.sourceforge.net/users/gridspec.html#adjust-gridspec-layout

Thanks,

Jason


--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] annotate arrow drawn slightly off

2010-11-09 Thread Jason Grout
On 11/9/10 8:44 PM, Jae-Joon Lee wrote:
> On Wed, Nov 10, 2010 at 1:01 AM, Jason Grout
>   wrote:
>> Is the tip of the arrow (after the miter join) supposed to hit (1,1), or is
>> the center of the line supposed to hit (1,1)?  Or maybe the tip of the
>> joinstyle='round' arrow (the default) is supposed to hit (1,1)?
>>
>
> The tip of the arrow is meant to hit (1,1), which is done by the
> underlying arrow class adjusting the end point of the path during the
> drawing time. This only happens for arrowstyle "->" and etc.
> However, there was an incorrect arithmetic which I think is fixed now.
> The patch is attached (it also fixes dpi-related issues).
> I'm not sure it would be better if this could be optionally turned
> off. Any suggestion?
> Let me know of any (persisting or other) issues.

Wow.  You're amazing.  Thanks for all the work you put into this right 
away!  When I set shrinkB to zero, that arrow is right on the money.

>
> FYI, path is shortened by small amount by default. This is controlled
> by *shrink* parameter (shrinkA and shrinkB shortens the line begin and
> the line end respectively.)
>

Right.  In Sage, we're using the shrinkA and shrinkB options quite a 
bit.  For example, we use it in drawing vertex-and-edge graphs (so the 
arrows go to the edges of the vertex circles), and right now we use it 
by default to shrink by the linewidth (though I think I'm going to turn 
off Sage's default shrinking and just leave that up to the user).

This latest patch seems to take care of the problems I was seeing.

Thanks again!

Jason

--
Jason Grout

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] annotate arrow drawn slightly off

2010-11-09 Thread Jason Grout
On 11/9/10 9:21 AM, Benjamin Root wrote:

> I just tested out the patch, and while it did seem to fix the problem for me
> on the test script, I am not 100% certain that it is properly lined up
> (maybe an off-by-one-pixel error?).  Anyway, I tried zooming in to see which
> kind of error it was and I got a very weird image.  I am not certain exactly
> what triggers it, but I think if the rubber-banding does not incorporate the
> entire arrow-head, then the distortion appears.  I was also able to
> reproduce the distortion without the patch (although I think it was easier
> to cause with the patch).

If it looks like an off-by-one pixel error, make sure you are doing:

import matplotlib
matplotlib.rcParams['path.snap'] = False

to turn off the pixel-snapping that happens with horizontal and vertical 
lines in png images, or make sure you are seeing the off-by-one in a 
vector graphic format like pdf.  For me, saving a pdf with the slanted 
line a linewidth of .01 showed that the arrow is right on it now.

I did notice one thing that did seem a little off, though.  I see that 
the tip of the arrow just barely projects over the corner of the box. 
The arrow is supposed to go to (1,1), and the linewidth is 30, so I'm 
thinking that the miter join should project a long ways over the box 
(because the centers of the lines are at (1,1), and the line width is 
very large).  If I change the path_effects argument to:

path_effects=[Stroke(joinstyle='miter'),Stroke(linewidth=1,foreground='w',joinstyle='miter')]

so that I see more clearly where the actual line center is, it appears 
that the line center is far off of (1,1).  I guess at this point, I'm 
confused about how the arrow is supposed to be representing the segment 
between (0,0) and (1,1).  Is the tip of the arrow (after the miter join) 
supposed to hit (1,1), or is the center of the line supposed to hit 
(1,1)?  Or maybe the tip of the joinstyle='round' arrow (the default) is 
supposed to hit (1,1)?

I noticed this bug when I was trying to figure out a way to have the 
actual drawn arrow end at a specific point (maybe using miter join, so 
that we had a sharp arrow) for Sage.  It would be nice if there was some 
sort of option that would do the math to shorten the arrow by the 
necessary amount.  Of course, if that's not an option, I could do that 
math myself in Sage's "arrow" wrapper command.

Thanks,

Jason




--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] annotate arrow drawn slightly off

2010-11-09 Thread Jason Grout
I've been trying to track down a problem in the arrows where the arrow 
seems to be off by a little bit.  I've narrowed down the problem to a 
small example:

import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
fig=plt.figure()
ax = fig.add_subplot(111, xlim=(.98,1.02), ylim=(.98,1.02),aspect='equal')
from matplotlib.patheffects import Stroke

ax.annotate('', (1,1),
 (0,0),
 arrowprops=dict(arrowstyle="-|>",
 fc="w", ec="k",lw=30,
 path_effects=[Stroke(joinstyle='miter')]),)
ax.plot([0,1],[1,1])
ax.plot([1,1],[0,1])
ax.plot([0,1.02],[0,1.02])

fig.savefig('test.png')


I've used a miter join above because it illustrates the problem better. 
  Notice that the arrowhead tip is just below the line, but should be 
right on the line.  Any clue about what the problem is?

Thanks,

Jason

--
Jason Grout

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Jason Grout
  On 10/01/2010 10:40 AM, Michael Droettboom wrote:
>On 10/01/2010 11:31 AM, Jason Grout wrote:
>> I'm working on updating matplotlib in Sage to 1.0.  We're running into
>> a problem where it seems that the fontList.cache is not being updated.
>> I've included an example session below.  The .matplotlib directory is
>> accessible here:
>> http://sage.math.washington.edu/home/jason/.matplotlib/  The problem
>> seems to be that it is looking for a file that does not exist:
>>
>> [ja...@sage:/scratch/jason/sage-4.6.alpha2]$ ls
>> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
>> ls: cannot access
>> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf:
>> No such file or directory
>>
>>
>> Does anyone have any idea what is going on?  Why is the fontList.cache
>> file not being updated, instead of trying to access a path that doesn't
>> exist?
> There is a fix in SVN for this, but it has not yet been released.  When
> a font file is not found, it rebuilds the entire font cache on the spot.

Thanks.  Do you know the commit?  We'll apply it to the Sage matplotlib 
package.


>> A related question is: I see the variable USE_FONTCONFIG in
>> font_manager.py.  It says it is experimental.  How stable is that code?
>> It's tempting to switch to using fontconfig.
> I use it as a matter of course on my Linux box and haven't had any
> issues.  It's experimental because it's the kind of thing that is so
> affected by external environmental issues and distro differences.  Just
> because it "works for me", there's no guarantee it will work
> everywhere.  But go ahead and give it a try and report back with the
> distro you're using.
>

Well, with Sage, we're using it on a number of distros, flavors of OSX, 
Solaris, etc.  So maybe I'll stick with the home-grown caching 
solution.  At least until we've tested it a bit on different support 
platforms for Sage.

I thought there was some sort of build bot for matplotlib that tested on 
a number of platforms.  Do you know how the fontconfig stuff does on 
that (if it exists...).

Thanks,

Jason


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Jason Grout
  I'm working on updating matplotlib in Sage to 1.0.  We're running into 
a problem where it seems that the fontList.cache is not being updated.  
I've included an example session below.  The .matplotlib directory is 
accessible here: 
http://sage.math.washington.edu/home/jason/.matplotlib/  The problem 
seems to be that it is looking for a file that does not exist:

[ja...@sage:/scratch/jason/sage-4.6.alpha2]$ ls 
/scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
ls: cannot access 
/scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf:
 
No such file or directory


Does anyone have any idea what is going on?  Why is the fontList.cache 
file not being updated, instead of trying to access a path that doesn't 
exist?

A related question is: I see the variable USE_FONTCONFIG in 
font_manager.py.  It says it is experimental.  How stable is that code?  
It's tempting to switch to using fontconfig.

Thanks,

Jason


Here is my example session:

In [1]: from pylab import *

In [2]: text(0.5, 0.5, 'text 0')
Out[2]: 

In [3]: savefig('test.png')
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (532, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (643, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (10, 0))

---
RuntimeError  Traceback (most recent call last)

/mnt/usb1/scratch/jason/sage-4.6.alpha2/ in ()

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/pyplot.pyc
 
in savefig(*args, **kwargs)
 361 def savefig(*args, **kwargs):
 362 fig = gcf()
--> 363 return fig.savefig(*args, **kwargs)
 364
 365 @docstring.copy_dedent(Figure.ginput)

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/figure.pyc
 
in savefig(self, *args, **kwargs)
1082 kwargs.setdefault('edgecolor', 
rcParams['savefig.edgecolor'])
1083
-> 1084 self.canvas.print_figure(*args, **kwargs)
1085
1086 if transparent:

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backend_bases.pyc
 
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, 
format, **kwargs)
1884 orientation=orientation,
1885 bbox_inches_restore=_bbox_inches_restore,
-> 1886 **kwargs)
1887 finally:
1888 if bbox_inches and restore_bbox:

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
 
in print_png(self, filename_or_obj, *args, **kwargs)
 436
 437 def print_png(self, filename_or_obj, *args, **kwargs):
--> 438 FigureCanvasAgg.draw(self)
 439 renderer = self.get_renderer()
 440 original_dpi = renderer.dpi

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
 
in draw(self)
 392
 393 self.renderer = self.get_renderer()
--> 394 self.figure.draw(self.renderer)
 395
 396 def get_renderer(self):

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
 
in draw_wrapper(artist, renderer, *args, **kwargs)
  53 def draw_wrapper(artist, renderer, *args, **kwargs):
  54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
  56 after(artist, renderer)
  57

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/figure.pyc
 
in draw(self, renderer)
 796 dsu.sort(key=itemgetter(0))
 797 for zorder, func, args in dsu:
--> 798 func(*args)
 799
 800 renderer.close_group('figure')

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
 
in draw_wrapper(artist, renderer, *args, **kwargs)
  53 def draw_wrapper(artist, renderer, *args, **kwargs):
  54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
  56 after(artist, renderer)
  57

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/axes.pyc
 
in draw(self, renderer, inframe)
1932
1933 for zorder, a in dsu:
-> 1934 a.draw(renderer)
1935
1936 renderer.close_group('axes')

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
 
in draw_wrap

Re: [Matplotlib-users] Making room for tick labels

2010-09-29 Thread Jason Grout
On 9/29/10 12:49 PM, Justin McCann wrote:
> Not to pile on the "auto-adjust to make labels fit" bandwagon, but
> I've been following the FAQ on adjusting the subplot locations to make
> room for too-long tick labels:
>
> 
> http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels
>
> and have found that the FAQ code isn't very robust.
>
> For example, if I interactively change the size of the plotting window
> so the ylabels touch the left hand side of the window, stretching it
> right again pushes the labels and the subplots too far to the right
> (see attached 'auto_subplot_adjust.toofar.png').
>
> If I make the window too narrow so the figure itself shrinks too much,
> it starts to raise 'ValueError: left cannot be>= right' exceptions,
> and then really shrinks the plot even more (see attached
> 'auto_subplot_adjust.leftright.png').
>
> Any suggestions for making this more robust?

I made the FAQ entry code a little more general (and hopefully more 
robust) a while ago.  I don't know if it takes care of the problem 
you're talking about, though.

I posted it to the matplotlib-devel mailing list here:

http://www.mail-archive.com/matplotlib-de...@lists.sourceforge.net/msg05628.html

You're welcome to use it, and if it makes more sense than the FAQ entry, 
whoever does the FAQ is welcome to include it in the FAQ.

Jason

--
Jason Grout

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Order of 3d Plots

2010-09-23 Thread Jason Grout
On 9/22/10 2:55 PM, Lütteke Felix wrote:
> Hello,
>
>
>
> is there a possibility to order several 3dplots, if all are plotted
> in the same figure. If  I execute the code below, the higher values
> (blue) are covered by the lower (yellow) ones, which seems quite
> unlogical to me (see attached image). Any help if greatly appreciated
> - after having searched for a solution quite a few hours...
>
>


There is no cutting up of objects and ordering them based on distance to 
the viewer, if that's what you're asking.  I see an experiment on github 
that starts to implement that sort of thing, though:

http://github.com/astraw/matplotlib/network/members

Thanks,

Jason

--
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] citation of mpl

2010-09-22 Thread Jason Grout
  On 09/22/2010 08:59 AM, John Hunter wrote:
> On Wed, Sep 22, 2010 at 8:45 AM, Bala subramanian
>   wrote:
>> Friends,
>> I have mentioned in my research manuscript that plots were generated by
>> 'matplotlib package'. I dnt find the related reference of mpl. Kindly tell
>> me how can i site mpl.
> You can certainly reference the website, but if you want to refer to a
> published paper, I suggest
>
> Matplotlib: A 2D Graphics Environment
> Source: Computing in Science and Engineering archive
> Volume 9 ,  Issue 3  (May 2007)
> Pages: 90-95
> Year of Publication: 2007
> ISSN:1521-9615
> Author:John D. Hunter 
> Publisher : IEEE Educational Activities Department  Piscataway, NJ, USA
>
> and/or the conference abstract at
> http://adsabs.harvard.edu/abs/2005ASPC..347...91B

Could this be put up on the website somewhere in a easily-found place?  
Maybe a short sentence and link in the bar on the right under "Other 
stuff"?  Something like "To cite matplotlib in a paper, use  this reference." or something.

Thanks,

Jason


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Level surface of a function of 3 variables

2010-09-17 Thread Jason Grout
On 9/17/10 9:08 PM, Fernando Perez wrote:
> Hi Luke,
>
> On Fri, Sep 17, 2010 at 5:49 PM, Dale Lukas Peterson
>   wrote:
>>
>>   I'm not sure I understand how I would make use of my function then.
>>   My function needs to be evaluated over a 3-d mesh (x, y, and z) , and then 
>> the
>>   level surfaces (not contour lines) calculated.  I guess I could treat
>>   z as a parameter, then plot the zero level contour lines of my function for
>>   a discrete number of z values, but then I would need to adjust the
>>   height that each countour line is plotted at when I do the 3-d plot.
>>   This still would only give bunch of vertically stacked contour
>>   lines, rather than a nice smooth 3-d surface.
>>
>>   If I'm misunderstanding what you meant, perhaps you could point me
>>   to an example of something that makes a level surface of a function
>>   of 3 (not 2) variables?
>
> You're looking for an isosurface; as far as I know matplotlib does not
> have isosurface modules, only 2-d contours embedded in 3d (such as
> those illustrated in
> http://matplotlib.sourceforge.net/examples/mplot3d/contourf3d_demo.html).
>
> VTK does have powerful isosurface capabilities, nicely exposed by mayavi:
>
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/mlab_helper_functions.html#contour3d


Sage will also do this sort of thing, though it's not as powerful as 
VTK/Mayavi in this functionality:

http://www.sagemath.org/doc/reference/sage/plot/plot3d/implicit_plot3d.html

Here are lots of sheets on sagenb.org that use implicit_plot3d somewhere:

http://sagenb.org/pub/?typ=pub&search=implicit_plot3d


Thanks,

Jason

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting an arrow outside of the plot does not work any more

2010-08-28 Thread Jason Grout
On 8/28/10 3:59 PM, Stan Schymanski wrote:
> Hi JJ,
>
> Thanks for the advice. However, the annotation_clip=False addition does
> not make a difference to me. I am using Matplotlib from within Sage,
> though; not sure if this makes it behave differently.
>


FYI, matplotlib in Sage is still at matplotlib 0.99.3.  We're working on 
upgrading it to 1.0.0.

Stan, if you want, could you try installing the 1.0.0 Sage matplotlib 
spkg and seeing if that works?  You can do it by doing:

sage -i http://sage.math.washington.edu/home/jason/matplotlib-1.0.0.spkg

(the ticket is http://trac.sagemath.org/sage_trac/ticket/9221 )

Matplotlib 1.0.0 changes how axes labels work, so if you want to do axes 
labels, then you'll have to also install the patch listed at the ticket.

Thanks,

Jason

--
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] spline "smart bounds"

2010-08-16 Thread Jason Grout
On 8/16/10 5:36 AM, Michael Droettboom wrote:
> For clarification: this change is related to "spines" not "splines".
> Spines are the feature that allows the axes ticks to be plotted
> somewhere in the middle of the plot, rather than always at the edges.
> See here:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html?highlight=spine%20codex
>
> Splines would refer to Bezier curves.  See here:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/dolphin.html?highlight=dolphin%20codex
>
> Which feature are you interested in?
>
> That said, I'm not sure what the spine smart bounds work is about, but I
> suspect Andrew Straw does.


Sorry, I mistyped that: I meant "spines".

We use spines to do the axes in Sage, and in updating the matplotlib 
package, I was wondering if we could take advantage of the "smart bound" 
feature.  It certainly sounded interesting.

Thanks,

Jason
--
Jason Grout



--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] spline "smart bounds"

2010-08-14 Thread Jason Grout
Hi all,

First: I noticed in the changelog to 1.0 that a lot of work has gone 
into splines.  Thanks!

In particular, I notice commit message "splines and ticks: implement 
smart bounds" from 20 Dec 2009 (commit 
58d31c10eef8648cd0fb81d5c0f0bcd0c05fe9a1 in astraw's github repository, 
labeled as git-svn-id: 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplot...@8048 
f61c4167-ca0d-0410-bb4a-bb21726e55ed).

What are "smart bounds"?  It looks desirable to do, but it defaults to 
off, I think.

Thanks,

Jason

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ANN: matplotlib 1.0.0

2010-07-06 Thread Jason Grout
On 7/6/10 2:11 PM, John Hunter wrote:
> matplotlib 1.0.0 is available for download at
>
> 
> https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/
>
> You can read this announcement with links and rendered figures at
>
>http://matplotlib.sourceforge.net/users/whats_new.html
>
> This page just covers the highlights -- for the full story, see the
> CHANGELOG below.
>
> A big thanks to all the developers who made this release possible.
> Some of the contributions are highlighted below, but a particular
> thanks to Eric Firing for new features and a heroic effort closing and
> fixing bugs, Jae-Joon Lee for continuing to amaze us with the things
> he can make matplotlib do (see gridspec below), Michael Droettboom for
> his tireless work tracking down bugs no one else can figure out,
> Christoph Gohlke for the Windows binaries, Russell Owens for the O X
> binaries, and Benjamin Root and Michiel de Hoon for many bug fixes and
> new features.
>
> What's new in matplotlib 1.0
> 
>
>
> HTML5/Canvas backend:
>
>Simon Ratcliffe and Ludwig Schwardt have released an HTML5/Canvas
>(http://code.google.com/p/mplh5canvas) backend for matplotlib.
>The backend is almost feature complete, and they have done a lot of
>work comparing their html5 rendered images with our core renderer
>Agg.  The backend features client/server interactive navigation of
>matplotlib figures in an html5 compliant browser.
>
>

Wow, this is great news!  Thanks to everyone that has worked on this!

I tried to find the html5/canvas backend in the 1.0.0 tarball.  Is it 
included in matplotlib?  The heading "What's new *in* matplotlib 1.0" 
makes it seem like I should find the files in the matplotlib 
distribution, but I can't seem to find the code that I see up on the 
code.google.com site.

Thanks,

Jason


--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Interact with matplotlib in Sage

2010-01-25 Thread Jason Grout
Gökhan Sever wrote:
> Hello,
>
> I have thought of this might interesting to share. Register at
> www.sagenb.org or try on your local Sage-notebook and using the following
> code:
>   
>

A related example that lets you get the actual matplotlib figure from a 
Sage graphic and play with it is here:

http://sagenb.org/home/pub/1413/

The thing we'd like to do now is be able to wrap matplotlib axes with 
Sage Graphics objects (so someone can construct a matplotlib object and 
then wrap it in a Sage Graphics instance to then do further stuff with 
it in Sage).  However, I think we need to resolve the issues involving 
taking the axes from one figure and adding them to another figure; these 
issues were brought up on the mailing list a while ago.

Thanks,

Jason

--
Jason Grout
jason.gr...@drake.edu




--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Venn diagrams

2009-02-19 Thread Jason Grout
Ian Harry wrote:
> Hi all,
>
> Is there any simple way in matplotlib, or in any other python library, to
> make a simple Venn diagram, I want to show three events and their
> intersections? I have tried googling for any hints but didn't find anything.
>
>   


You can use Sage (http://www.sagemath.org or http://sagenb.org)

http://wiki.sagemath.org/interact/misc#AnInteractiveVennDiagram

(scroll down to see the picture; email me off-list if you'd like help in 
setting up an account or installing Sage; you can use Sage as a python 
library).

Even if you don't use Sage and something like the interactive Venn 
diagram listed in the URL gives you relevant code for creating such a 
thing in matplotlib.

Sage uses matplotlib in the background to actually draw the Venn diagram.

Thanks,

Jason



--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Arrows using Line2D and shortening lines

2008-08-22 Thread Jason Grout
Jae-Joon Lee wrote:
> Hi Jason,
> 
> I did made a similar class sometime ago and I'm attaching it just in
> case. I guess it is very similar to yours but I rely on
> matplolib.patches.FancyArrow class to draw the arrow head.
> 
> The circle drawn by scatter() command should be a circle with size s
> (the third argument of the scatter command) in points . It seems that
> it is implemented as a unit circle centered at (0,0) with a transform
> corresponding to the size s (and offset). So you may try something
> like below to calculate the size of the circle in data coord.
> 
>   ax = gca()
>   p = scatter([0],[0], 500.)
>   tr = p.get_transforms()[0] + ax.transData.inverted()
>   x1, y1 = tr.transform_point([0,0])
>   x2, y2 = tr.transform_point([1,0])
>   r = abs(x2 - x1)
> 
> p is a collection object and p.get_transforms() is a list of transforms.
> Note that a circle in the canvas coordinate(?) can be an ellipse in
> data coordinates. So, I guess you'd better do things in the canvas
> coordinates.
> 
> For shortening your path, if you're only concerned with a straight
> line, it should be straight forward. But I guess it would a bit tricky
> to do this for general bezier curves (as in the example that Alan
> linked). I think (but I may be wrong) there is no universal algorithm
> to find the "all" intersecting points of two bezier curves. There may
> be one for between a bezier curve and a circle. And in this case where
> one point is inside the circle and the other is outside, one simple
> way I can think of is to recursively bisect the bezier curve (similar
> to the bisect root finding).

Jae-Joon,

Thank you very much.  I am just finishing implementing a working version 
of what I wanted in my ArrowLine class; it now shortens itself by a 
certain number of points (assuming a line, just using a scale 
transformation).  However, I use paths for drawing the arrowhead where 
you use patches.  I think I like the flexibility your approach offers. 
Do you mind if I include your code in the GPL-licensed Sage, and extend 
it to do this shortening thing that I need?  I still haven't decided 
which is ultimately better for what I need (my class or your class), but 
if you're willing to license your class in a compatible way, that 
provides a choice.

Thanks,

Jason


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Arrows using Line2D and shortening lines

2008-08-22 Thread Jason Grout
Alan G Isaac wrote:
> Jason Grout wrote:
>> The other problem is a more serious problem for me: how do 
>> I shorten the line so that it goes between the boundaries 
>> of the circle instead of the centers, especially when the 
>> circles are constructed in a scatter plot. 
> 
> Some years back I briefly tried to think about arrows and
> I found it trickier than expected.  Note that some famous
> software clearly does arrows wrong.  (E.g., gnuplot, at
> least last I checked.)
> 
> Example: you have decided that you want to draw to the edge
> of a point, but a) is that right and b) can it be reasonably
> implemented?
> 
> a) One might well argue in many applications that the arrow
> tip should go to the center of the circle.

I'm sure there are lots of applications where this is true.  My specific 
problem domain is drawing graphs, exactly as graphviz. Often there is a 
label inside the circle.  Drawing to the edge of the circle is the 
standard way of doing it, so a) is yes, it is the right thing to do.

Things like flowcharts are another example of wanting to do this.


> 
> b) I'm not sure.


Thanks; at least this is validating the amount of time I already spent 
thinking about this and trying to get it to work.


> 
> But surely somebody out there will offer some great clues.
> Perhaps along the line of graphviz:
> http://www.graphviz.org/Gallery/directed/fsm.html
> 
> Really this is not an answer to your questions ...

Thanks for your comments.  I think I'll post up another post asking some 
more specific questions, along the lines of what I think might work if I 
can figure out what matplotlib is thinking.

Jason


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Arrows using Line2D and shortening lines

2008-08-22 Thread Jason Grout
Alan G Isaac wrote:
> Jason Grout wrote:
>> Another related issue is that width of the path used to draw the 
>> arrowhead makes the arrow tip go beyond the endpoint; is there a way to 
>> shorten a line by a certain number of points so that we 
>> can account for that?
> 
> For this problem, what you want is to fill the arrowhead
> without stroking it.
>

Brilliant!  Thanks for the suggestion.

The other problem is a more serious problem for me: how do I shorten the 
line so that it goes between the boundaries of the circle instead of the 
centers, especially when the circles are constructed in a scatter plot.

If I knew how big the circles were in plot coordinates, it wouldn't be a 
problem.  But the circle size isn't specified in plot coordinates, but 
in scale-independent coordinates, I believe.

Is there a way I could somehow compute the intersections of the paths? 
Maybe while I draw the line, I could also construct a circle of the 
right size at the endpoint, ask for the intersection, and shorten my 
line to go there?

Thanks again!

Jason


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Arrows using Line2D and shortening lines

2008-08-22 Thread Jason Grout
I'm trying to get some "pretty" arrows for graphs and other uses in 
Sage.  One of the problems we've been having with the FancyArrow and 
YAArrow is that the arrow is skewed when the aspect ratio is not 1:1 and 
it is scaled along with the plot.  I've written the attached ArrowLine 
class which basically modifies the marker drawing code to draw an 
arrowhead at the end of a Line2D.  It doesn't suffer either of these 
problems; it works beautifully.

However, in drawing (vertex and line) graphs, we have another problem. 
The vertices of the graph are drawn using scatterplot, and I know the 
corresponding vertex size (in whatever units scatterplot uses).  I'd 
like to draw an arrow between the boundaries of the vertices.  Is there 
a way to shorten a line  that originally goes between the centers of two 
circles so that the line instead goes between the two boundaries of the 
circles?  Note that clipping the line isn't an option since I want to 
keep the arrowhead on the line instead of clipping it off.  I presume 
this shortening will have to be done in the drawing routine since it 
needs to be independent of zooming since the circles are drawn the same 
independent of zooming.

Another related issue is that width of the path used to draw the 
arrowhead makes the arrow tip go beyond the endpoint; is there a way to 
shorten a line by a certain number of points so that we can account for 
that?  Also, in drawing the arrowhead, the line pokes through the 
arrowhead; I'd like to shorten the shaft to the beginning of the arrowhead.

I think all three of these shortening questions are similar; I'd like to 
shorten an arrow in a scale-independent way (i.e., by a certain number 
of points or something).


The code I have for the ArrowLine class is below.  If people are 
interested, I could (eventually, as I have time) incorporate this 
functionality into the Line2D class (i.e., putting arrowheads on the 
ends of lines).


r"""
A matplotlib subclass to draw an arrowhead on a line.

AUTHORS:
 -- Jason Grout (2008-08-19): initial version
"""

########
#  Copyright (C) 2008 Jason Grout <[EMAIL PROTECTED]>
#  Released under the terms of the modified BSD License


import matplotlib
from matplotlib.path import Path
from matplotlib.lines import Line2D
import math
import matplotlib.cbook

class ArrowLine(Line2D):
 """
 A matplotlib subclass to draw an arrowhead on a line.

 EXAMPLE:
 sage: import pylab
 sage: fig = pylab.figure()
 sage: ax = fig.add_subplot(111, autoscale_on=False)
 sage: t = [-1,2]
 sage: s = [0,-1]
 sage: line = ArrowLine(t, s, color='b', ls='-', lw=2, 
arrow='>', arrowsize=20)
 sage: ax.add_line(line)
 sage: ax.set_xlim(-3,3)
 (-3, 3)
 sage: ax.set_ylim(-3,3)
 (-3, 3)
 sage: pylab.show()

 """

 arrows = {'>' : '_draw_triangle_arrow'}

 def __init__(self, *args, **kwargs):
 """Initialize the line and arrow."""
 self._arrow = kwargs.pop('arrow', None)
 self._arrowsize = kwargs.pop('arrowsize', 2*4)
 self._arrowedgecolor = kwargs.pop('arrowedgecolor', 'b')
 self._arrowfacecolor = kwargs.pop('arrowfacecolor', 'b')
 self._arrowedgewidth = kwargs.pop('arrowedgewidth', 4)
 self._arrowheadwidth = kwargs.pop('arrowheadwidth', 
self._arrowsize)
 self._arrowheadlength = kwargs.pop('arrowheadlength', 
self._arrowsize)
 Line2D.__init__(self, *args, **kwargs)



 def draw(self, renderer):
 """Draw the line and arrowhead using the passed renderer."""
 if self._invalid:
 self.recache()
 renderer.open_group('arrowline2d')
 if not self._visible: return

 Line2D.draw(self, renderer)

 if self._arrow is not None:
 gc = renderer.new_gc()
 self._set_gc_clip(gc)
 gc.set_foreground(self._arrowedgecolor)
 gc.set_linewidth(self._arrowedgewidth)
 gc.set_alpha(self._alpha)
 funcname = self.arrows.get(self._arrow, '_draw_nothing')
 if funcname != '_draw_nothing':
 tpath, affine = 
self._transformed_path.get_transformed_points_and_affine()
 arrowFunc = getattr(self, funcname)
 arrowFunc(renderer, gc, tpath, affine.frozen())

 renderer.close_group('arrowline2d')

 _arrow_path = Path([[0.0, 0.0], [-1.0, 1.0], [-1.0, -1.0], [0.0,