Re: [Matplotlib-users] [matplotlib-devel] v1.4.3rc1

2015-02-05 Thread Phil Elson
Awesome work! Full credit to Tom who has driven this release.

The nbagg backend is looking great - some pretty swish new features thanks
to hard work from Steven Silvester and Thomas Caswell!

On 2 February 2015 at 10:58, Jens Nielsen jenshniel...@gmail.com wrote:

 Thanks Tom,

 I ran the test suite on OSX 10.10 with both python 2.7.8 and 3.4.2
 including the tex and QT4 tests that are skipped on Travis.
 Everything passes as expected.

 Jens

 Mon Feb 02 2015 at 5:38:32 AM skrev Thomas Caswell tcasw...@gmail.com:

 Evening all,

 I have tagged the first release candidate for v1.4.3 (https://github.com/
 matplotlib/matplotlib/releases/tag/v1.4.3rc1).

 Although this is a bug-fix release, a fair amount of work has gone into
 making the nbagg (interactive figures in ipython notebooks) feature
 complete compared to the other interactive backends.

 Please kick the tires and give it a try!  If there are no major issues,
 the plan is to target 1.4.3 for next weekend.

 The mac build has been started and (if I understand how these things
 work) should be available to install via
 pip install -f http://wheels.scikit-image.org --pre matplotlib  soon.

 For linux anaconda users, packages for 2.6/2.7 python  on my binstar
 channel (conda install -c https://conda.binstar.org/tacaswell
 matplotlib). The py3k builds have some issue with invalid syntax in pyqt4,
 if some knows how to build these, please let me know.


 Tom


 
 --
 Dive into the World of Parallel Programming. The Go Parallel Website,
 sponsored by Intel and developed in partnership with Slashdot Media, is
 your
 hub for all things parallel software development, from weekly thought
 leadership blogs to news, videos, case studies, tutorials and more. Take a
 look and join the conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-devel mailing list
 matplotlib-de...@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-devel



 --
 Dive into the World of Parallel Programming. The Go Parallel Website,
 sponsored by Intel and developed in partnership with Slashdot Media, is
 your
 hub for all things parallel software development, from weekly thought
 leadership blogs to news, videos, case studies, tutorials and more. Take a
 look and join the conversation now. http://goparallel.sourceforge.net/
 ___
 Matplotlib-devel mailing list
 matplotlib-de...@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


--
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Season's greetings from matplotlib

2014-12-24 Thread Phil Elson
If working on XKCD style plotting for matplotlib taught me anything, it is
that playing with software in a way that it was not originally designed to
do can lead to some excellent discoveries (bugs) and generate new ideas and
generalisations - not to mention it being a lot of fun!

So, in that vein, I wanted to put together a simple Christmas e-card using
matplotlib. My main aim was to re-purpose some of the familiar matplotlib
functionality to generate a simple festive animation.

I decided to go for a snowy scene, with a snow-capped greeting and sprig of
holly. The snow is simply a scatter plot scaled by flake size and animated
to fall in a pleasing way. The text is making use of the path effects
functionality extended in v1.4 to add randomised snow around the text
(the same effect employed by XKCD as it happens). And the holly is a nice
demonstration of the power of Paths and vector rendering in matplotlib.

The source can be found at
https://gist.github.com/pelson/ca795a02a420a1b9bfbc, and it requires
matplotlib = v1.4.

If you're impatient and don't want to run the code (don't do it), the
animation is available on YouTube at
https://www.youtube.com/watch?v=POnAkPpe770.

Finally, to all those taking some time off this festive season, I wish you
a very happy holiday and wish you all the best for the new year.

Phil Elson
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] creating a path from multiple sets of xy coordinates (inner and outer outlines)

2014-12-23 Thread Phil Elson
If I understand your question fully, then yes it does.
Have a play, and let us know how you get on.

Best,

Phil

On 22 December 2014 at 11:15, Denis-Alexander Engemann 
denis.engem...@gmail.com wrote:

 Thanks Phil,

 just to make sure I inderstand the logic of PathPatch. Does it cut out
 vertices / paths that are detected to be inside an outline as the star in
 this example?

 -Denis


 2014-12-22 12:09 GMT+01:00 Phil Elson pelson@gmail.com:

 Sorry its taken so long to get an answer, but essentially you want to
 concatenate the outer coordinates with the inner ones (reversed) to
 indicate that it is a hole. There is a pretty (simple) useful example that
 I added a few years ago for demonstrating the use of paths for markers:
 http://matplotlib.org/examples/pylab_examples/marker_path.html

 Constructing a patch from a path is as simple as (untested):

 import matplotlib.patches as mpatches
 patch = mpatches.PathPatch(my_path, facecolor='red', edgecolor='yellow')
 axes.add_patch(patch)


 HTH,

 Phil


 On 19 December 2014 at 23:01, Denis-Alexander Engemann 
 denis.engem...@gmail.com wrote:

 Dear list,

 I would like to create a custom image clipping mask using patches. My
 constraint is that my patch is required to have an outer and multiple inner
 outlines.
 To provide an analogy, think of a mask used for disguise where you leave
 three holes, two for the eyes, one for the mouth.
 I have the xy coordinates for the 'head', and the xy coordinates for
 each of the holes that I don't want to be hidden by the ensuing clipping
 mask.

 What's the matplotlib way to construct my desired path + patch from that?
 Note, it's important in my case to use a patch object. What I need to do
 would not work by simply masking my image using a masked array.

 Any pointer would be highly appreciated --
 Denis


 --
 Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
 from Actuate! Instantly Supercharge Your Business Reports and Dashboards
 with Interactivity, Sharing, Native Excel Exports, App Integration  more
 Get technology previously reserved for billion-dollar corporations, FREE

 http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] creating a path from multiple sets of xy coordinates (inner and outer outlines)

2014-12-22 Thread Phil Elson
Sorry its taken so long to get an answer, but essentially you want to
concatenate the outer coordinates with the inner ones (reversed) to
indicate that it is a hole. There is a pretty (simple) useful example that
I added a few years ago for demonstrating the use of paths for markers:
http://matplotlib.org/examples/pylab_examples/marker_path.html

Constructing a patch from a path is as simple as (untested):

import matplotlib.patches as mpatches
patch = mpatches.PathPatch(my_path, facecolor='red', edgecolor='yellow')
axes.add_patch(patch)


HTH,

Phil


On 19 December 2014 at 23:01, Denis-Alexander Engemann 
denis.engem...@gmail.com wrote:

 Dear list,

 I would like to create a custom image clipping mask using patches. My
 constraint is that my patch is required to have an outer and multiple inner
 outlines.
 To provide an analogy, think of a mask used for disguise where you leave
 three holes, two for the eyes, one for the mouth.
 I have the xy coordinates for the 'head', and the xy coordinates for each
 of the holes that I don't want to be hidden by the ensuing clipping mask.

 What's the matplotlib way to construct my desired path + patch from that?
 Note, it's important in my case to use a patch object. What I need to do
 would not work by simply masking my image using a masked array.

 Any pointer would be highly appreciated --
 Denis


 --
 Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
 from Actuate! Instantly Supercharge Your Business Reports and Dashboards
 with Interactivity, Sharing, Native Excel Exports, App Integration  more
 Get technology previously reserved for billion-dollar corporations, FREE

 http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration  more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Bloomberg Open source sprint, London, November 29-30 2014

2014-11-26 Thread Phil Elson
There will be an open source Python sprint, hosted by Bloomberg, this
weekend in London. The event will be attended by core developers of many of
the major scientific Python packages (IPython, numpy, scipy, pandas,
scikit-learn) who will act as mentors to those who would like to get
involved in the development of these important scientific tools.

I will be attending as a mentor for matplotlib (if there are any other core
developers who may be able to attend, the more the merrier!) and am hoping
there will be many attendees who want to get a helping hand getting started
with matplotlib development. We've got lots of room for improvement, from
the obvious documentation enhancements right through to the nitty-gritty of
improving backends such as nbagg.

If you want to come along to the event, please sign-up at
http://go.bloomberg.com/promo/invite/bloomberg-open-source-day-scientific-python/
.

Hope you see some of you there,

Phil
--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration  more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] FW: traceback when import matplotlib.pyplot twice

2014-10-11 Thread Phil Elson
On 10 October 2014 19:10, Thomas Caswell tcasw...@gmail.com wrote:

 I suspect a better fix is to change all of the staticmethods -
 classmethods



+1
--
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xkcd

2014-10-04 Thread Phil Elson
Also note, you can just call plt.xkcd() and it will turn on the setting
globally for that session.

On 4 October 2014 00:11, Paul Hobson pmhob...@gmail.com wrote:

 That's what the `with` statement allows you do.

 Say you have a function that does some plotting and returns a figure --
 call it my_plot_func.

 You can do:

 fig1 = my_plot_func()
 fig1.savefig('normal1.png')

 with plt.xkcd():
 fig2 = mu_plot_func()
 fig2.savefig('xkcd.png')

 fig2 = my_plot_func()
 fig2.savefig('normal2.png')

 And the xkcd image will be squiggly but the normal images won't.
 -p

 On Fri, Oct 3, 2014 at 12:40 PM, Christophe Bal projet...@gmail.com
 wrote:

 Hello.

 I've only seen one way to use the xkcd feature. This uses a with
 statement.

 Is there another way to use the xkcd feature so as to easily switch
 between exact plot and trembling one ?

 Christophe BAL


 --
 Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
 Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
 Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
 Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer

 http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
 Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
 Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
 Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer

 http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with basemap.plot() when lon_0 nonzero

2014-04-16 Thread Phil Elson
Cool notebook. I took the liberty of giving it a go with cartopy, and you
can see the results here http://nbviewer.ipython.org/gist/pelson/10822698

I'd agree that the issue you linked to does look very similar to the issue
you are seeing, so I think this is very likely a bug.

Cheers,


On 16 April 2014 00:54, Scott Henderson st...@cornell.edu wrote:

 Hello,

 I’m trying to make a plot data on a map with the ‘cyl’ projection with a
 shifted centerline (lon_0=180), but I receive an error when shiftdata() is
 called. Since the plot works when lon_0=0, this seems to be a bug.

 I’ve posted the code, error, and plots here:

 http://nbviewer.ipython.org/gist/anonymous/cbfe6d0f66ff3a8186c8/shiftdata_issue.ipynb

 It might be related to this issue:
 https://github.com/matplotlib/basemap/issues/126

 Any insight would be appreciated!
 Scott

 --
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/NeoTech
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: Strange behaviour on plotting data on Ronbinson projection using Basemap

2014-04-16 Thread Phil Elson
Hi Chao,

The warning you are getting:

WARNING: x coordinate not monotonically increasing - contour plot
may not be what you expect.  If it looks odd, your can either
adjust the map projection region to be consistent with your data, or
(if your data is on a global lat/lon grid) use the shiftgrid
function to adjust the data to be consistent with the map projection
region (see examples/contour_demo.py).

Is important here. It looks like the x coordinate is not in appropriate
longitudes. Printing the first 5 and last 5 longitudes gives us our first
clue:

First 5: [-180. -178.99720764 -177.99443054 -176.99163818 -175.98886108]
Last 5 : [ 175.98886108  176.9916687   177.9944458   178.9972229   180.3052]

Notice that the last longitude wraps around beyond 180. So if we were to
clip these numbers to -180 and +180 we will see that the warning disappears
and the contour is correct. This can be achieved with:

lon = np.clip(lon, -180, 180)

Alternatively, we can just construct the latitudes and longitudes ourselves
directly with:

lon, lat = np.meshgrid(np.linspace(-180, 180, 360), np.linspace(-90, 90,
180))

Incidentally, I tried these numbers with cartopy which has been designed to
handle dateline wrapping automatically, and the contour worked with the
unmodified longitudes (http://nbviewer.ipython.org/gist/pelson/10830039).

---

@JeffWhitaker - This looks like a bug with float tolerances in the makegrid
function. It currently does:

def makegrid(self,nx,ny,returnxy=False):
dx = (self.urcrnrx-self.llcrnrx)/(nx-1)
dy = (self.urcrnry-self.llcrnry)/(ny-1)

But might be better if it did:

   def makegrid(self,nx,ny,returnxy=False):
x = np.linspace(self.llcrnrx, self.urcrnrx, nx)
y = np.linspace(self.llcrnry, self.urcrnry, ny)

To avoid the multiplicative floating point drift that is currently being
seen.

HTH,

Phil
--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib for tiles - blank lines

2014-03-24 Thread Phil Elson
I fixed an issue related to this (I too was producing map tiles) in
matplotlib v1.2 I believe.

The original issue can be found at
https://github.com/matplotlib/matplotlib/pull/1591 and so I suggest this
might not be an issue with matplotlib = v1.3.

Incidentally, if you are producing map tiles you might be interested in
cartopy which will allow you to produce properly referenced geo maps (and
therefore tiles) with coastlines etc.
I've put a short-sh example in a gist () with the rendered results also
available (https://rawgithub.com/pelson/9738051/raw/map.html). I've also
got a tornado based handler version which generates the tiles upon HTTP
request rather than storing the tiles on disk (much more efficient if you
have highly dynamic data and a caching layer).

Let me know if updating your matplotlib version helps,

Cheers,

Phil







On 24 March 2014 09:45, Jesper Larsen jesper.webm...@gmail.com wrote:

 Hi matplotlib users,

 I am using matplotlib to produce plots (tiles) in a Web Map Service.
 Unfortunately I cannot get Matplotlib to plot on the entire image. There
 are one transparent (pixel) line at the bottom and one transparent line at
 the right. This is of course a problem when the tiles are shown in a map.
 Please see example below. Can anyone see what I am doing wrong?

 Best regards,
 Jesper

 import numpy as np
 import matplotlib as mpl
 from matplotlib.figure import Figure
 from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas

 w = 256
 h = 256
 dpi = 128
 figsize = w/dpi, h/dpi
 fig = Figure(figsize=figsize, dpi=dpi, frameon=False)
 canvas = FigureCanvas(fig)
 ax = fig.add_axes([0, 0, 1, 1])

 x = np.arange(0, 10, 0.1)
 y = np.arange(10, 20, 0.2)
 X, Y = np.meshgrid(x, y)
 D = np.ones((X.shape[0]-1, X.shape[1]-1))
 V = np.linspace(0.0, 1.0, 10)
 ax.pcolor(X, Y, D, antialiased=False)
 ax.axis( [x[0], x[-1], y[0], y[-1]] )
 ax.axis('off')
 filename = 'testfile.png'
 fig.savefig(filename, dpi=128)

 # Test image
 from PIL import Image
 im = Image.open(filename)
 print im.getcolors()



 --
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime error

2014-01-27 Thread Phil Elson
Hi Kai,

I'm afraid I've never heard of this one. Do you have a full error log?

Thanks,


On 26 January 2014 02:40, kaiw...@genetics.ac.cn wrote:



 Hi,

 I'm trying to use matplotlib to generate pictures for my website view. The
 framwork I use is pyramid. But I got an error when I try to refresh my page
 two or more times. The message is as follow:
 This application has requested the Runtime to terminate it in an unusual
 way. Please contact the application's support team for more information.

 Is it a win32 error? I use python27 win32 and matplotlib 1.2.

 Thx


 Kai Wang






 --
 CenturyLink Cloud: The Leader in Enterprise Cloud Services.
 Learn Why More Businesses Are Choosing CenturyLink Cloud For
 Critical Workloads, Development Environments  Everything In Between.
 Get a Quote or Start a Free Trial Today.

 http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Remove backgroundimage

2014-01-27 Thread Phil Elson
As with most other artists, you should be able to just call remove on the
resulting artist.

e.g.

im = plt.imshow(...)
...
im.remove()


HTH




On 2 January 2014 11:58, flambert franz_lambert_en...@yahoo.de wrote:

 Hi,

 Does somebody knows how can I remove a backgroundimage. I set the image
 with
 imshow.

 regards,
 flambert



 --
 View this message in context:
 http://matplotlib.1069221.n5.nabble.com/Remove-backgroundimage-tp42658.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.


 --
 Rapidly troubleshoot problems before they affect your business. Most IT
 organizations don't have a clear picture of how application performance
 affects their revenue. With AppDynamics, you get 100% visibility into your
 Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics
 Pro!
 http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] font setting in matplotlib 1.3.1

2014-01-27 Thread Phil Elson
Thanks for this Vlastimil, looks like there is either a subtlety beyond my
font knowledge or a bug here - mdboom, did you have any ideas? Otherwise I
think we need a github issue for this.

Cheers,


On 4 January 2014 19:37, Vlastimil Brom vlastimil.b...@gmail.com wrote:

 Hi all,
 after upgrading to matplotlib 1.3.1, I noticed some display errors on
 the plots with regard to accented characters (such as carons etc.).
 As I recall, I had similar problem in the past and could work around
 them by modifying rcParams, however, this fix doesn't work as expected
 in 1.3.1. (with python 2.7.6, 32bit on Win 7, Czech - with both WXAgg
 and TKAgg backends).
 From the usual Czech diacritics   áčďéěíňóřšťúůýž some are not
 displayed  (ďěňřťů) - replacement squares are shown instead.

 Simply prepending a suitable font at the beginning of the list
 rcParams['font.sans-serif'] doesn't help in 1.3.1.
 I eventually found out, that Bitstream Vera Sans (which is not
 installed on this computer) is somehow offending - as long as this
 item is in the list (even at the end), the mentioned characters aren't
 displayed.

 The problem can be observed in the following simple pylab script:
 ==
 #! Python
 # -*- coding: utf-8 -*-

 # with implicit fonts ďěňřťů are not displayed properly in the plot title
 from matplotlib import rcParams
 rcParams['font.family'] = 'sans-serif'
 if Bitstream Vera Sans in rcParams['font.sans-serif']:
 rcParams['font.sans-serif'].remove(Bitstream Vera Sans)

 # after appending the offending font even at the end of the list (by
 uncommenting the following line), ďěňřťů are not displayed again
 # rcParams['font.sans-serif'].append(Bitstream Vera Sans)

 import pylab
 pylab.title(uabcd áčďéěíňóřšťúůýž äöüß ê xyz)
 pylab.show()
 ==

 Is there something special in the resolution of the font items in
  rcParams?
 This individual issue seems to be fixed with removing the single font,
 but I'd like to understand this more generally, as the installed fonts
 on different computers differ.

 Thanks in advance
   Vlastimil Brom


 --
 Rapidly troubleshoot problems before they affect your business. Most IT
 organizations don't have a clear picture of how application performance
 affects their revenue. With AppDynamics, you get 100% visibility into your
 Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics
 Pro!
 http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] segmentation fault and / or bus error with script that cranks out plots with TkAgg backend

2014-01-27 Thread Phil Elson
This is a bit of a surprise. Sounds like it could have something to do with
matplotlib's build, or that of some of its dependencies, so may need
reporting to Gentoo once we've dug a little further. It could be a really
tricky one to diagnose without being able to reproduce locally, but - is
the loop significant? Does the number of figures matter? Essentially, try
to boil it down to as little code as possible (do you need to produce a
line plot to reproduce etc.).

Cheers,


On 6 January 2014 22:18, tenspd137 . dcday...@gmail.com wrote:

 Hi all,

 I am running a script that cranks out multiple plots in a loop.  The
 script has plt.show() as the very last line as I think you are supposed to
 do.  All plots show up, but I get a seg fault (sometimes a bus error - I
 haven't figured why it occasionally does that) when I close the last plot
 and the script exits.  I was wondering if someone could help me figure out
 what info to grab to determine what is causing it.  I use gentoo and
 recently did an upgrade world, so I am guessing some new library is not
 playing nicely as this always seemed to work before.  Also, when I switch
 to Qt4Agg backend,
 everything works as expected, but if I can help iron out a bug, I would
 like to - I really think that matplotlib is an excellent piece of software.

 Pertinent info:

 uname -a:
 Linux dayd 3.10.15-gentoo #6 SMP Sat Dec 14 15:53:47 MST 2013 x86_64
 Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz GenuineIntel GNU/Linux

 Matplotlib version - 1.3.1

 matplotlibrc:
 backend: TkAgg (Qt4Agg works as expected)
 interactive: False

 because it segfaults
  python3.3 testplot.py --verbose-helpful  output.txt
 outputs nothing

 gcc --version:
 gcc (Gentoo 4.8.2 p1.0, pie-0.5.8) 4.8.2
 Copyright (C) 2013 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 script to reproduce the problem:

 import sys
 import matplotlib.pyplot as plt

 def main():
 for x in range(6):
 plt.figure()
 plt.title(x)
 plt.plot([1,1],[1,1],'r.')
 plt.show()

 if __name__ == __main__:
 sys.exit(main())

 I found some instructions on how to get debug info when you install a
 package in gentoo.  If anyone else can recreate this or need some more info
 from me - please let me know.  I will do what I can.

 Thanks!





 --
 Rapidly troubleshoot problems before they affect your business. Most IT
 organizations don't have a clear picture of how application performance
 affects their revenue. With AppDynamics, you get 100% visibility into your
 Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics
 Pro!
 http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Clipping a plot inside a polygon

2013-09-03 Thread Phil Elson
Sadly each keyword is handled manually in lib/matplotlib/contour.py L690
which is why you can set keywords which are completely ignored without
getting any warning/exception.
We could add a set_clip_path keyword in that constructor, but in truth the
whole keyword handling approach in contour.py could do with an overhaul.

Looking at it, we could equally add the appropriate method on the
ContourSet object to control the clipping, which would just do the
iteration over the collections as I did in my example.

Anyway, glad my example was helpful,

Cheers,

Phil




On 2 September 2013 21:33, Alex Goodman alex.good...@colostate.edu wrote:

 Actually, sorry for the triple post, but is there a reason why we can't do
 something like pass in the keyword arguments directly from the call to
 contourf when instantiating each collection? Then the keyword arguments for
 contourf (and ContourSet) could be used for the collections directly,
 including clip_path. I know a similar approach is taken for the keyword
 arguments in plot, since those can be used to modify the properties of each
 Line2D instance.

 Thanks,
 Alex


 On Mon, Sep 2, 2013 at 1:09 PM, Alex Goodman 
 alex.good...@colostate.eduwrote:

 Actually, it seems I have partially answered my own question. Since I am
 calling axis('off'), I do not notice the effect of clipping the other
 artists since I made a call to axis('off'). Without it the spines and axes
 rectangle are still removed but the ticks are still visible. I suppose this
 is fine for my own purposes of contouring within one country on a map since
 I would want to use something like axis('off') anyway, but then it would
 not work if I wanted to use the axes background. Another approach I have
 tried is to use the clip_path keyword in the plotting functions themselves,
 which works for imshow and pcolor, but not contourf. Any other ideas?

 Alex


 On Mon, Sep 2, 2013 at 12:18 PM, Alex Goodman alex.good...@colostate.edu
  wrote:

 Hi Phil,

 Thanks, that is more or less what I was looking for. However, I still
 think that generalizing this approach for other types of plotting functions
 that don't return artists directly would be useful. Your solution gave me
 another idea for doing this, which would be to iterate through all of the
 child artists on the axes using the get_children() method and then calling
 set_clip_path() on each artist. This would make the methodology very
 general but I am not sure if there are any negative side effects to
 resetting the clip path on the other artists besides the PatchCollections.
 I modified my simple example script and it seems to work well for
 contourf(), pcolor(), and imshow():

 import numpy as np
 import matplotlib.pyplot as plt
 from matplotlib.patches import RegularPolygon

 data = np.arange(100).reshape(10, 10)
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.contourf(data)
 poly = RegularPolygon([ 0.5,  0.5], 6, 0.4, fc='none',
 ec='k', transform=ax.transAxes)
 for artist in ax.get_children():
 artist.set_clip_path(poly)

 ax.add_patch(poly)
 ax.set_aspect('equal')
 ax.axis('off')
 plt.show()


 Also, I appreciated the cartopy example. I think it has the potential to
 be a good basemap replacement thanks to the more robust shapefile support
 (which you have very elegantly shown), and I hope the development goes well.

 Thanks,
 Alex


 On Mon, Sep 2, 2013 at 2:33 AM, Phil Elson pelson@gmail.com wrote:

 Great question. The contour set itself does not have a set_clip_path
 method but you can iterate over each of the contour collections and set
 their respective clip paths, i.e.:

 cs = plt.contourf(data)
 for collection in cs.collections:
 collection.set_clip_path(poly)

 Of course, you can use this approach in either Basemap or cartopy, but
 I've put together an example of doing it in cartopy to demonstrate the neat
 Shapely integration: http://nbviewer.ipython.org/6410510

 HTH,

 Phil


 On 2 September 2013 05:40, Alex Goodman alex.good...@colostate.eduwrote:

 Hi all,

 I want to be able to plot data on maps (using basemap or cartopy)
 inside specific regions, eg a single state, province or country. A similar
 question was asked a long time ago on the mailing list and the suggested
 solution back then was to read the bounding polygon from a shapefile and
 then check if each individual point was inside that polygon. Currently I
 have no problem doing this if I use matplotlib.path.Path.contains_points()
 to mask the original data array, but the disadvantage to this solution is
 that it is very slow. Another solution that I have discovered recently is
 to use the set_clip_path() method for artists. In addition to being much
 faster, this also makes the areas near the polygon boundary look much
 smoother since the actual items being clipped are individual pixels and 
 not
 data points.

 Here is an example script that plots an image via imshow, but the only
 part of the image that gets shown is inside the hexagon.

 import numpy as np

Re: [Matplotlib-users] Clipping a plot inside a polygon

2013-09-02 Thread Phil Elson
Great question. The contour set itself does not have a set_clip_path method
but you can iterate over each of the contour collections and set their
respective clip paths, i.e.:

cs = plt.contourf(data)
for collection in cs.collections:
collection.set_clip_path(poly)

Of course, you can use this approach in either Basemap or cartopy, but I've
put together an example of doing it in cartopy to demonstrate the neat
Shapely integration: http://nbviewer.ipython.org/6410510

HTH,

Phil


On 2 September 2013 05:40, Alex Goodman alex.good...@colostate.edu wrote:

 Hi all,

 I want to be able to plot data on maps (using basemap or cartopy) inside
 specific regions, eg a single state, province or country. A similar
 question was asked a long time ago on the mailing list and the suggested
 solution back then was to read the bounding polygon from a shapefile and
 then check if each individual point was inside that polygon. Currently I
 have no problem doing this if I use matplotlib.path.Path.contains_points()
 to mask the original data array, but the disadvantage to this solution is
 that it is very slow. Another solution that I have discovered recently is
 to use the set_clip_path() method for artists. In addition to being much
 faster, this also makes the areas near the polygon boundary look much
 smoother since the actual items being clipped are individual pixels and not
 data points.

 Here is an example script that plots an image via imshow, but the only
 part of the image that gets shown is inside the hexagon.

 import numpy as np
 import matplotlib.pyplot as plt
 from matplotlib.patches import RegularPolygon

 data = np.arange(100).reshape(10, 10)
 fig = plt.figure()
 ax = fig.add_subplot(111)
 im = ax.imshow(data)
 poly = RegularPolygon([ 0.5,  0.5], 6, 0.4, fc='none',
   ec='k', transform=ax.transAxes)
 im.set_clip_path(poly)
 ax.add_patch(poly)
 ax.axis('off')
 plt.show()

 While this does seem like an ideal solution, it doesn't work for every
 type of plot. The most notable example is contourf(). It returns a
 QuadContourSet instance which does not inherit from Artist, so it does not
 contain the set_clip_path() method. My main question is whether there is a
 mechanism in matplotlib that can convert something like a QuadContourSet
 into an image so I can make use of this solution for contourf() as well. Or
 better yet, is there perhaps another artist within the axes that I can use
 the set_clip_path() method for and still get what I want?

 Thanks,
 Alex
 --
 Alex Goodman
 Graduate Research Assistant
 Department of Atmospheric Science
 Colorado State University


 --
 Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
 Discover the easy way to master current and previous Microsoft technologies
 and advance your career. Get an incredible 1,500+ hours of step-by-step
 tutorial videos with LearnDevNow. Subscribe today and save!
 http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] mpl-1.2.1: Speedup code by removing .startswith() calls and some for loops

2013-08-09 Thread Phil Elson
Hi Martin,

Thanks for this - we are really interested in speeding up the scatter and
barchart plotting with large data sets. In fact, we've done some work (
https://github.com/matplotlib/matplotlib/pull/2156) recently to make the
situation better.

I'd really like to review these changes (against matplotlib master), and
the best possible solution to doing this is if you were to submit a pull
request. If the changes you have made are logically seperable, then I'd
encourage you to make a few PRs, but otherwise, a single PR with all of
these changes would be great.

Would you mind turning these patches into PR(s)? (
https://github.com/matplotlib/matplotlib/compare/)

Thanks!

Phil


On 9 August 2013 12:53, Martin Mokrejs mmokr...@fold.natur.cuni.cz wrote:

 Hi,
   I am drawing some barcharts and scatter plot and the speed for rendering
 is awful once you have
 100 000 of dots. I ran python profiler which lead me to .startswith()
 calls and some for loops
 which append do a list repeatedly. This parts could be still sped up I
 think but a first attempt
 is here:


 UNPATCHED 1.2.1

 real23m17.764s
 user13m25.880s
 sys 3m37.180s


 PATCHED:

 real6m59.831s
 user5m18.000s
 sys 1m40.360s



 The patches are simple and because I see elsewhere in the code list
 expansions I do not see any
 problems with backwards compatibility (new new python language features
 are required).

 Hope this helps,
 Martin


 --
 Get 100% visibility into Java/.NET code with AppDynamics Lite!
 It's a free troubleshooting tool designed for production.
 Get down to code-level detail for bottlenecks, with 2% overhead.
 Download for free and get started troubleshooting in minutes.
 http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug in cbook.exception_to_str() (mpl 1.2)

2013-05-31 Thread Phil Elson
Agreed. I've seen this a couple of times but never reproduced it so
elegantly. Would you mind opening up an issue on github - this is
definitely a bug (http://matplotlib.org/faq/troubleshooting_faq.html).

Thanks!


P.S. Welcome to the mailinglist :-)


On 31 May 2013 16:02, Skip Montanaro s...@pobox.com wrote:

 I'm not sure of the correct protocol (I just subscribed to report this
 problem), but the documentation said to report bugs here, and I saw no
 mention of this in Google searches of the list archives.

 The exception_to_str() function was changed between mpl 1.1 and 1.2.
 In my installation I show it going from this:

 def exception_to_str(s = None):

 sh = StringIO.StringIO()
 if s is not None: print sh, s
 traceback.print_exc(file=sh)
 return sh.getvalue()

 to this:

 def exception_to_str(s=None):

 sh = io.StringIO()
 if s is not None:
 print(s, file=sh)
 traceback.print_exc(file=sh)
 return sh.getvalue()

 At first glance, the change seems innocuous enough, but I think it
 introduced an error.  (It appears that mpl 1.2 is supposed to work on
 Python 2.7 and 3.x.) From a thread I started on comp.lang.python
 (http://thread.gmane.org/gmane.comp.python.general/733938), it appears
 that io.StringIO instances only accept Unicode strings as input.
 Unless v 1.2 is only supposed to run on Python 3 (that doesn't seem to
 be the case), you need to do something to convert the traceback
 module's output to Unicode before feeding to the io.StringIO object.

 Here's a simple demonstration of the problem:

 % python2.7
 Python 2.7.5+ (2.7:93eb15779050, May 30 2013, 15:27:39)
 [GCC 4.4.6 [TWW]] on linux2
 Type help, copyright, credits or license for more information.
  import traceback, StringIO, io
  s1 = StringIO.StringIO()
  traceback.print_stack(file=s1)
  print repr(s1.getvalue())
 '  File stdin, line 1, in module\n'
 
  s2 = io.StringIO()
  traceback.print_stack(file=s2)
 Traceback (most recent call last):
   File stdin, line 1, in module
   File /home/skipm/x86_64-linux3.1/lib/python2.7/traceback.py, line
 269, in print_stack
 print_list(extract_stack(f, limit), file)
   File /home/skipm/x86_64-linux3.1/lib/python2.7/traceback.py, line
 23, in print_list
 '  File %s, line %d, in %s' % (filename,lineno,name))
   File /home/skipm/x86_64-linux3.1/lib/python2.7/traceback.py, line
 13, in _print
 file.write(str+terminator)
 TypeError: unicode argument expected, got 'str'

 Skip Montanaro
 s...@pobox.com


 --
 Get 100% visibility into Java/.NET code with AppDynamics Lite
 It's a free troubleshooting tool designed for production
 Get down to code-level detail for bottlenecks, with 2% overhead.
 Download for free and get started troubleshooting in minutes.
 http://p.sf.net/sfu/appdyn_d2d_ap2
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with 2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Affine2D on scatter

2013-04-05 Thread Phil Elson
Thanks Derek  John.

Very strange. Here's my setup:

 import matplotlib
 matplotlib.__version__
'1.2.0'
 matplotlib.get_backend()
'TkAgg'


Would you mind providing all of the relevant details suggested in
http://matplotlib.org/faq/troubleshooting_faq.html#troubleshooting, along
with the code to reproduce the problem in a new github issue?

Once I have all of the necessary details, I'd be happy to have a look into
this to see if I can find a solution.

Cheers,

Phil



On 5 April 2013 02:02, John Gleeson jdglee...@mac.com wrote:


 On 2013-04-04, at 10:51 AM, Derek Thomas wrote:

  ...screen capture of the display...
 grab.tiff


 Derek,

 I just tried Phil's version of the code on my Mac (MP 1.2.0), and I see
 exactly the same problem as in your grab.tiff. This is using the default
 TkAgg backend.

 I happen to have built MP 1.2.0 with the Qt4 backend option. When I
 prepend the lines

 from matplotlib import use
 use(QT4Agg)

 to use Qt4, I get the expected (correct) display output.

 Apparently this is a bug somewhere in the chain TkAgg/Tkinter/Tk.

 John


--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Affine2D on scatter

2013-04-04 Thread Phil Elson
Hi Derek,

What are we looking at here?

The following code:

import matplotlib.pyplot as plt
import matplotlib.transforms as mtrans
import numpy as np

plt.figure()
ax = plt.subplot(111)
base_trans = ax.transData
mtx = np.array([[1,1,0],
[0,1,0],
[0,0,1]])
tr = mtrans.Affine2D(matrix=mtx) + base_trans

plt.plot([1,2,3], [1,2,3], 'gray', transform=tr)
plt.scatter([1,2,3], [1,2,3], c='k', marker='D', transform=tr)
plt.show()

produces the following plot on v1.2.0:
[image: Inline images 1]
Is this unexpected or are you getting a different result to me?

Regards,



On 4 April 2013 17:06, Derek Thomas derekctho...@gmail.com wrote:

 I posted a related question on stackoverflow
 (
 http://stackoverflow.com/questions/15815862/apply-affine-transform-to-quiver-in-python-matplotlib
 )
 but I've produced a simple enough example with strange results that I
 think it merits attention here.  I'm trying to apply affine transforms
 to quiver and scatter plots.  In all cases that I've considered, the
 scatter and quiver plots transform opposite the regular plot.  Here's
 a minimal case:

 import matplotlib as mpl
 from pylab import figure, subplot, plot, scatter, show, axis

 figure()
 ax = subplot(111)
 base_trans = ax.transData
 tr =  mpl.transforms.Affine2D(matrix =
 array([[1,1,0],[0,1,0],[0,0,1]])) + base_trans


 plot( [1,2,3], [1,2,3], 'k.', transform = tr )
 scatter( [1,2,3], [1,2,3], c = 'k', marker = 'D', transform = tr )
 axis([0,7,0,7])
 show()

 Thanks,

 Derek


 --
 Minimize network downtime and maximize team effectiveness.
 Reduce network management and security costs.Learn how to hire
 the most talented Cisco Certified professionals. Visit the
 Employer Resources Portal
 http://www.cisco.com/web/learning/employer_resources/index.html
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

figure_1.png--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] MonthLocator doesn't honour rrule bymonthday -1 value for last day of month

2013-04-04 Thread Phil Elson
Hi Mark,

Thanks for persevering :-)

What is it you want to achieve? Is it that you just want the last day of
each month as the located value?

Changing your locator to:

ax.xaxis.set_major_locator(MonthLocator(bymonthday = -1))

Seems to do the trick for me (I've never looked at the mpl date magic, so I
can give no guarantees).

HTH,




On 4 April 2013 17:18, Mark Lawrence breamore...@yahoo.co.uk wrote:

 On 01/04/2013 14:48, Mark Lawrence wrote:
  On 29/03/2013 15:49, Mark Lawrence wrote:
  Hi all,
 
 From http://labix.org/python-dateutil
 
  To generate a rrule for the use case of a date on the specified day of
  the month, unless it is beyond the end of month, in which case it will
  be the last day of the month use the following:
 
  rrule(MONTHLY, bymonthday=(some_day, -1), bysetpos=1)
 
  This will generate a value for every calendar month regardless of the
  day of the month it is started from.
 
  Using bymonthday with MonthLocator gives ticks on the day given and the
  last day of the month, which looks extremely ugly.  Code below
 demonstrates.
 
  from dateutil.rrule import *
  import datetime
  import matplotlib.pyplot as plt
  from matplotlib.ticker import FormatStrFormatter, MultipleLocator
  from matplotlib.dates import DateFormatter, MonthLocator, DayLocator
 
  start = datetime.date(2013, 3, 29)
  until = datetime.date(2014, 3, 29)
  dates = rrule(MONTHLY, bymonthday=(29, -1), bysetpos=1, until=until)
  for d in dates:print(d)
 
  dates = [start, until]
  values = [0, 1]
  plt.ylabel('Balance')
  plt.grid()
  ax = plt.subplot(111)
  plt.plot_date(dates, values, fmt = 'rx-')
  ax.xaxis.set_major_locator(MonthLocator(bymonthday = (dates[0].day,
 -1)))
  ax.xaxis.set_major_formatter(DateFormatter('%d/%m/%y'))
  ax.yaxis.set_major_formatter(FormatStrFormatter('£%0.2f'))
  ax.yaxis.set_minor_locator(MultipleLocator(5))
  plt.axis(xmin=dates[0], xmax=dates[-1])
  plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10)
  plt.setp(plt.gca().get_yticklabels(), fontsize = 10)
  plt.show()
 
 
  Seems an apt date to realise that I didn't say much :(
 
  Assuming that I'm correct would you like an issue raised on the bug
  tracker?  If not please correct the mistake I've made, presumably in
  reading the docs, which I think are excellent by the way.
 

 Anybody?

 --
 If you're using GoogleCrap™ please read this
 http://wiki.python.org/moin/GoogleGroupsPython.

 Mark Lawrence



 --
 Minimize network downtime and maximize team effectiveness.
 Reduce network management and security costs.Learn how to hire
 the most talented Cisco Certified professionals. Visit the
 Employer Resources Portal
 http://www.cisco.com/web/learning/employer_resources/index.html
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with importing LaTeX package amsmath and $\text{}$

2013-03-30 Thread Phil Elson
Doesn't look like you're using math.usetex  therefore are not actually
using latex, but mpl's stripped down tex implementation.

Try setting usetex to True, or alternatively I think you could use \mathrm
instead of \text to get non mathematical text.

HTH


On 30 March 2013 11:43, Pawel Chojnacki chojnacki.pa...@linux.com wrote:

 Hello,

 I've been having some troubles with LaTeX in matplotlib. My example script:

 #!/usr/bin/env python2
 #-*- coding: utf-8 -*-

 __author__ = 'Pawel Chojnacki'
 __copyright__ ='Copyleft 2013 Pawel Chojnacki'
 __version__ = '1.0'
 __date__ = '29-03-2013'
 __license__ = 'GPLv3'

 import numpy as np
 import matplotlib as mpl # Zmiana ustawien LaTeXa
 mpl.rcParams['text.latex.preamble'].append(r'\usepackage{amsmath}')
 #~ mpl.rcParams['text.latex.preamble'] = r'\usepackage{amsmath}'
 #~ mpl.rcParams['text.latex.preamble']=[r\usepackage{amsmath}]
 #~ mpl.rcParams['math.usetex'] = True
 print mpl.rcParams['text.latex.preamble']
 import pylab as py

 py.axhspan(8400,8730,alpha=0.15)
 py.title(u'Wyniki eksperymentu pomiaru gęstości ciała
 stałego\n',size='large',family='serif')
 py.ylabel((u'Gęstość ciała stałego ' +
 r'$\frac{kg}{m^3}$'),size='large',family='serif')
 #~ py.ylabel((r'$\text{lol}$'),size='large',family='serif')
 py.ylabel((r'$\text{lol}$'),size='large',family='serif')
 py.xlabel(u'Metoda pomiaru',size='large',family='serif')
 py.grid(True)
 py.show()

 Gives me the following output:

 ['', '\\usepackage{amsmath}']
 Exception in Tkinter callback
 Traceback (most recent call last):
   File /usr/lib/python2.7/lib-tk/Tkinter.py, line 1437, in __call__
 return self.func(*args)
   File
 /usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py, line
 236, in resize
 self.show()
   File
 /usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py, line
 239, in draw
 FigureCanvasAgg.draw(self)
   File /usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py,
 line 421, in draw
 self.figure.draw(self.renderer)
   File /usr/lib/pymodules/python2.7/matplotlib/artist.py, line 55, in
 draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File /usr/lib/pymodules/python2.7/matplotlib/figure.py, line 898, in
 draw
 func(*args)
   File /usr/lib/pymodules/python2.7/matplotlib/artist.py, line 55, in
 draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File /usr/lib/pymodules/python2.7/matplotlib/axes.py, line 1997, in
 draw
 a.draw(renderer)
   File /usr/lib/pymodules/python2.7/matplotlib/artist.py, line 55, in
 draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File /usr/lib/pymodules/python2.7/matplotlib/axis.py, line 1054, in
 draw
 self.label.draw(renderer)
   File /usr/lib/pymodules/python2.7/matplotlib/artist.py, line 55, in
 draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File /usr/lib/pymodules/python2.7/matplotlib/text.py, line 526, in draw
 bbox, info = self._get_layout(renderer)
   File /usr/lib/pymodules/python2.7/matplotlib/text.py, line 309, in
 _get_layout
 ismath=ismath)
   File /usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py,
 line 193, in get_text_width_height_descent
 self.mathtext_parser.parse(s, self.dpi, prop)
   File /usr/lib/pymodules/python2.7/matplotlib/mathtext.py, line 2999,
 in parse
 box = self._parser.parse(s, font_output, fontsize, dpi)
   File /usr/lib/pymodules/python2.7/matplotlib/mathtext.py, line 2357,
 in parse
 self._expression.parseString(s)
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 1048,
 in parseString
 loc, tokens = self._parse( instring, 0 )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 981,
 in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 924,
 in _parseNoCache
 loc,tokens = self.parseImpl( instring, preloc, doActions )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 2559,
 in parseImpl
 return self.expr._parse( instring, loc, doActions, callPreParse=False )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 981,
 in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 924,
 in _parseNoCache
 loc,tokens = self.parseImpl( instring, preloc, doActions )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 2307,
 in parseImpl
 loc, exprtokens = e._parse( instring, loc, doActions )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 981,
 in _parseCache
 value = self._parseNoCache( instring, loc, doActions, callPreParse )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 924,
 in _parseNoCache
 loc,tokens = self.parseImpl( instring, preloc, doActions )
   File /usr/lib/pymodules/python2.7/matplotlib/pyparsing.py, line 2672,
 in parseImpl
 loc, tokens = 

Re: [Matplotlib-users] Feedback on an implementation of a matlab-ish datacursor

2013-03-13 Thread Phil Elson
Thanks for this Joe, mpldatacursor looks like an excellent piece of work -
I for one will be installing and using it regularly.

Thanks for sharing!





On 13 March 2013 03:58, Joe Kington joferking...@gmail.com wrote:

 I recently got around to polishing up a snippet I've been using for quite
 awhile.  https://github.com/joferkington/mpldatacursor/  and I was hoping
 to get some feeding on the current implementation.

 mpldatacursor allows a user to easily click on an artist and display a
 customizable, interactive pop-up box displaying information about the
 selected artist (e.g. x  y, label, z for images and collections, etc).
 It's a stand-alone module (and in pypi), but you could also just download
 the examples directory from github and copy the mpldatacursor.py file into
 it to try things out.

 A few key questions:

1. Is this something that anyone else finds useful?

2. Does it seem intuitive?

3. Does the implementation seem flexible enough for most needs? (Note
that any additional kwargs are passed on to annotate to create the data
cursor, so the appearance of the box is customizable through annotation
kwargs.)

4. Are there any obvious features missing?

5. Any suggestions? (especially better name suggestions...)

 If it is something that other people find useful, I'd be happy to submit a
 pull request to incorporate it into matplotlib.  (If I did, it would
 probably be best to drop the HighlightDataCursor class, as its limited in
 what it can do.)

 Thanks a bunch!

 -Joe


 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_mar
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib multiple windows comparison

2013-03-12 Thread Phil Elson
Hi Sudheer,

Try the interactive mode (
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.ion):


 import matplotlib.pyplot as plt
 plt.ion()
 plt.plot(range(10))
[matplotlib.lines.Line2D object at 0x1c565d0]

**a figure pops up here and hands you back the python command line**



Regards,




On 12 March 2013 00:04, Sudheer Joseph sudheer.jos...@yahoo.com wrote:

 Dear experts,
 Is there a way to get back to the prompt after a plot is made and
 displayed with out closing the plot?
 The objective is to compare to plots or check some aspect about the plot
 made from the loaded variables. This is the standard behavior of matlab
 after plotting we get the prompt and we can make another plot if we want to
 compare 2. I know there is subplot option but it will be of small size if I
 need to make a spatial map at to time intervals and compare. The detail of
 my matplotlib is below

 
 I use Ubuntu 12.04 64 bit version
 and

 In [3]: matplotlib.get_backend()
 Out[3]: 'WXAgg'

 In [4]: matplotlib.__version__
 Out[4]: '1.2.0'

 with best regards,
 Sudheer
 ***
 Sudheer Joseph
 Indian National Centre for Ocean Information Services
 Ministry of Earth Sciences, Govt. of India
 POST BOX NO: 21, IDA Jeedeemetla P.O.
 Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
 Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
 E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com
 Web- http://oppamthadathil.tripod.com
 ***
   --
 *.*



 --
 Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
 Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the
 endpoint security space. For insight on selecting the right partner to
 tackle endpoint security challenges, access the full report.
 http://p.sf.net/sfu/symantec-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] basemap and imshow at high latitudes

2013-03-12 Thread Phil Elson
Hi Mike,

Do you have any code or an image to show the problem?

Cheers,


On 11 March 2013 20:44, Hearne, Mike mhea...@usgs.gov wrote:

 I have an issue with basemap.imshow() at higher latitudes - namely the
 image (high-res topography, in this case) becomes distorted with
 respect to the coastlines the higher I go.I assume it has to do
 with the image pixels becoming more non-square the higher I go in
 latitude.

 I found this discussion:
 http://matplotlib.1069221.n5.nabble.com/Basemap-and-imshow-td14115.html

 where Jeff indicates that the user is using a non-rectangular map
 projection.  I'm thinking that is perhaps my problem (I'm using
 Transverse Mercator), but I'm not sure which projections Basemap
 supports that *are* rectangular.

 Or perhaps it's something else entirely.

 Any hints?

 Thanks,

 Mike Hearne


 --
 Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
 Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the
 endpoint security space. For insight on selecting the right partner to
 tackle endpoint security challenges, access the full report.
 http://p.sf.net/sfu/symantec-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting with WxAgg backend hangs

2013-03-12 Thread Phil Elson
I don't know of any reason why one shouldn't be able to use the wxAgg
backend interactively.
This looks like a bug to me. Would you mind adding this as an issue on the
github issue tracker?

Thanks,


On 11 March 2013 19:06, Brendan Barnwell brenb...@brenbarn.net wrote:

 I'm 64-bit Windows 7 with matplotlib 1.2.0 and WxPython 2.8.12.1.
  I
 was fiddling around with some of the different backends to see what
 they look like and I found that the WxAgg backend doesn't work:

 Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit
 (AMD64)] on win
 32
 Type help, copyright, credits or license for more information.
   import matplotlib as mpl
   mpl.use('WxAgg')
   from matplotlib import pyplot
   pyplot.ion()
   pyplot.plot([1, 2, 3])
 [matplotlib.lines.Line2D object at 0x06757DA0]
  

 When I do the plot, the figure windows appears, but it's blank
 (without even a proper blank background, just a white area) and
 immediately shows Not responding.  I have to kill the window, and
 doing so crashes the Python session.  However, it works without the
 ion() call: I can then call show() and see the plot fine.

 I have wxPython working fine in other apps.  In fact, what's
 especially odd is that I actually have an app that directly uses
 FigureCanvasWxAgg to embed matplotlib graphs in a GUI, and this seems
 to work fine.  So it seems the problem is somehow in matplotlib's own
 management of the interactive figure window.

 There was a previous question about a similar WxAgg issue on the
 list
 (

 http://matplotlib.1069221.n5.nabble.com/trouble-with-show-not-drawing-in-interactive-mode-w-WxAgg-td39110.html
 ), but there was no real answer: the poster just decided not to use
 WxAgg.  But aren't we really supposed to be able to use WxAgg
 interactively?

 Thanks,
 --
 Brendan Barnwell
 Do not follow where the path may lead.  Go, instead, where there is
 no path, and leave a trail.
 --author unknown


 --
 Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
 Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the
 endpoint security space. For insight on selecting the right partner to
 tackle endpoint security challenges, access the full report.
 http://p.sf.net/sfu/symantec-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib multiple windows comparison

2013-03-12 Thread Phil Elson
I hadn't spotted you were using the WxAgg backend too - this looks like the
same bug that Brendan reported yesterday.

The *easiest* solution would be to use another back-end until this is
fixed. Do you have 'TkAgg' available? I currently do not have a wx
installation to hand to try out any workarounds at the moment.

Regards,


On 12 March 2013 14:00, Sudheer Joseph sudheer.jos...@yahoo.com wrote:

 Thank you Phil,
 But I had tried it earlier after seeing a
 another mail thread. I get command prompt but no figure pops up.

 In [3]: import matplotlib.pyplot as plt

 In [4]: plt.ion()

 In [5]: plt.plot(range(10))
 Out[5]: [matplotlib.lines.Line2D at 0x410f250]

 In [6]:

  Any way out??
 with best regards,
 Sudheer
 ***
 Sudheer Joseph
 Indian National Centre for Ocean Information Services
 Ministry of Earth Sciences, Govt. of India
 POST BOX NO: 21, IDA Jeedeemetla P.O.
 Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
 Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
 E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com
 Web- http://oppamthadathil.tripod.com
 ***
   --
 *From:* Phil Elson pelson@gmail.com
 *To:* Sudheer Joseph sudheer.jos...@yahoo.com
 *Cc:* matplotlib-users@lists.sourceforge.net 
 matplotlib-users@lists.sourceforge.net
 *Sent:* Tuesday, 12 March 2013 3:08 PM
 *Subject:* Re: [Matplotlib-users] matplotlib multiple windows comparison

 Hi Sudheer,

 Try the interactive mode (
 http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.ion):


  import matplotlib.pyplot as plt
  plt.ion()
  plt.plot(range(10))
 [matplotlib.lines.Line2D object at 0x1c565d0]

 **a figure pops up here and hands you back the python command line**

 

 Regards,




 On 12 March 2013 00:04, Sudheer Joseph sudheer.jos...@yahoo.com wrote:

 Dear experts,
 Is there a way to get back to the prompt after a plot is made and
 displayed with out closing the plot?
 The objective is to compare to plots or check some aspect about the plot
 made from the loaded variables. This is the standard behavior of matlab
 after plotting we get the prompt and we can make another plot if we want to
 compare 2. I know there is subplot option but it will be of small size if I
 need to make a spatial map at to time intervals and compare. The detail of
 my matplotlib is below

 
 I use Ubuntu 12.04 64 bit version
 and

 In [3]: matplotlib.get_backend()
 Out[3]: 'WXAgg'

 In [4]: matplotlib.__version__
 Out[4]: '1.2.0'

 with best regards,
 Sudheer
 ***
 Sudheer Joseph
 Indian National Centre for Ocean Information Services
 Ministry of Earth Sciences, Govt. of India
 POST BOX NO: 21, IDA Jeedeemetla P.O.
 Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
 Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
 E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com
 Web- http://oppamthadathil.tripod.com
 ***
   --
 *.*



 --
 Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
 Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the
 endpoint security space. For insight on selecting the right partner to
 tackle endpoint security challenges, access the full report.
 http://p.sf.net/sfu/symantec-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users





--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] why does transform=None cause a patch not to be shown?

2013-03-07 Thread Phil Elson
The key thing to know about normal Artists is that they can have *just
one*transform (to take an artist's coordinates into pixel space), so
whilst
there is no error when you do it, it is not possible to add the same artist
to multiple Axes and have the desired effect.

To answer your question, try creating two Rectangles and adding one to each
of your Axes.

HTH
--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] View datetime corresponding to x coordinate of cursor

2013-03-05 Thread Phil Elson
Sounds like a nice feature if it doesn't already exist. At first glance,
I'd say this was a good candidate for the low-hanging fruit label (
https://github.com/matplotlib/matplotlib/issues?labels=low+hanging+fruitpage=1state=open)
for which we have tickets which have a low matplotlib contribution
experience barrier and a relatively good return on investment (in terms of
time spent).

Please feel free to create an issue on the github tracker  if you're keen,
I'd encourage you to have a go at implementing it.

Cheers,


On 4 March 2013 19:34, Paul Hobson pmhob...@gmail.com wrote:


 On Mon, Mar 4, 2013 at 11:23 AM, William Furnass w...@thearete.co.ukwrote:

 Several backends will show you the x and y float values that
 correspond to the current cursor position in a plot() but are there
 backends that show the _datetime_ corresponding to the x position if
 the plotted data is a time series (e.g. a pandas.Series object with a
 DatetimeIndex)?

 Regards,

 Will


 Will,

 You can use the `format_coord` method of the axes objects to do just this.
 -paul


 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_feb
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] depth longitude plot

2013-03-02 Thread Phil Elson
Perhaps something like:


from matplotlib import pyplot as plt

from netCDF4 import Dataset

import numpy as np



url=*'
http://www.marine.csiro.au/dods/nph-dods/dods-data/climatology-netcdf/levitus_monthly_temp_98.nc
'*

ds = Dataset(url)



temp = ds.variables[*'TEMP'*]

lats = ds.variables[*'**lat**'*]

lons = ds.variables[*'**lon**'*]

depths = ds.variables[*'z'*]



# filter all but one latitude

lat_index = np.where(lats[:] == 0.5)[0][0]

lats = lats[lat_index]


# filter a range of longitudes

lon_lower_index = np.where(lons[:] == 44.5)[0][0]

lon_upper_index = np.where(lons[:] == 100.5)[0][0]

lons = lons[lon_lower_index:lon_upper_index]


temp = temp[0, :, lat_index, lon_lower_index:lon_upper_index]



plt.pcolormesh(lons, depths[:], temp)

plt.gca().invert_yaxis()


plt.show()






The indexing approach used here is quite flakey, so I certainly wouldn't
use this in anything operational.

Hope this helps,

Phil
attachment: figure_1.png--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] depth longitude plot

2013-03-02 Thread Phil Elson
Incidentally, if you wanted to do this a little more expressively than
indexing, you could look into using iris (
http://scitools.org.uk/iris/docs/latest/index.html). It doesn't currently
support DAP, but if you had the NetCDF file (from *
http://www.marine.csiro.au/dods-data/climatology-netcdf/levitus_monthly_temp_98.nc
*) you would do:

import iris

import iris.quickplot as qplt

import matplotlib.pyplot as plt



temp_cube = iris.load_cube(*'levitus_monthly_temp_98.**nc**'*)


# Sort out some of the bad metadata. Firstly, set the unit,

# secondly rename the dimension 1 coordinate to 'depth'.

temp_cube.unit = *'C'*

temp_cube.coord(dimensions=1, dim_coords=True).rename(*'depth'*)


# Extract a spatial sub-domain.

sub_temp_cube = temp_cube.extract(iris.Constraint(latitude=0.5,

  longitude=lambda v: 45  v  100))


# Iterate over all the depth-longitude sections (in this case it

# iterates over time)

for cross_sect_cube in sub_temp_cube.slices([*'depth'*, *'longitude'*]):

qplt.pcolormesh(cross_sect_cube)

plt.gca().invert_yaxis()

plt.show()

break

[image: Inline images 1]



Hope that helps!

Phil








On 2 March 2013 09:37, Phil Elson pelson@gmail.com wrote:

 Perhaps something like:


 from matplotlib import pyplot as plt

 from netCDF4 import Dataset

 import numpy as np



 url=*'
 http://www.marine.csiro.au/dods/nph-dods/dods-data/climatology-netcdf/levitus_monthly_temp_98.nc
 '*

 ds = Dataset(url)



 temp = ds.variables[*'TEMP'*]

 lats = ds.variables[*'**lat**'*]

 lons = ds.variables[*'**lon**'*]

 depths = ds.variables[*'z'*]



 # filter all but one latitude

 lat_index = np.where(lats[:] == 0.5)[0][0]

 lats = lats[lat_index]


 # filter a range of longitudes

 lon_lower_index = np.where(lons[:] == 44.5)[0][0]

 lon_upper_index = np.where(lons[:] == 100.5)[0][0]

 lons = lons[lon_lower_index:lon_upper_index]


 temp = temp[0, :, lat_index, lon_lower_index:lon_upper_index]



 plt.pcolormesh(lons, depths[:], temp)

 plt.gca().invert_yaxis()


 plt.show()






 The indexing approach used here is quite flakey, so I certainly wouldn't
 use this in anything operational.

 Hope this helps,

 Phil



figure_1.png--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] changing the shade of a color depending on a value

2013-02-27 Thread Phil Elson
Joe Kington's answer is the best solution I've seen to this problem:

http://stackoverflow.com/questions/13622909/matplotlib-how-to-colorize-a-large-number-of-line-segments-as-independent-gradi

There is also an example in the gallery:

http://matplotlib.org/examples/pylab_examples/multicolored_line.html



HTH




On 27 February 2013 09:49, Rita rmorgan...@gmail.com wrote:

 Hi,

 I am currently plotting cpu utilization over time (plot_time). I would
 like the color of my line to be red when at 100%. 80-90% a bit less red,
 more yellow, and lower numbers will be green. Any thoughts of doing this?


 --
 --- Get your facts first, then you can distort them as you please.--


 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_feb
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] cross hatching in contours?

2012-12-05 Thread Phil Elson
As of matplotlib v1.2.0 you can hatch a contour set directly. There is an
example in the gallery:

http://matplotlib.org/examples/pylab_examples/contourf_hatching.html

Hope that helps,

Phil


On 5 December 2012 17:28, spencerahill spencerah...@gmail.com wrote:

 Jae-Joon Lee wrote
  On Thu, Sep 15, 2011 at 10:33 PM, Jonathan Slavin
  lt;

  jslavin@.harvard

  gt; wrote:
  I'm wondering if there is some way to do cross hatching as a way to fill
  contours rather than colors (using contourf).  The only references to
  cross hatching I see in the documentation are for patches type objects.
  As far as I can tell, contour and contourf return objects of their own
  type (contour.QuadContourSet) that do not have hatch as an attribute.
 
 
  Yes, it seems that hatching is only supported in patches.
  You may workaround this by converting contours to multiple patches.
  See the attachment.
 
  Matplotlib-users mailing list

  Matplotlib-users@.sourceforge

  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
  contour_to_hatched_patches.py (1K)
  lt;
 http://matplotlib.1069221.n5.nabble.com/attachment/23/0/contour_to_hatched_patches.pygt
 ;

 Hi Jae-Joon,

 Your contour_to_hatched_patches.py script works excellently. Is there a way
 to suppress the contour lines and filling, leaving only stippling? I have
 been experimenting with it but no luck.

 I have a contourf of a 2D variable and a separate 2D array indicating
 regions of statistical significance (i.e. a mask, which equals 1 in cells
 where the variable is significant and equals 0 else), and I want to put
 black hatching over the contourf where it is significant. I can get this to
 work, but still with a black contour line surrounding the hatched region.
 I'd like to remove the line, leaving just the hatching. Thanks!

 Best,
 Spencer




 --
 View this message in context:
 http://matplotlib.1069221.n5.nabble.com/cross-hatching-in-contours-tp22p39945.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.


 --
 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

--
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] mailing list archive broken ?

2012-11-28 Thread Phil Elson
Hi Pierre,

Thanks for raising this (sorry we haven't got back to you sooner).

The mailing list isn't dead, but the archiving link certainly makes it look
like it is. I've just submitted a pull request (
https://github.com/matplotlib/matplotlib/pull/1540) to get the mpl docs to
link to the nabble archive instead (http://
matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html).

FYI There are a couple of topics related to this which I will raise in the
mpl-devel mailing list sortly.

Thanks,

Phil



On 4 October 2012 08:55, Pierre Haessig pierre.haes...@crans.org wrote:

 Hi,

 Is it just my web browser getting crazy or is there a real issue with
 the ML archive on sourceforge:
 http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users

 I only see email records until July 16th 2012 !!

 If there is another ML archive website in better shape, it would be
 worth updating the link on matplotlib.org front page
 (Documentation/need help? section)

 Best,
 Pierre





 --
 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


--
Keep yourself connected to Go Parallel: 
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] aspect ratio bug ?

2012-11-20 Thread Phil Elson
The original question was raised in a mpl ticket:
https://github.com/matplotlib/matplotlib/issues/1513

My original answer there (copied  pasted):

The bbox_inches='tight' option to savefig does some analysis on the artists
visible on your plot and figures out the minimum bounding box needed to fit
all of the artists on the plot. In doing so, *it will reduce the size of
the outputted image, rather than keeping the size and zooming in*. A
really simple example to show this (not using basemap):

 import matplotlib.pyplot as plt
 fig = plt.figure(figsize=(3, 4))
 ax = plt.axes([0.4, 0.4, 0.2, 0.2])
 ax.plot(range(10))
 plt.savefig('figsize_no_tight.png')
 plt.savefig('figsize_tight.png', bbox_inches='tight')


$ file figsize_*
figsize_no_tight.png: PNG image data, 300 x 400, 8-bit/color RGBA,
non-interlaced
figsize_tight.png:PNG image data, 98 x 123, 8-bit/color RGBA, non-interlaced



*Matt has said that he doesn't think this addresses the issue *so anyone
else with any ideas, please chip in!
My suspicion is that what is being described is a combination of
bbox_inches=tight and a snapping issue relating to the fixed aspect
(snapping here could be literally mpl snapping, or could simply be floating
point problems).

Hope someone else has some ideas about what is going on.

Cheers,

Phil








On 20 November 2012 00:25, sav...@nsidc.org wrote:


 Hi there,

 I've boiled down a problem and while the following my look useless, I need
 to understand why matplotlib is behaving like it is.

 Below is code showing my issue.  I don't believe the issue is with the
 bbox_inches='tight', if you leave that off, my image is indeed, 800x1400,
 but the last row is a row of transparent pixels(on linux/not mac).  It's
 difficult to see unless you use the imagemagik command display.

 The basic problem is that when my data has an aspect ratio very close to
 1.75, the image gets changed to one with an aspect of 1.74875.

 Correct figure info 8x14@100dpi = 800x1400 = 1.75 Aspect Ratio.
 Incorrect figure info = 800x1399 = 1.74875

 Data that works aspect ratio: 1.7498
 Data that fails aspect ratio: 1.7496
 ---   Srsly?!  ---^

 It would be great if someone could explain to me what's happening if this
 is indeed working as expected.  If it's not, it would be great if someone
 could fix it.

 Thanks in advance.
 Matt


 import matplotlib.pyplot as plt

 def create_image():
 # I want an 800x1400 image (aspect = 1400/800 = 1.75.
 fig = plt.figure(1, figsize=(8, 14), frameon=False, dpi=100)

 # Use the whole figure and fill with a patch.
 fig.add_axes([0, 0, 1, 1])
 ax = plt.gca()
 limb = ax.axesPatch
 limb.set_facecolor('#6587ad')

 # Set some bounds with Aspects very close to the desired aspect ratios.
 x1 = 0.0
 y1 = 0.0
 x2 = 16.

 # If you un-comment out this line (and comment the one below). I get
 an image I expect
 # y2 = 27.994671   # produces 800 x 1400 image
 # aspect = 1.7498 works

 # Use this line and I get and image the wrong size (or with
 transparent pixels.)
 y2 = 27.994670   # produces (wrong?) 800 x 1399 image
 # aspect = 1.7496 Fails? wat?

 corners = ((x1, y1), (x2, y2))
 ax.update_datalim(corners)
 ax.set_xlim((x1, x2))
 ax.set_ylim((y1, y2))

 ax.set_aspect('equal', anchor='C')
 ax.set_xticks([])
 ax.set_yticks([])

 plt.savefig('rectangle.png', pad_inches=0.0, bbox_inches='tight')

 # If you use this below, the file size is correct, but there is a
 single
 # line transparent pixels along the bottom of the image

 #  plt.savefig('rectangle.png', pad_inches=0.0)


 if __name__ == '__main__':
 create_image()


 --
 Monitor your physical, virtual and cloud infrastructure from a single
 web console. Get in-depth insight into apps, servers, databases, vmware,
 SAP, cloud infrastructure, etc. Download 30-day Free Trial.
 Pricing starts from $795 for 25 servers or applications!
 http://p.sf.net/sfu/zoho_dev2dev_nov
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
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 Phil Elson
Hi Brad,

I didn't quite follow what it was that you were trying to achieve, but the
following example may be of interest to you:


import matplotlib.pyplot as plt

from matplotlib.patches import Ellipse, Circle

import matplotlib.transforms as mtrans


fig = plt.figure()

ax1 = fig.add_subplot(111)


x_in_axes_coords, y_in_axes_coords = 0.5, 0.5

radius_in_axes = 0.3

coords = [[x_in_axes_coords, y_in_axes_coords],

  [x_in_axes_coords + radius_in_axes, y_in_axes_coords]]


coords = ax1.transAxes.transform(coords)

x_device, y_device = coords[0, :]

radius = coords[1, 0] - x_device


circle = Circle((x_device, y_device), radius,

  transform=mtrans.IdentityTransform())


fig.artists.append(circle)



plt.show()



Clearly, you will always have circles with this approach (the circle is
defined in device coordinates, i.e. pixels),
but with the way this is implemented, it does not behave in the same way as
axes coordinates do when you resize your window.


 I am trying to plot some small circles in my plotting window, in addition
to the curves I'm already plotting.

I wonder if you would mind expanding on that sentence? Does the example I
provide do what you want?


Thanks,

Phil



On 5 November 2012 20:51, Brad Malone brad.mal...@gmail.com 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.



 import matplotlib.pyplot as plt
 from matplotlib.patches import Ellipse, Circle

 fig = plt.figure()
 ax1 = fig.add_subplot(111)
 # uncomment the following line to see it break
 #ax1.set_xlim((0.2,1))

 # calculate asymmetry of x and y axes:
 x0, y0 = ax1.transAxes.transform((0, 0)) # lower left in pixels
 x1, y1 = ax1.transAxes.transform((1, 1)) # upper right in pixes
 dx = x1 - x0
 dy = y1 - y0
 maxd = max(dx, dy)
 width = .15 * maxd / dx
 height = .15 * maxd / dy
 # a circle you expect to be a circle, but it is not
 ax1.add_artist(Circle((.5, .5), .15))
 # an ellipse you expect to be an ellipse, but it's a circle
 ax1.add_artist(Ellipse((.75, .75), width, height))

 plt.show()


 I suppose the problem is that ax1.transAxes.transform commands return the
 same numbers, regardless of whether I've changed the limits or not. Is
 there an easy and clean way to fix this (perhaps a different command for
 getting x0,y0,x1, and y1)?

 Thanks for the help!

 Best,
 Brad



 --
 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


--
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] Type 1 fonts with log graphs

2012-10-30 Thread Phil Elson
Hi Brandon,

I notice that this is cross-posted on StackOverflow (
http://stackoverflow.com/questions/13132194/type-1-fonts-with-log-graphs).
Personally, I have no problem with cross posting, but to save two people
having to answer the same question, I would make sure it was explicit that
this had also been posted elsewhere.

Thanks,

Phil


On 30 October 2012 03:13, Brandon Heller brand...@stanford.edu wrote:

 Hi,

 I'm trying to use Matplotlib graphs as part of a camera-ready
 submission, and the publishing house requires the use of Type 1 fonts
 only.

 I'm finding that the PDF backend happily outputs Type-1 fonts for
 simple graphs with linear Y axes, but outputs Type-3 fonts for
 logarithmic Y axes.

 Using a logarithmic yscale incurs the use of mathtext, which seems to
 use Type 3 fonts, presumably because of the default use of exponential
 notation.  I can use an ugly hack to get around this - using
 pyplot.yticks() to force the axis ticks to not use exponents - but
 this would require moving the plot region to accommodate large labels
 (like 10 ^ 6) or writing the axes as 10, 100, 1K, etc. so they fit.

 There's a minimum working example below, which I've tested with the
 matplotlib master branch as of today, as well as 1.1.1, which produces
 the same behavior, so I don't know that this is a bug, probably just
 unexpected behavior.


 #!/usr/bin/env python
 # Simple program to test for type 1 fonts.
 # Generate a line graph w/linear and log Y axes.

 from matplotlib import rc, rcParams

 #rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})

 # These lines are needed to get type-1 results:
 #
 http://nerdjusttyped.blogspot.com/2010/07/type-1-fonts-and-matplotlib-figures.html
 rcParams['ps.useafm'] = True
 rcParams['pdf.use14corefonts'] = True
 rcParams['text.usetex'] = False

 import matplotlib.pyplot as plt

 YSCALES = ['linear', 'log']

 def plot(filename, yscale):
 plt.figure(1)
 xvals = range(1, 2)
 yvals = xvals
 plt.plot(xvals, yvals)
 plt.yscale(yscale)
 #YTICKS = [1, 10]
 #plt.yticks(YTICKS, YTICKS)  # locs, labels
 ax = plt.gca()
 #print ax.get_xticklabels()[0].get_text()
 print ,.join([a.get_label() for a in ax.get_yticklabels()])
 plt.savefig(filename + '.pdf')


 if __name__ == '__main__':
 for yscale in YSCALES:
 plot('linegraph-' + yscale, yscale)



 Does anyone know a clean way to get Type 1 fonts with log axes?

 Thanks,
 Brandon


 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_sfd2d_oct
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Reading a remote JPG URL using imread

2012-10-19 Thread Phil Elson
Good idea. If the png version works then the jpg version should also be
made to work,

Would you be willing to open up an issue for the feature request? :
https://github.com/matplotlib/matplotlib/issues/new

If your ready and willing to implement such a thing, that would be even
better (just open a pull request and we can start reviewing)!

All the best,

Phil



On 19 October 2012 15:59, Rich Signell rsign...@usgs.gov wrote:

 MPL folks,

 Would it be possible to enhance Matplotlib to allow im=imread(url)
 to work if url returns a JPG?

 Currently (it seems):

 1. If the URL returns a PNG this works:

 im = imread(urllib2.urlopen(url))

 2. If the URL returns a JPG, this DOESN'T work:

 im = imread(urllib2.urlopen(url))

 .. and neither does this:
 im = imread(urllib2.urlopen(url),format='jpg')

 ... but this DOES work:

 im = Image.open(cStringIO.StringIO(urllib.urlopen(url).read()))

 See an example in Ipython Notebook here:
 http://nbviewer.ipython.org/3918576/

 So could just be hidden from the user so that im = imread(url) would
 just work for JPG (assuming PIL was installed)?

 Thanks,
 Rich
 --
 Dr. Richard P. Signell
 USGS, 384 Woods Hole Rd.
 Woods Hole, MA 02543-1598


 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_sfd2d_oct
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Normalize and special scalar handling

2012-10-18 Thread Phil Elson
 If nothing speaks against it, i could do a pull request.

If you are willing, I would encourage you to do that, or at least make a
branch in your matplotlib fork and post the diff URL here. That way we can
discuss the pros  cons in-line, even if it means that we do no actually
merge the PR (that sounds bad, but really pull requests are a great medium
for discussing code).

Thanks!

Phil
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] mpl command-line utilities

2012-10-18 Thread Phil Elson
I can certainly see the benefit. As Mike said, I don't think I would use it
myself, but I could see non-python users finding it useful.

Personally, I think this would be a nice extension that doesn't have to
live in the core matplotlib code base. That way release cycles and testing
can be done completely independently without complicating the matplotlib
repo.

Nice idea.

Phil




On 17 October 2012 16:20, Daπid davidmen...@gmail.com wrote:

 I also think that would be useful. It would, for example, allow to
 generate preview plots from other languages, without interfacing
 them to Python. It must be said that MPL is actually quite nice
 looking in the default settings for basic plotting, and this is an
 nice feature that can exploit.

 I have seen many pieces of code using SuperMongo for plotting. I find
 it absolutely ugly, and super expensive, but it is probably the easier
 plotting system to call from FORTRAN (or, at least, it was).

 On Wed, Oct 17, 2012 at 3:15 PM, Michael Droettboom md...@stsci.edu
 wrote:
  I think this could be very useful -- and might help increase the user
  base beyond the Python community.  As I, and most of us on this list,
  are quite comfortable with Python, I don't think I'd use it myself, but
  I certainly see the utility of it.
 
  Mike
 
  On 10/17/2012 06:38 AM, Damon McDougall wrote:
  All,
 
  I was brain-storming yesterday and I wanted to test the waters to see
  if people would find it useful.
 
  Currently, GNU plotutils comes with command-line utilities such as
  `graph` to create quick and dirty line plots like this:
  http://www.gnu.org/software/gsl/manual/html_node/DWT-Examples.html. I
  think even gnuplot might be similar.
 
  How do people feel about perhaps adding a matplotlib version, mocking
  the same calling signature as graph?
 
  I think the most important question is: would it be useful?
 
 
 
 
 --
  Everyone hates slow websites. So do we.
  Make your web apps faster with AppDynamics
  Download AppDynamics Lite for free today:
  http://p.sf.net/sfu/appdyn_sfd2d_oct
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_sfd2d_oct
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot() question

2012-10-16 Thread Phil Elson
To plot a line using pyplot.plot you need an array/list of x coordinates
and an array/list of y coordinates.

So if you have:

data = [[64, 13], [66, 22], [68, 9], [70, 11], [72, 8], [74, 10], [76, 11],
[78, 8], [80, 9], [82, 9], [84, 15], [86, 13], [88, 5], [90,
9], [92, 13],
[94, 12], [96, 7]]

You can get a list of xs and a list of ys with:

xs, ys = zip(*data)

From that point, it is as simple as doing:

import matplotlib.pyplot as plt
plt.plot(xs, ys)


Hope that helps,

Phil






On 16 October 2012 09:39, ran...@0x06.net ran...@0x06.net wrote:

 [[64, 13], [66, 22], [68, 9], [70, 11], [72, 8], [74, 10], [76, 11],
 [78, 8], [80, 9], [82, 9], [84, 15], [86, 13], [88, 5], [90, 9], [92,
 13], [94, 12], [96, 7]]

--
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 Phil Elson
Nice challenge Fernando!

Damon, I love the solution! I do wonder whether we could do some
quirky transform on the lines to achieve a similar result, rather than
manipulating the data before plotting it. The benefit is that
everything should then get randomly Xkcd-ed automatically - maybe I
will save that one for a rainy day

Thanks for posting!



On 4 October 2012 11:31, Damon McDougall damon.mcdoug...@gmail.com wrote:
 On Thu, Oct 4, 2012 at 10:44 AM, Damon McDougall
 damon.mcdoug...@gmail.com wrote:
 On Thu, Oct 4, 2012 at 10:02 AM, Pierre Haessig
 pierre.haes...@crans.org 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 ;-)) ?

 I feel like the key point is about adressing the rasterized plot image
 r with some slightly randomized indices ix and iy. However, I
 really don't get the step that generates these indices.

 Best,
 Pierre

 I believe this is in your interests: http://i.imgur.com/5XwRO.png

 Here's the code: https://gist.github.com/3832579

 Disclaimer: The code is ugly; don't judge me. Also, I installed the
 Humor Sans font but I couldn't get mpl to find it. Oh well :)

 I got the font working :) http://i.imgur.com/Dxemm.png

 --
 Damon McDougall
 http://www.damon-is-a-geek.com
 B2.39
 Mathematics Institute
 University of Warwick
 Coventry
 West Midlands
 CV4 7AL
 United Kingdom

 --
 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

--
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] How to modify the navigation toolbar easily in a matplotlib figure window?

2012-10-03 Thread Phil Elson
 Note, however, code has been improved for the 1.2.0 release to make it
easier to modify the set of buttons that are used.  In backend_bases.py,
look for the NavigationToolbar2 class.

Ah yes! I knew I did that for a good reason. :-) Good thinking Ben!
--
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] Create a figure window without navigation toolbar

2012-10-03 Thread Phil Elson
Personally, I am not a fan of adding a window specific keyword to the
figure function (although there may be some there already).
With 1.2 you can use Matthew Emmett/Paul Ivanov's awesome new context
manager to remove the toolbar for the duration of the with statement:


import matplotlib.pyplot as plt
import matplotlib as mpl

with mpl.rc_context({'toolbar':False}):
plt.plot(range(10))
plt.show()


Does that make things easier/nicer for you?

Cheers,

--
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] Bug when zooming on multiple lines separated by None

2012-10-03 Thread Phil Elson
This works for me with 1.2 (not tested before that):


import matplotlib.pyplot as plt
import numpy as np


x = np.array([0, 1, None, 1, 0])
y = np.array([0, 1, None, 0, 1])

plt.plot(x, y)

plt.show()



I get two distinct lines crossing each other at (0.5, 0.5)


HTH,

--
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] Problem with axvline in gridspec with log Y axis

2012-09-17 Thread Phil Elson
Sometimes, having a point of reference really helps in tracking the issue
down, particularly when complimented with the very cool bisect tool that
comes with git. In this case though, I knew where the problem came in
because I have been working closely in this area recently (and it's my
change which has exposed the problem). I have fixed this in the pull
request, and fully expect the fix to be in the next 1.2.x release candidate.

If your willing and able, you could get hold of my branch until it is
merged to carry on testing the release candidate.

Hope that helps,

All the best,

Phil


On 14 September 2012 17:53, Scott Lasley slas...@space.umd.edu wrote:


 On Sep 14, 2012, at 5:02 AM, Phil Elson pelson@gmail.com wrote:

  Thanks for raising this. I have simplified and opened an issue for the
 bug (https://github.com/matplotlib/matplotlib/issues/1246) and will be
 looking at this asap.
 
  All the best,
 
  Phil

 I don't know if this helps, but my scripts and the code snippet in my
 email message work without crashing using matplotlib 1.2.x compiled from
 github on July 23, 2012 and
 numpy-1.8.0.dev_63cd8f3-py2.7-macosx-10.6-intel.egg on another mac running
 OS X 10.8.1.

 Thank you for looking into this,
 Scott
--
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] Problem with axvline in gridspec with log Y axis

2012-09-14 Thread Phil Elson
Thanks for raising this. I have simplified and opened an issue for the bug (
https://github.com/matplotlib/matplotlib/issues/1246) and will be looking
at this asap.

All the best,

Phil
--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] numpoints in legend() function for scatter plot is not working in matplotlib 1.1.0?

2012-09-10 Thread Phil Elson
Ben, on master scatter legends are broken. A pull request (I can't remember
which, and github is down, possibly #1176) fixes this (obviously, the PR is
marked as release critical for 1.2).

I have confirmed, that even once fixed on master, the scatter legend
handler does not take notice of the numpoints kwarg.

Hope that helps clarify the matter,

Regards,

Phil


On 10 September 2012 14:51, Benjamin Root ben.r...@ou.edu wrote:



 On Mon, Sep 10, 2012 at 9:33 AM, Chao YUE chaoyue...@gmail.com wrote:

 Hi Ben,

 I think I installed this version by following the instructions on
 matplotlib website. But when I try to use git log, I get:

 chaoyue@chaoyue-Aspire-4750:/usr/local/lib/python2.7/dist-packages/matplotlib$
 pwd
 /usr/local/lib/python2.7/dist-packages/matplotlib

 chaoyue@chaoyue-Aspire-4750:/usr/local/lib/python2.7/dist-packages/matplotlib$
 git log
 fatal: Not a git repository (or any of the parent directories): .git

 I tried to have a look at __init__.py, it has:

 from __future__ import print_function

 __version__  = '1.2.x'
 __version__numpy__ = '1.4' # minimum required numpy version

 So it's the correct directory I am going. could you give some further
 instructions?

 Chao


 Which directions? We have several for different kinds of installs.  We
 have not released v1.2.0 yet, so I was guessing you checked out mpl from
 github.  If that is the case, then you run git log from the source
 directory, not the install directory.

 Ben



 On Mon, Sep 10, 2012 at 3:05 PM, Benjamin Root ben.r...@ou.edu wrote:



 On Mon, Sep 10, 2012 at 2:56 AM, Chao YUE chaoyue...@gmail.com wrote:

 Hi Ben,

 I tried the numpoints in legend function for scatter plot, in dev
 version and GTKAgg backend it works.

 In [3]: mat.__version__
 Out[3]: '1.2.x'

 In [4]: mat.get_backend()
 Out[4]: 'GTKAgg'

 Chao


 Strange, when I tested it last night, I was using a build of mpl from
 master of a couple weeks ago, and I saw three markers in the legend.  Now,
 I am trying it again with the latest master:
 1478a1be70b3077b71350cecaccb774f76a76656, and I now see *zero* markers.
 Something is seriously broken.

 Can you tell me what commit (and the date for that commit) shows up at
 top when you run git log in the mpl source directory?

 Ben Root




 --

 ***
 Chao YUE
 Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
 UMR 1572 CEA-CNRS-UVSQ
 Batiment 712 - Pe 119
 91191 GIF Sur YVETTE Cedex
 Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16

 




 --
 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


--
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] Rectangle Bug

2012-09-07 Thread Phil Elson
This seems to a be common misconception...

I guess in future, we could add a check to the add_patch method to see if
the given artist already has an associated Axes, and if it does, emit a
warning.



On 7 September 2012 07:42, Eric Firing efir...@hawaii.edu wrote:

 On 2012/09/06 8:35 PM, jonasr wrote:
  That seems to work, thank you.
 
  I would have thought that the add_patch function creates two seperate
  objects independent of the defined Rectangle.

 add_patch doesn't create any objects; it just attaches the axes to the
 patch in both directions: a reference to the patch object is appended to
 a list of axes artists, and the patch object gets a reference to the
 axes.  Fortunately, python has garbage collection to handle such
 circular references.

 Eric

 
  greets jonas



 --
 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

--
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] axis default formatting with strange scientific-like notation

2012-08-19 Thread Phil Elson
I'm not aware of an rc param for this. The relevant github issue:
https://github.com/matplotlib/matplotlib/issues/461

Regards,

Phil



On 19 August 2012 21:27, Christopher Graves christoph.gra...@gmail.comwrote:

 Using matplotlib 1.1.1.
 If one runs the following code:

 from pylab import *

 plot([19.185,19.187],[0.0009,0.0011],'b.')

 show()

 The x-axis is labelled 0.0005, 0.0010, 0.0015 etc  +1.9184e1

 This is unreadable and does not seem like a good default behavior!

 One can add
 gca().xaxis.set_major_formatter(FormatStrFormatter('$%g$'))
 before show()
 to obtain an x-axis labelled 19.1845, 19.185, 19.1855, etc.

 Can one change the default label formatting behavior with a matplotlib rc?
 However, I would not want to e.g. override the 10^-3, 10^-2, etc when using
 log axes.

 Best regards,
 Chris


 --
 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


--
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] Adding a ready figure to pyplot.

2012-07-29 Thread Phil Elson
I don't have a good answer to this and have had to implement such a
thing in an outstanding pull request (in my case, I have a figure
which has been un-pickled and needs re-attaching to pyplot).

My proposed mechanism goes something like:


figure = matplotlib.figure.Figure(...)

import matplotlib.pyplot as plt

mgr = plt._backend_mod.new_figure_manager_given_figure(num, self)



Obviously this doesn't even exist on master yet, so if you need this
functionality from a version before this you will have to reverse
engineer the pyplot.figure function.

HTH,



On 29 July 2012 13:12, Anton Akhmerov anton.akhme...@gmail.com wrote:
 Hi,

 I am writing a module which should, among other things, output images, and it
 should work both in interactive mode and when imported as a script.

 In order for the plotting behavior to be clean, I would like to prepare the
 figure separate from pyplot. The reason for this, is that the figure is drawn 
 in
 a non-interactive loop, and I don't want to show all the steps as they go.
 Moreover, for some reason with ipython inline backend the figure is rendered
 twice for no obvious reason. So the preferred behavior of my plotting function
 (when pyplot output is requested) should be similar to:

 fig = matplotlib.figure.Figure()
 ax = fig.add_subplot(111)
 ax.plot([1,2,3])
 matplotlib.pyplot.ADD_FIGURE(fig)

 The best approximation to this that I was able to find so far is to use the
 following dirty hack (although none of the attributes I use are _private!):

 f = plt.figure()
 fig.canvas = f.canvas
 f.canvas.figure = fig

 However this is still problematic: if the interactive mode is on, then 
 rendering
 of the figure will still be called after these two attribute. Moreover in
 IPython notebook without inline plotting it will result in an opened GUI 
 window,
 but GUI mainloop not running.

 So here's my question: what's the best way to achieve the behavior that I 
 want?

 Thank you,
 Anton


 --
 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

--
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] axvspan with dates on x-axis

2012-07-26 Thread Phil Elson
Luciano got in touch offline and my suggestions worked for a certain
version of Python.

Luciano, were you trying it in python3? If not, what version of Python
was it that wasn't working for you?

Thanks,


On 24 July 2012 18:26, Luciano Fleischfresser l_...@yahoo.com wrote:
 Still not working. The output looks like this:

 File NotasFaltasdoisgraficos.py, line 58
ax3.axvspan(*mdates.datestr2num(['05/18/2012', '06/30/2012']),
 facecolor='g', alpha=0.5)

 ^
 SyntaxError: invalid syntax

 When you say ...change the months to short English form you mean in the
 data file?
 That is, Abr - Apr, Mai - May??? ...still did not work.

 
 From: Phil Elson pelson@gmail.com
 To: Luciano Fleischfresser l...@utfpr.edu.br
 Cc: Matplotlib-users@lists.sourceforge.net
 Matplotlib-users@lists.sourceforge.net
 Sent: Monday, July 23, 2012 5:45 PM
 Subject: Re: [Matplotlib-users] axvspan with dates on x-axis

 Looks like your very close.


 I needed to change the months to short English form, change the line

   ax3.grid('True') to ax3.grid(True)

 and add the line

   ax3.axvspan(*mdates.datestr2num(['05/18/2012', '06/30/2012']),
 facecolor='g', alpha=0.5)

 To get the box on the lower plot.

 Hope that helps,



 On 23 July 2012 20:42, Luciano Fleischfresser l_...@yahoo.com wrote:
 I want to place a colored vertical range on my plot and came across the
 following example:


 http://stackoverflow.com/questions/8270981/in-a-matplotlib-plot-can-i-highlight-specific-x-value-ranges/8271438#8271438

 It shows what I am trying to do using axvspan.
 However, I was not able to reproduce the second plot with dates.
 Errors like 'invalid syntax' for color='red' and others prevented me from
 reproducing the plot.
 The demo from Matplotlib gallery worked fine for me. My plot also has
 dates
 on the x-axis.

 I am attaching code and data file. Hope someone can point me in the right
 direction.

 L Fleischfresser


 --
 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


 --
 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



--
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] How to Change Axis Tick Mark Labels

2012-07-23 Thread Phil Elson
Ah, sorry, forgot to reply to all. Please see the solution I provided to Jon.

-- Forwarded message --
Date: 22 July 2012 15:08
Subject: Re: [Matplotlib-users] How to Change Axis Tick Mark Labels


Sounds like you want to use a FunctionFormatter rather than modifying
the ticks themselves. There is an example here
(http://stackoverflow.com/questions/8271564/matplotlib-comma-separated-number-format-for-axis).

Essentially:

import matplotlib.pyplot as plt
import matplotlib.ticker as mticker

def square_braces(tick_val, tick_pos):
Put square braces around the given tick_val 
return '%s' % tick_val

ax = plt.axes()
plt(range(10))
ax.yaxis.set_major_formatter(mticker.FuncFormatter(func))
plt.show()

HTH,

--
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] axvspan with dates on x-axis

2012-07-23 Thread Phil Elson
Looks like your very close.


I needed to change the months to short English form, change the line

   ax3.grid('True') to ax3.grid(True)

and add the line

   ax3.axvspan(*mdates.datestr2num(['05/18/2012', '06/30/2012']),
facecolor='g', alpha=0.5)

To get the box on the lower plot.

Hope that helps,



On 23 July 2012 20:42, Luciano Fleischfresser l_...@yahoo.com wrote:
 I want to place a colored vertical range on my plot and came across the
 following example:

 http://stackoverflow.com/questions/8270981/in-a-matplotlib-plot-can-i-highlight-specific-x-value-ranges/8271438#8271438

 It shows what I am trying to do using axvspan.
 However, I was not able to reproduce the second plot with dates.
 Errors like 'invalid syntax' for color='red' and others prevented me from
 reproducing the plot.
 The demo from Matplotlib gallery worked fine for me. My plot also has dates
 on the x-axis.

 I am attaching code and data file. Hope someone can point me in the right
 direction.

 L Fleischfresser

 --
 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


--
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] gallery link broken/not working

2012-07-19 Thread Phil Elson
I can confirm the bad link.
Would you mind opening a new issue on github for this?

github.com/matplotlib/matplotlib/issues/new

Thanks,

On 19 July 2012 10:15, Francesco Montesano franz.berges...@gmail.com wrote:
 Hi,

 roaming through the gallery I've found that in
 http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_00.html
 http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_01.html
 http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider_01.html
 and maybe others do not work

 error:
 1. Server: matplotlib.sourceforge.net
 2. URL path: /examples/pylab_examples/demo_tight_layout_00.html
 3. Error notes: NONE
 4. Error type: 404
 5. Request method: GET
 6. Request query string: NONE
 7. Time: 2012-07-19 09:12:32 UTC (1342689152)

 http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout.html
 works fine

 Cheers,

 Francesco

 --
 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

--
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] path contains_point IndexError: Unexpected SeqBaseT length

2012-06-11 Thread Phil Elson
I can't reproduce this on version = 1.1.0. What version of matplotlib
are you using?


On 11 June 2012 17:23, Gustavo Goretkin gustavo.goret...@gmail.com wrote:
 The problem is that the function in _path.cpp expects a path radius
 argument, r.

 Here is the signature:
 point_in_path(double x, double y, double r, PathIterator path,
   const agg::trans_affine trans)

 but the invocation in python looks like this:

 point_in_path(point[0], point[1], self, transform)



 On Sat, Jun 9, 2012 at 9:27 PM, Gustavo Goretkin
 gustavo.goret...@gmail.com wrote:

 I think I'm experiencing a bug.

 Here is a minimum example:

 import matplotlib.patches as mpatches
 path = mpatches.Rectangle((0,0),width=1,height=1).get_path()
 print path.contains_point(point=(.5,.5))

 it raises an IndexError: Unexpected SeqBaseT length.

 I think this is a problem in the contains_point method which calls a C
 function point_in_path inside of matplotlib._path

 Thanks!
 Gustavo



 --
 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


--
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