Re: [Matplotlib-users] mulidimension data

2017-06-28 Thread Benjamin Root
Diego,

It isn't really clear from your description what the problem is. Is the
problem that the sub-vectors aren't all of equal lengths (i.e., a staggered
array)? Or is it that it is transposed from what you'd expect?

Ben Root

On Tue, Jun 27, 2017 at 9:07 AM, Diego Avesani 
wrote:

> Dear all Matplotlib Users,
>
> I would like to plot a multidimensional plot. I have found this script: 
> multidimension
> script
> 
> The scrip is the second one.
>
> It works perfectly. However, I have a problem with the variable data. I
> usually with data in matrix format, but this one is in a strange format:
>
> [[1.2065774590852414,
>   0.8086503430142642,
>   5.68386650687075,
>   5.299424335893731,
>   0.538429526339814],
>  [1.3499594768827485,
>   1.9507403089675424,
>   5.67760737064995,
> 
> 
> 
>
> Is a sort of vector of vectors. As a consequence, I am not able to read mu
> output data in this format.
> I usually read my data in the following way:
>
> data = np.genfromtxt(fname, skip_header=1)
>
> I would like to know how can I read my data in order to be able to use the
> script.
>
> Thanks a lot to everyone
>
>
> Diego
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot control

2017-04-19 Thread Benjamin Root
This would seem like a bug in that package's code. The traceback shows that
it is performing its own check on the passed in kwargs, and failing to
recognize it as a valid argument. I suggest contacting the maintainers of
the "skill_metrics" package and find out from them if there is a bug in
their package. I am unfamiliar with this package, so I can't say anything
for certain.

Cheers!
Ben Root


On Wed, Apr 19, 2017 at 11:47 AM, Sudheer Joseph 
wrote:

> Dear Experts.
> I have been trying to modify plot properties of taylor diagram from below
> package. I wanted to make markerfacecolor as None( this allows me to show
> symbols which falls over another) of s as possible in normal matplotlib
> plots but I am not sure how to pass the argument in modified figure
> environment of taylor plot. If I try to use markerfacecolor option the code
> says it do not know about such option. I was also checking it is possible
> specify alpha= n so that the color intensity of symbol can be modified. But
> both options are not working or I am not putting it in proper way in such
> situation.
> Please advice if it is possible.
> Sudheer
>
> https://pypi.python.org/packages/1e/98/d6d5d9200fcec4fdbd20f0f084b6e4
> 1e176284786315449cc0c896a411e8/SkillMetrics-1.1.2.tar.gz#md5=
> 7d5e7200375b1c5e1c4fb8344624be67
>
> sm.taylor_diagram(sdev,crmsd,ccoef,markerLabel=label,markerLegend =
> 'on',markerobs='v',markerfacecolor='None',s
>...: tyleOBS='-',colOBS='r',titleobs='RAMA_SST')
> 
> ---
> ValueErrorTraceback (most recent call
> last)
>  in ()
> > 1 sm.taylor_diagram(sdev,crmsd,ccoef,markerLabel=label,markerLegend
> = 'on',markerobs='v',markerfacecolor='None',styleOBS='-',colOBS='r',
> titleobs='RAMA_SST')
>
> /usr/local/lib/python2.7/dist-packages/skill_metrics/taylor_diagram.pyc
> in taylor_diagram(*args, **kwargs)
>  71
>  72 # Get options
> ---> 73 option = get_taylor_diagram_options(CORs,**kwargs)
>  74 #print option # debug
>  75 #
>
> /usr/local/lib/python2.7/dist-packages/skill_metrics/get_taylor_diagram_options.pyc
> in get_taylor_diagram_options(*args, **kwargs)
> 177 optname = optname.lower()
> 178 if not optname in option:
> --> 179 raise ValueError('Unrecognized option: ' + optname)
> 180 else:
> 181 # Replace option value with that from arguments
>
> ValueError: Unrecognized option: markerfacecolor
>
> *** 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
> <+91%2040%202388%206047>(O),Fax:+91-40-23895011 <+91%2040%202389%205011>(O),
> Tel:+91-40-23044600 <+91%2040%202304%204600>(R),Tel:+91-40-9440832534(Mobile)
> E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com Web-
> http://oppamthadathil.tripod.com **
> *
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting speed and error when calling update() using TkAgg

2017-04-18 Thread Benjamin Root
I am wondering if the "optimizations" you have are actually slowing you
down. I have never found myself needing to flush_events() or call update()
like that. Or to draw the artists like you are doing. Without seeing more
of the code, it is hard to judge. Have you tried using "runsnakerun" to
profile your code to find out what is actually slowing it down? I can get
60-70Hz without even trying for 3d plotting animations, and that is
probably more computation than this.

On Tue, Apr 18, 2017 at 4:50 PM, Hjalmar Turesson 
wrote:

> Thanks for the help (and sorry for the super-late reply).
>
> I just tried blitting, but it doesn't really help. I cannot exceed 20 fps.
> The problem is that I'm plotting data from a video file, so that for each
> frame I need to draw a new array (not just a foreground). I think its just
> to much data.
>
> Thanks,
> Hjalmar
>
> On Sat, Jan 7, 2017 at 3:36 PM, Thomas Caswell  wrote:
>
>> To push much past 20Hz you will want to look into blitting.  See
>> http://matplotlib.org/devdocs/api/animation_api.html for a rough
>> introduction on how to use blitting (and see the animation code for an
>> example of handling all of the corner cases).
>>
>> Tom
>>
>> On Fri, Oct 14, 2016 at 5:29 PM Hjalmar Turesson 
>> wrote:
>>
>>> That works fine. And it explains why update() only worked with the Qt
>>> backends (I tried all). The speed is still not super impressive though (~20
>>> fps), but I think I will just start skipping frames when playing at above
>>> 20 fps.
>>>
>>> Thanks,
>>> Hjalmar
>>>
>>> On Fri, Oct 14, 2016 at 10:37 AM, Thomas Caswell 
>>> wrote:
>>>
>>> Instead of `canvas.update` call `self.im.figure.canvas.draw_idle()`.
>>>
>>> IIRC `update` is part of the API inherited from Qt, not part of the API
>>> we ensure that all of the canvas objects have.
>>>
>>> Tom
>>>
>>> On Fri, Oct 7, 2016 at 4:48 PM Hjalmar Turesson 
>>> wrote:
>>>
>>> Hi all,
>>>
>>>
>>> I made a little video player using matplotlib. I need it to allow very
>>> good control over the playback speed (e.g. direction, frame-by-frame
>>> stepping and fast and slow).
>>>
>>> However, it's not very fast. Max frame rate I can achieve is 10-20 fps.
>>> I followed Basti's advice on speeding up plotting (
>>> http://bastibe.de/2013-05-30-speeding-up-matplotlib.html).
>>> This resulted in a more than 2x improvement (from <5 to 10-20 fps), but
>>> I would like to reach 40-50 fps.
>>>
>>> The core code is something like this:
>>>
>>> self.im.set_data(self.video_frame)
>>>
>>> self.text.set_text('some text')
>>>
>>>  self.ax.draw_artist(self.im)
>>>  self.ax.draw_artist(self.text)
>>>  self.im.figure.canvas.update()
>>>  self.im.figure.canvas.flush_events()
>>>
>>> video_frame is a 200 x 250 array. I tried lowering dpi from 100 to 50,
>>> but the improvement is marginal.
>>>
>>> I saw that Harden (http://www.swharden.com/wp/20
>>> 13-04-15-fixing-slow-matplotlib-in-pythonxy/) recommended using TkAgg
>>> over Qt4Agg since TkAgg is supposed to be faster.
>>> But, TkAgg doesn't play nicely with figure.canvas.update(). I get the
>>> following error:
>>> AttributeError: 'FigureCanvasTkAgg' object has no attribute 'update'
>>> It works with Qt4Agg though.
>>>
>>> Does anyone have a fix for this? Or some general advice on how to speed
>>> up playback speed?
>>>
>>> I tried with both matplotlib 1.5.1 and the current version from
>>> github 2.0.0b4+2373.gb34c55d
>>>
>>> Best regards,
>>> Hjalmar
>>> 
>>> --
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot__
>>> _
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] accessing axis artist objects for an axes object

2016-09-07 Thread Benjamin Root
... or report it as a bug against Cartopy for not observing the pad rcParam?

On Wed, Sep 7, 2016 at 12:59 PM, Hearne, Mike  wrote:

> It turns out that the Cartopy gridline labels are NOT tick labels, but
> Text objects managed by the Gridliner class.   I think I'm just going
> to draw the grid line labels myself.
>
> On Wed, Sep 7, 2016 at 9:04 AM, Benjamin Root 
> wrote:
> > Hmm, strange. Well, I know this works in mplot3d (we have a test for it)
> >
> > for i, tick in enumerate(ax.yaxis.get_major_ticks()):
> > tick.set_pad(tick.get_pad() - i * 5)
> >
> > A bit silly, but it is how you can have labels anywhere you want
> relative to
> > the ticks.
> >
> >
> > On Wed, Sep 7, 2016 at 11:47 AM, Hearne, Mike  wrote:
> >>
> >> I couldn't find an rcParams property called "tickpad".  I did find
> >> "xtick.major.pad", which was set to 4.0.  Setting it to a negative
> >> value has no effect.  xtick.minor.pad doesn't do anything either.
> >>
> >> On Wed, Sep 7, 2016 at 8:32 AM, Benjamin Root 
> >> wrote:
> >> > I think you do that by setting a negative tickpad value in the
> rcParams.
> >> >
> >> > On Wed, Sep 7, 2016 at 11:28 AM, Hearne, Mike 
> wrote:
> >> >>
> >> >> Thomas - I hate to be obtuse, but did you mean to imply that the
> xaxis
> >> >> and yaxis properties of an Axes object are AxisArtist objects?
> >> >> IPython tells me that they are XAxis and YAxis objects. From
> >> >> inspecting the GitHub repo, it seems that these are child classes of
> >> >> the Axis object.
> >> >>
> >> >> I suppose I should ask the question addressing the problem I actually
> >> >> have:  How do I render the tick (map) labels *inside* a Cartopy map
> >> >> instead of *outside*?
> >> >>
> >> >> Thanks,
> >> >>
> >> >> Mike
> >> >>
> >> >> On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell 
> >> >> wrote:
> >> >> > ax.xaxis or ax.yaxis
> >> >> >
> >> >> > axes_grid is an alternative to the default Axes/Axis classes.
> >> >> >
> >> >> > Tom
> >> >> >
> >> >> >
> >> >> > On Tue, Sep 6, 2016, 19:53 Hearne, Mike  wrote:
> >> >> >>
> >> >> >> Python: 3.5
> >> >> >> Matplotlib: 1.5.2
> >> >> >>
> >> >> >> I'm trying to invert the tick labels on a Cartopy map, and I found
> >> >> >> this Matplotlib example:
> >> >> >>
> >> >> >> ax.axis[:].invert_ticklabel_direction()
> >> >> >>
> >> >> >> found here:
> >> >> >> http://matplotlib.org/mpl_toolkits/axes_grid/users/
> axisartist.html
> >> >> >>
> >> >> >> My problem is that any Axes object (or child class thereof) that
> >> >> >> I've
> >> >> >> experimented with says that the axis attribute is a *method*, not
> a
> >> >> >> sequence as I infer from the above example.
> >> >> >>
> >> >> >> How do I get the axisartists for a bog-standard Axes instance?
> >> >> >>
> >> >> >> Thanks in advance,
> >> >> >>
> >> >> >> Mike
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> 
> --
> >> >> >> ___
> >> >> >> Matplotlib-users mailing list
> >> >> >> Matplotlib-users@lists.sourceforge.net
> >> >> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> >>
> >> >>
> >> >>
> >> >> 
> --
> >> >> ___
> >> >> Matplotlib-users mailing list
> >> >> Matplotlib-users@lists.sourceforge.net
> >> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> >
> >> >
> >
> >
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] accessing axis artist objects for an axes object

2016-09-07 Thread Benjamin Root
Hmm, strange. Well, I know this works in mplot3d (we have a test for it)

for i, tick in enumerate(ax.yaxis.get_major_ticks()):
tick.set_pad(tick.get_pad() - i * 5)

A bit silly, but it is how you can have labels anywhere you want relative
to the ticks.


On Wed, Sep 7, 2016 at 11:47 AM, Hearne, Mike  wrote:

> I couldn't find an rcParams property called "tickpad".  I did find
> "xtick.major.pad", which was set to 4.0.  Setting it to a negative
> value has no effect.  xtick.minor.pad doesn't do anything either.
>
> On Wed, Sep 7, 2016 at 8:32 AM, Benjamin Root 
> wrote:
> > I think you do that by setting a negative tickpad value in the rcParams.
> >
> > On Wed, Sep 7, 2016 at 11:28 AM, Hearne, Mike  wrote:
> >>
> >> Thomas - I hate to be obtuse, but did you mean to imply that the xaxis
> >> and yaxis properties of an Axes object are AxisArtist objects?
> >> IPython tells me that they are XAxis and YAxis objects. From
> >> inspecting the GitHub repo, it seems that these are child classes of
> >> the Axis object.
> >>
> >> I suppose I should ask the question addressing the problem I actually
> >> have:  How do I render the tick (map) labels *inside* a Cartopy map
> >> instead of *outside*?
> >>
> >> Thanks,
> >>
> >> Mike
> >>
> >> On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell 
> wrote:
> >> > ax.xaxis or ax.yaxis
> >> >
> >> > axes_grid is an alternative to the default Axes/Axis classes.
> >> >
> >> > Tom
> >> >
> >> >
> >> > On Tue, Sep 6, 2016, 19:53 Hearne, Mike  wrote:
> >> >>
> >> >> Python: 3.5
> >> >> Matplotlib: 1.5.2
> >> >>
> >> >> I'm trying to invert the tick labels on a Cartopy map, and I found
> >> >> this Matplotlib example:
> >> >>
> >> >> ax.axis[:].invert_ticklabel_direction()
> >> >>
> >> >> found here:
> >> >> http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html
> >> >>
> >> >> My problem is that any Axes object (or child class thereof) that I've
> >> >> experimented with says that the axis attribute is a *method*, not a
> >> >> sequence as I infer from the above example.
> >> >>
> >> >> How do I get the axisartists for a bog-standard Axes instance?
> >> >>
> >> >> Thanks in advance,
> >> >>
> >> >> Mike
> >> >>
> >> >>
> >> >>
> >> >> 
> --
> >> >> ___
> >> >> Matplotlib-users mailing list
> >> >> Matplotlib-users@lists.sourceforge.net
> >> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>
> >>
> >> 
> --
> >> ___
> >> Matplotlib-users mailing list
> >> Matplotlib-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] accessing axis artist objects for an axes object

2016-09-07 Thread Benjamin Root
I think you do that by setting a negative tickpad value in the rcParams.

On Wed, Sep 7, 2016 at 11:28 AM, Hearne, Mike  wrote:

> Thomas - I hate to be obtuse, but did you mean to imply that the xaxis
> and yaxis properties of an Axes object are AxisArtist objects?
> IPython tells me that they are XAxis and YAxis objects. From
> inspecting the GitHub repo, it seems that these are child classes of
> the Axis object.
>
> I suppose I should ask the question addressing the problem I actually
> have:  How do I render the tick (map) labels *inside* a Cartopy map
> instead of *outside*?
>
> Thanks,
>
> Mike
>
> On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell  wrote:
> > ax.xaxis or ax.yaxis
> >
> > axes_grid is an alternative to the default Axes/Axis classes.
> >
> > Tom
> >
> >
> > On Tue, Sep 6, 2016, 19:53 Hearne, Mike  wrote:
> >>
> >> Python: 3.5
> >> Matplotlib: 1.5.2
> >>
> >> I'm trying to invert the tick labels on a Cartopy map, and I found
> >> this Matplotlib example:
> >>
> >> ax.axis[:].invert_ticklabel_direction()
> >>
> >> found here:
> >> http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html
> >>
> >> My problem is that any Axes object (or child class thereof) that I've
> >> experimented with says that the axis attribute is a *method*, not a
> >> sequence as I infer from the above example.
> >>
> >> How do I get the axisartists for a bog-standard Axes instance?
> >>
> >> Thanks in advance,
> >>
> >> Mike
> >>
> >>
> >> 
> --
> >> ___
> >> Matplotlib-users mailing list
> >> Matplotlib-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fw: Matplotlib Figure margin transparancy

2016-08-10 Thread Benjamin Root
The other reason why this message never got posted is because this message
was sent to the now defunct mailing list hosted by sourceforge. The mailing
list moved about a year ago (I think) to python.org. You will have to
subscribe in order to post unmoderated.

https://mail.python.org/mailman/listinfo/matplotlib-users

Ben Root

On Wed, Aug 10, 2016 at 4:25 AM, Jens Nielsen 
wrote:

> At least for me gmail put your mail in the spam folder.
>
> Anyway the inline backend is actually from in IPython/Jupyter and not in
> matplotlib. I think they have changed the default a couple of times and had
> the transparent as a default earlier but changed it. Looking at the current
> master it looks like they are respecting the matplotlib default colors
> from the matplotlib rc params. Can you please check which version on
> IPython and Jupyter you are running.
>
> You can change the matplotlib rc parameters as described in the docs
> http://matplotlib.org/users/customizing.html#customizing-matplotlib but
> the default ones should be white.
>
> best
> Jens
>
> On Wed, 10 Aug 2016 at 05:06 Sudheer Joseph 
> wrote:
>
>> Hi,
>> I have send below query to matplotlib user group recently but did not get
>> posted so far. Can you please tell me is there is any thin wrong with the
>> message?
>> With best regards,
>> Sudheer
>>
>> >
>> > Dear Expert,
>> > Recently after up-gradation of matplotlib and ubuntu
>> 16.04 I am
>> > getting transparent figure axis when using the "linux color scheme"
>> > option in ipython qtconsole. May I know if there is a way to fix this
>> issue?. I
>> > wanted to keep black screen as it reduces eye strain.
>> >
>> > ipython qtconsole --matplotlib inline
>> >
>> > If I save the image i am able to get axis properly but to see on screen
>> as the
>> > axis is not plotted with white background the black axis line and
>> labels are not
>> > visible. Earlier I used to get figures as attached in second figure.
>> > Earlier Satus which I am looking for below link
>> > https://drive.google.com/open?id=0B3heUQNme7G5ZmVlUHpRakZxUlk
>> > Present status without boarder below link
>> >
>> >
>> > https://drive.google.com/open?id=0B3heUQNme7G5VkhZWHhiUnpfWDg
>> >
>> > Kindly suggest a solution
>> > with best regards,
>> > Sudheer
>> >
>>
>> 
>> --
>> What NetFlow Analyzer can do for you? Monitors network bandwidth and
>> traffic
>> patterns at an interface-level. Reveals which users, apps, and protocols
>> are
>> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
>> J-Flow, sFlow and other flows. Make informed decisions using capacity
>> planning reports. http://sdm.link/zohodev2dev
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> 
> --
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. http://sdm.link/zohodev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib & Basemap / What is the Best Graphical Back-end for Raster Data Display (.png) ?

2016-03-03 Thread Benjamin Root
AGG is used for image handling, particularly for handling transforms,
scaling, interpolation and such. The AxesImage object that you get from
calling imshow() is handled through the AGG library. This is true
regardless of the backend being used because it is based in the AxesImage
class (and others). An SVG of a plot that used imshow() has raster data in
it that comes from AGG (and you can choose to rasterize other things, as
well). Cairo still needs the image buffer.

So, the distinction is the use of the AGG library, and the use of the AGG
backend. The AGG library is required, but the AGG backend is not (but
highly recommended).

I will admit that I didn't have this distinction very clear in my own head
until very recently when reviewing some PRs that reworked the image
handling architecture. I hope that clears it up for you, too.

Cheers!
Ben Root


On Thu, Mar 3, 2016 at 10:05 AM, Jerzy Karczmarczuk <
jerzy.karczmarc...@unicaen.fr> wrote:

> Le 03/03/2016 15:43, Benjamin Root a écrit :
> > Matplotlib will not work at all without AGG. Even the AGG-less
> > backends still use AGG for image handling (imshow() and such).
>
> Is it so? I never found such strong statement in the docs.
>
> 1. SVG backend produces vector graphics, no rasterisation in principle,
> so why AGG?
> 2. Cairo uses its own engine. Why AGG?
> 3. Image (PNG) "production" from curves, etc. uses AntiGrain, but if
> imshow() shows an image which is just a pixel array, there is no
> manipulation needing AGG, an element (triple RGB) becomes a pixel, and
> that's it.
>
> Jerzy Karczmarczuk
>
>
>
> --
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib & Basemap / What is the Best Graphical Back-end for Raster Data Display (.png) ?

2016-03-03 Thread Benjamin Root
Matplotlib will not work at all without AGG. Even the AGG-less backends
still use AGG for image handling (imshow() and such).

We can not guarantee that matplotlib would work with agg 2.5, as that is
the GPL'ed version. We develop against a patched 2.4 branch of AGG (which
is BSD-licensed), which is distributed with our source, and is built as
part of our build process. Have you tried building matplotlib directly from
our source without a system install of AGG?

Cheers
Ben Root


On Thu, Mar 3, 2016 at 6:34 AM, Claude Falbriard  wrote:

> Dear colleagues,
>
> I like to receive an advice about the best back-end choice for Matplotlib
> & Basemap to generate large .png images in a background processing mode.
> Having issues with the pre-compiled "Agg" package which does not work
> under my machine architecture. Also not able to recompile the Agg 2.5
> package as its build throws an error at the build script autogen.sh.
> Error:
>
> ./configure: line 15546: syntax error near unexpected token `$SDL_VERSION,'
> ./configure: line 15546: `AM_PATH_SDL($SDL_VERSION,'
>
> When bypassing this line it runs into another dependency which is blocking
> the make install process.
>
> libtool: link: cannot find the library
> `../src/platform/X11/libaggplatformX11.la' or unhandled argument
> `../src/platform/X11/libaggplatformX11.la'
> Makefile:1166: recipe for target 'aa_demo' failed
> make[1]: *** [aa_demo] Error 1
> make[1]: Leaving directory '/data/Downloads/agg/agg-2.5/examples'
> Makefile:481: recipe for target 'install-recursive' failed
> make: *** [install-recursive] Error 1
>
> I do not plan to use any interactive access, so my guess is that excluding
> X11 libraries should work OK.
>
> My test showed that the  "Cairo" package is working fine, but its quality
> (vector oriented) is not as good compared to the Agg raster display. Case
> the "Agg"
> is not able to install on my machine, is there an alternate graphical
> back-end available under SuSE environments?
>
> Regards,
>
> *Claude Falbriard*
> Certified IT Specialist L2 - Middleware
> --
> *Phone:*55-13-99662-5703 | *Mobile:*55-13-98117-3316
> *E-mail:* *clau...@br.ibm.com* 
>
>
>
> --
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib 1.5.1 - Function pcolormesh throws Segmentation Fault

2016-02-24 Thread Benjamin Root
Sorry, forgot to post the link: https://pypi.python.org/pypi/faulthandler/

On Wed, Feb 24, 2016 at 3:33 PM, Benjamin Root  wrote:

> Could you try using faulthandler and post the traceback please? That'll
> help us isolate the problem better.
>
> Ben Root
>
> On Wed, Feb 24, 2016 at 3:04 PM, Claude Falbriard 
> wrote:
>
>> Dear colleagues,
>>
>>  I've done a build from source of latest *Matplotlib* package and
>> deployed it at our IBM z13 machine (s390x). It uses the current release
>> 1.5.1.
>> During the unit tests I found an issue with a test case from NOAA which
>> uses a* pcolormesh* draw function with *basemap*.
>>
>> Example 2: Plot data from an NWW3 GRiB2 file - [ here:
>> *http://polar.ncep.noaa.gov/waves/examples/usingpython.shtml*
>> <http://polar.ncep.noaa.gov/waves/examples/usingpython.shtml>*]*
>>
>> The following line is causing a *Segmentation fault* error even when
>> adding an 8GB swap memory to the process:
>>
>> cs = m.pcolormesh(x,y,data,shading='flat',cmap=plt.cm.jet)
>>
>> I also tryed to execute other, similar samples that use pcolormesh, but
>> receiving the same error. Is this a known issue or might it be be related
>> to the memory environment ? Any hints how to debug this error?
>>
>> Regards,
>>
>> *Claude Falbriard*
>> Certified IT Specialist L2 - Middleware
>> --
>> *Phone:*55-13-99662-5703 | *Mobile:*55-13-98117-3316
>> *E-mail:* *clau...@br.ibm.com* 
>>
>>
>>
>> --
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib 1.5.1 - Function pcolormesh throws Segmentation Fault

2016-02-24 Thread Benjamin Root
Could you try using faulthandler and post the traceback please? That'll
help us isolate the problem better.

Ben Root

On Wed, Feb 24, 2016 at 3:04 PM, Claude Falbriard 
wrote:

> Dear colleagues,
>
>  I've done a build from source of latest *Matplotlib* package and
> deployed it at our IBM z13 machine (s390x). It uses the current release
> 1.5.1.
> During the unit tests I found an issue with a test case from NOAA which
> uses a* pcolormesh* draw function with *basemap*.
>
> Example 2: Plot data from an NWW3 GRiB2 file - [ here:
> *http://polar.ncep.noaa.gov/waves/examples/usingpython.shtml*
> *]*
>
> The following line is causing a *Segmentation fault* error even when
> adding an 8GB swap memory to the process:
>
> cs = m.pcolormesh(x,y,data,shading='flat',cmap=plt.cm.jet)
>
> I also tryed to execute other, similar samples that use pcolormesh, but
> receiving the same error. Is this a known issue or might it be be related
> to the memory environment ? Any hints how to debug this error?
>
> Regards,
>
> *Claude Falbriard*
> Certified IT Specialist L2 - Middleware
> --
> *Phone:*55-13-99662-5703 | *Mobile:*55-13-98117-3316
> *E-mail:* *clau...@br.ibm.com* 
>
>
>
> --
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pyplot.hexbin

2016-01-30 Thread Benjamin Root
You've already done it. But we encourage you to take a crack at it. I would
suggest just first factoring it out into a new file
lib/matplotlib/hexbin.py and have the current function utilize it. When
that is done, we can look to getting it into numpy as well. We will need a
copy of it ourselves for compatibility with older releases of numpy.

Let us know if you have questions!
Ben Root
On Jan 30, 2016 8:45 PM, "Sebastian"  wrote:

> A thats too bad (that we can't recover the original ids.)
> What could one (as user) do to officially request it be fixed/factored out
> to numpy?
>
>
>
> On Fri, Jan 29, 2016 at 7:30 PM, Thomas Caswell 
> wrote:
>
>> Factor it out and give it to numpy!
>>
>> On Fri, Jan 29, 2016, 17:27 Benjamin Root  wrote:
>>
>>> Hmm, you are right, there is no way to get back the information that
>>> hexbin computed. The hexbin function is massive (in
>>> lib/matplotlib/axes/_axes.py) and is a bit tangled up with the
>>> artist-handling code, too. I think it would make sense to factor out the
>>> hexbinning component into its own hexbin.py that others might be able to
>>> use separately.
>>>
>>> Ben Root
>>>
>>>
>>> On Fri, Jan 29, 2016 at 5:15 PM, Sebastian  wrote:
>>>
>>>> Is there a simple way to hexbin using "pyplot.hexbin" and to return
>>>> the ids of the set of
>>>> points in each hexbin? That is to output an array of n elements
>>>> (one for each hexbin), and each element itself an array with the point
>>>> ids? The sum
>>>> of the number of inner elements would be equal the sum of all points
>>>> (x,y).
>>>>
>>>> Is hexbin missing this simple feature?
>>>>
>>>> Or perhaps specifying C=N.arange(len(x)) then some specific
>>>> "reduced_C_function"
>>>> to return those elements. But I don't know if there is a
>>>> "reduced_C_function" available,
>>>> or perhaps one could be added?
>>>>
>>>> many thanks in advance...
>>>>
>>>> link:
>>>> http://stackoverflow
>>>> .com/questions/18886461/how-can-i-print-a-list-of-the-outputs-from-the-
>>>> hexbin-reduce-c-function/35088073#35088073
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>>> Monitor end-to-end web transactions and take corrective actions now
>>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>>> ___
>>>> Matplotlib-users mailing list
>>>> Matplotlib-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>>
>>>
>>> --
>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>> Monitor end-to-end web transactions and take corrective actions now
>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pyplot.hexbin

2016-01-29 Thread Benjamin Root
Hmm, you are right, there is no way to get back the information that hexbin
computed. The hexbin function is massive (in lib/matplotlib/axes/_axes.py)
and is a bit tangled up with the artist-handling code, too. I think it
would make sense to factor out the hexbinning component into its own
hexbin.py that others might be able to use separately.

Ben Root


On Fri, Jan 29, 2016 at 5:15 PM, Sebastian  wrote:

> Is there a simple way to hexbin using "pyplot.hexbin" and to return the
> ids of the set of
> points in each hexbin? That is to output an array of n elements
> (one for each hexbin), and each element itself an array with the point
> ids? The sum
> of the number of inner elements would be equal the sum of all points (x,y).
>
> Is hexbin missing this simple feature?
>
> Or perhaps specifying C=N.arange(len(x)) then some specific
> "reduced_C_function"
> to return those elements. But I don't know if there is a
> "reduced_C_function" available,
> or perhaps one could be added?
>
> many thanks in advance...
>
> link:
> http://stackoverflow
> .com/questions/18886461/how-can-i-print-a-list-of-the-outputs-from-the-
> hexbin-reduce-c-function/35088073#35088073
>
>
>
>
> --
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Looking for feedback on figures using matplotlib and jupyter notebook

2016-01-28 Thread Benjamin Root
In mpl, our figure objects get numbers assigned to them by default, but
they can also be strings. These labels are used in the figure window title
bar. Perhaps that existing data could be hijacked? Admittedly, most people
use the string name to give nice short names to their figures, so maybe
those names could be the "tag" name in latex? So, all we would need is some
way to supply the actual caption string.

Ben Root


On Thu, Jan 28, 2016 at 10:17 PM, Fernando Perez 
wrote:

> On Thu, Jan 28, 2016 at 3:23 PM, Andreas Mueller  wrote:
>
>> Hi all.
>>
>> This is about a joint jupyter-notebook / matplotlib problem I've been
>> thinking about.
>> So I'm writing a book using jupyter-notebook, and all my figures are
>> generated using matplotlib.
>>
>> In books, there is usually a figure caption with a running number and
>> some description.
>>  From what I read, the best way to add captions is just using plt.text.
>> However, the caption should probably be in the markup,
>> not in a rendered PNG. I'm not sure if changing the backend might help,
>> but that probably doesn't make the notebook happy?
>>
>> The other problem is that I want to have running numbers that I can
>> refer to by a tag (as you would in latex).
>> That is more of a notebook problem, though.
>>
>> Any feedback would be very welcome
>>
>
> I've been wanting to do something about this problem for a while, but
> haven't had the cycles to work on it...  Here's my current idea, perhaps I
> can goad you into implementing it :)
>
> I think that IPython.display should provide a Figure object, capable of
> wrapping any input image (with nice code to automatically swallow a
> matplotlib figure without asking the user to convert it to an image first),
> and taking an optional caption.
>
> Figure() would then produce as output the displayed image but with a bit
> of nice CSS to center it on the page, along with the caption.
>
> The trick is to send the entire data bundle correctly structured so that,
> at the other end, nbconvert could recognize these figures as such, and not
> only produce nice HTML, but more importantly, push them into the LaTeX
> output with the correct call to \figure, including \caption as well as size
> and placement specifiers.
>
> The signature of Figure() might be something like
>
> def Figure(fig, caption=None, width=None, height=None,
>latex_placement=None):
>
>
> I would try implementing this first as a standalone tool, and once it's
> been tested enough in real-world usage with both HTML and LaTeX output from
> nbconvert, it could be merged in.  I suspect it's going to take a few
> iterations to get it right.
>
> But it's not particularly hard, and someone working on a book would be the
> perfect candidate to have enough test cases to be able to iterate until
> happy ;)
>
> If you think you want to take a stab at this, don't hesitate to ping us on
> the jupyter list. We can help with some of the more obscure parts of
> getting this to work on nbconvert (and there may be things I've overlooked
> in the sketch above).
>
> Cheers,
>
> f
>
> --
> Fernando Perez (@fperez_org; http://fperez.org)
> fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
> fernando.perez-at-berkeley: contact me here for any direct mail
>
>
> --
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] applying an image's colormap to another image

2016-01-28 Thread Benjamin Root
You might have better luck asking the scikit-image people, or the Pillow
people. ImageMagick might also have what you are looking for.

Cheers!
Ben Root


On Wed, Jan 27, 2016 at 11:23 PM, Matteo Niccoli  wrote:

> Can something like this (which by the way I can't get to work):
>
> http://stackoverflow.com/questions/3114925/pil-convert-rgb-image-to-a-specific-8-bit-palette
>
> What I would like to do is this:
> 1) Import an RGB image, which would have its own colormap - say this one
> for example:
>
> https://upload.wikimedia.org/wikipedia/commons/b/b3/Jupiter_new_hubble_view_above_pole.png
>
> 2) convert it to intensity, display the intensity color-mapped to the same
> colours the original RGB had.
>
> Any tips, or even better code or pseudocode would be greatly appreciated.
>
> Thanks
> Matteo
>
>
>
> --
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] MultiCursor messes with xlim and ylim autoscaling

2016-01-20 Thread Benjamin Root
Add "blit=False" in the instantiation for multicursor to get around the
copy_from_bbox issue.

I wonder if the use of fig.axes might be a problem?
On Jan 20, 2016 2:27 PM, "Bilheux, Jean-Christophe" 
wrote:

> HI all,
>
> I wanted to help (for a change) but running the script on mac (with the
> multi cursor code commented out), I got the following error. If anyone can
> figure out why !
>
> File
> "/Users/j35/anaconda/lib/python3.4/site-packages/matplotlib/widgets.py",
> line 1046, in clear
> self.canvas.copy_from_bbox(self.canvas.figure.bbox))
> AttributeError: 'FigureCanvasMac' object has no attribute ‘copy_from_bbox'
>
> I’m using python 3.4 and matplotlib 1.4.3
>
> Thanks
>
> Jean
>
>
>
> > On Jan 20, 2016, at 1:26 PM, Michael Kaufman  wrote:
> >
> > Hi Gurus:
> >
> > I'm having a serious problem with MultiCursor and autoscaling...
> >
> > If I do the code below with both MultiCursor instantiations commented
> out, then all plots are xscaled to [50,55] and yscaled to each plot's
> appropriate ylimits.
> >
> > If I uncomment the top MultiCursor instantiation, then both the xlimits
> and ylimits are screwed up: xlim=[0,60] and ylim is all over the place,
> certainly not autoscaled tight.
> >
> > If I uncomment the bottom MultiCursor instantiation, then the xlimit
> appears to be scaled correctly, [50,55], but two of the four plots (lower
> left and upper right) are not autoscaled in y.
> >
> > How to I instantiate MultiCursor to get the normal and expected
> autoscaling behavior?
> >
> > Not that it should matter, but I'm using here Tk and Python3 with MPL
> 1.5dev1 (91ca2a3724ae91d28d97)
> >
> > Thanks for any help,
> >
> > M
> >
> > =
> >
> > from matplotlib import pyplot as pl
> > from matplotlib.widgets import MultiCursor
> > from matplotlib import gridspec
> > import numpy as np
> >
> > if __name__ == "__main__":
> >
> >  fig = pl.gcf()
> >  gs = gridspec.GridSpec(2,2)
> >
> >  ax = None
> >  for g in gs:
> >ax = pl.subplot(g, sharex=ax)
> >
> >  #multi = MultiCursor(fig.canvas, tuple(fig.axes),
> >  #useblit=True, horizOn=True, color='k', lw=1)
> >
> >  x = np.arange(50,55,0.01)
> >  y1 = np.sin(x)
> >  y2 = np.cos(x) + 4
> >  y3 = 0.2*np.cos(x) - 4
> >  y4 = np.cos(2*x) - 1
> >
> >  for ax,y in zip(fig.axes, [y1,y2,y3,y4]):
> >ax.plot(x,y)
> >
> >  for ax in fig.axes:
> >ax.grid()
> >
> >  #multi = MultiCursor(fig.canvas, tuple(fig.axes),
> >  #useblit=True, horizOn=True, color='k', lw=1)
> >
> >  pl.draw()
> >  pl.show()
> >
> --
> > Site24x7 APM Insight: Get Deep Visibility into Application Performance
> > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> > Monitor end-to-end web transactions and take corrective actions now
> > Troubleshoot faster and improve end-user experience. Signup Now!
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> --
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How do I make a Mercator map larger

2016-01-04 Thread Benjamin Root
Without seeing the code, it would be hard to tell what is wrong. Setting
the figure size should work. I do this all the time myself.

As for converting map coordinates to inches, are you talking about inches
of the display? or inches of the map (as opposed to km or miles)?

Ben Root

On Sun, Jan 3, 2016 at 5:20 PM, Martin McGlensey 
wrote:

> Hello,
>
>
>
> I’m a new user to both python and basemap. I’ve got my map working OK, but
> would like to make it larger on the display. I’ve tried the height and
> width parameters in the map definition (m=basemap(…) and
> plt.figure(figuresize=(x,y)). Neither appear to have any effect on the size
> of the map.
>
>
>
> Is there an easy way to convert map coordinates to inches?
>
>
>
> Thanks,
>
> Marty
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Set matplotlibrc color cycle to custom colors using axes.prop_cycle (v1.5)

2015-12-21 Thread Benjamin Root
You can't use the hash symbol when doing colors as a hex in an rcfile. The
rcfile parser is so simple that it treats it as a comment. Don't drop the
quotes.

Ben Root

On Mon, Dec 21, 2015 at 12:51 AM, Thomas Caswell  wrote:

> Not at a computer to test, but try dropping the quotes.
>
> On Sun, Dec 20, 2015, 20:56 Julian Irwin  wrote:
>
>> Hi,
>>
>> I'm trying to set my default color cycle in my matplotlibrc using
>> axes.prop_cycle. The documentation (as far as I could find...) only gives
>> examples like
>>
>> axes.prop_cycle: cycler('color', 'bgrcmyk')
>>
>>
>> And then the comment below says, cryptically:
>>
>> # as list of string colorspecs:
>> # single letter, long name, or
>> # web-style hex
>>
>> But I have tried all sorts of variatns on:
>>
>> axes.prop_cycle: cycler('color', ['#e41a1c', '#377eb8', '#4daf4a', 
>> '#ff7f00', '#a65628', '#f781bf', '#99', '#984ea3', '#33'])
>>
>> But I always get an error upon importing matplotlib. Is there any doc on
>> how to do this properly? Is this even supported?
>>
>> Thanks,
>> Julian
>>
>> --
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] SpanSelector span_stays does not work for me

2015-12-14 Thread Benjamin Root
Have you tried setting "useblit=False"? If that works, I wonder if we
accidentally broke something in the recent widget interactivity work...


Ben Root

On Fri, Dec 11, 2015 at 7:48 PM, Edward Richards 
wrote:

> I am selecting a region of a color plot with span selector, and I would
> like the selected region to stay highlighted. I found the span_stays flag,
> but the selection rectangle still disappears after I release the mouse.
>
> Any help is appreciated.
> Thanks,
> Ned
>
> My backend is 'TkAgg'
>
> I am running the script from python3.4 at the command line, my version is:
>
> Python 3.4.3 (default, Jun 19 2015, 05:46:30)
> [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> print(matplotlib.__version__)
> 1.5.0
>
> code example:
>
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.widgets import SpanSelector
>
> test_data = np.random.randn(1000, 1000)
> fig, ax = plt.subplots()
> ax.imshow(test_data)
>
> def selection(x1, x2):
>  """This function isn't the point"""
>  pass
>
> span = SpanSelector(ax, selection, 'horizontal', useblit=True,
>  rectprops=dict(alpha=0.5, facecolor='red'),
> span_stays=True)
> plt.show()
>
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Legend frame edgecolor and linewidth

2015-11-13 Thread Benjamin Root
Indeed, it looks like there isn't a very good way to control all of the
properties of the frame portion of a legend. This could certainly use some
improvements, partly in allowing a dictionary of property values to be
passed in `plt.legend()` (there is already a dictionary of font
properties), but also to have some rcParams that could be made available,
too. Such improvements are always welcome!

Cheers!
Ben Root

On Fri, Nov 13, 2015 at 7:57 AM, Daniele Nicolodi 
wrote:

> Hello,
>
> there is a way to control the edgecolor and the linewidth of the frame
> drawn around the legend?  I set the axes linewidth to 0.5 but the legend
> frame linewidth is set to 1.0 and it does not look nice. Also, most of
> the time I don't want the frame edge to be drawn at all.
>
> Always doing:
>
>   l = plt.legend()
>   l.get_frame().set_edgecolor('none')
>
> is boring.
>
> If the setting are not there, would a patch adding a setting to style
> the legend frame be considered? Additionally, would it make sense to
> default the legend frame linewidth to the axes linewidth?
>
> Cheers,
> Daniele
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Inset plot with a previously draw plot

2015-10-29 Thread Benjamin Root
An axes can only belong to one figure at a time. And I also don't think I
have ever seen anyone try and transfer an axes from one figure to another.

You *might* have luck with inset locators from axes_grid:
http://matplotlib.org/examples/axes_grid/inset_locator_demo.html

Cheers!
Ben Root

On Thu, Oct 29, 2015 at 12:07 PM, Alejandro Weinstein <
alejandro.weinst...@gmail.com> wrote:

> Hi,
>
> I have a previously draw plot that I want to place as an inset in
> another figure. I've tried with passing the previously drawn axes as
> the `axes` parameter to the `add_axes` method of the figure, and also
> tried using the `set_axes` method of the new axes, without success: I
> get the new inset axes, but without the previously drawn plot, in both
> cases.
>
> The following code shows both approaches:
>
> # Passing the inset axes as a parameter to add_axes
> fig_in, ax_in = plt.subplots()
> ax_in.plot([1,2,3])
> fig, ax = plt.subplots()
> ax.plot([1,2,1])
> fig.add_axes([0.72, 0.72, 0.16, 0.16], axes=ax_in)
>
> # Using set_axes
> fig_in, ax_in = plt.subplots()
> ax_in.plot([1,2,3])
> fig, ax = plt.subplots()
> ax.plot([1,2,1])
> ax_new = fig.add_axes([0.72, 0.72, 0.16, 0.16])
> ax_new.set_axes(ax_in)
>
> Any help with this will be appreciated.
>
> Regards,
> Alejandro
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] basemap: how to plot "toothed" curves

2015-10-16 Thread Benjamin Root
Looks like someone else figured out a creative solution using quiver:
http://stackoverflow.com/questions/19918502/sawtooth-line-style-in-matplotlib

Here it is (slightly cleaned up):

import matplotlib.pyplot as pltimport numpy as np

x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)

dx = np.diff(x)
dy = np.diff(y)

x2 = np.linspace(0, 2*np.pi, 10)
y2 = np.sin(x2)

dx = np.zeros_like(x2) + 1e-12
dy = np.sin(x2 + dx) - y2

length = np.hypot(dx, dy)
dx /= length
dy /= length

fig, ax = plt.subplots()
ax.set_aspect("equal")
ax.plot(x, y, lw=4)

size = 20
ax.quiver(x2, y2, -dy, dx, headaxislength=size, headlength=size,
headwidth=size, color="blue")
plt.margins(0.2)


I don't know yet how to get rounded heads, though. Now I am looking to see
how the text box styles of "sawtooth" and "roundtooth" are handled in the
code to see if that could be exploited, instead.

Cheers!
Ben Root



On Fri, Oct 16, 2015 at 10:24 AM, Benjamin Root 
wrote:

> Hmmm, this is actually an interesting problem. I am also a meteorologist,
> so this is interesting to me.
>
> I haven't figured it out yet, but here are my thoughts:
>
> 1) There are the "^" triangle markers as well as "2" tri_up markers:
> http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb#Markers
> 2) The markevery property should be set to a float value to have the
> markers spaced out evenly along the line regardless of aspect ratios and
> zooming (note, this assumes that the line is defined with many vertices to
> give a smooth appearance).
>
> Problem:
> Using markers and markevery in a Line2D object has an inherent limitation:
> all of the markers will be drawn in the same orientation. So, we can't
> orient the markers along the normal of the line.
> Also, there is no pre-defined marker for half-circles, so this approach
> wouldn't work well for warm-fronts/dry-lines/etc.
>
> I'll have to see if a PolygonCollection + Line2D might be the right
> approach here...
>
> Ben Root
>
>
>
>
> On Fri, Oct 16, 2015 at 7:22 AM, Phil Cummins 
> wrote:
>
>> Hi,
>>
>> I would like to plot "toothed" curves using basemap. These are curves
>> with triangles on one side, that are used to plot pressure fronts in
>> meteorology or thrust faults in geology. You need to be able to say which
>> side of the curve the triangles should appear on. Does anyone know whether
>> such curves can be plotted using mtplotlib/basemap?
>>
>> Thanks,
>>
>> - Phil
>>
>> Australian National University
>>
>>
>>
>>
>> --
>>
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] basemap: how to plot "toothed" curves

2015-10-16 Thread Benjamin Root
Hmmm, this is actually an interesting problem. I am also a meteorologist,
so this is interesting to me.

I haven't figured it out yet, but here are my thoughts:

1) There are the "^" triangle markers as well as "2" tri_up markers:
http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb#Markers
2) The markevery property should be set to a float value to have the
markers spaced out evenly along the line regardless of aspect ratios and
zooming (note, this assumes that the line is defined with many vertices to
give a smooth appearance).

Problem:
Using markers and markevery in a Line2D object has an inherent limitation:
all of the markers will be drawn in the same orientation. So, we can't
orient the markers along the normal of the line.
Also, there is no pre-defined marker for half-circles, so this approach
wouldn't work well for warm-fronts/dry-lines/etc.

I'll have to see if a PolygonCollection + Line2D might be the right
approach here...

Ben Root




On Fri, Oct 16, 2015 at 7:22 AM, Phil Cummins 
wrote:

> Hi,
>
> I would like to plot "toothed" curves using basemap. These are curves with
> triangles on one side, that are used to plot pressure fronts in meteorology
> or thrust faults in geology. You need to be able to say which side of the
> curve the triangles should appear on. Does anyone know whether such curves
> can be plotted using mtplotlib/basemap?
>
> Thanks,
>
> - Phil
>
> Australian National University
>
>
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TypeError: can't multiply sequence by non-int of type 'float'

2015-09-29 Thread Benjamin Root
You have some logic issues here. First off, I wouldn't be updating the plot
in the same function that is updating the data values. Assuming that
"loop_start()" is asynchronous, the update frequency for it is likely to be
entirely different from the Animation update frequency. So, just have that
function do updates. You should also declare x, y, and z as globals in that
function so that the reassignment of those arrays persist properly.


Your list comprehension prior to concatenating uses a variable "x", which
is likely causing the current error that you see. Change that name to
something else.

Lastly, I implore you to use "set_data()" like in the original example,
rather than calling plot() repeatedly.

Cheers!
Ben Root


On Tue, Sep 29, 2015 at 2:05 PM, Shakthi Kannan 
wrote:

> Hi,
>
> I was able to get past the error, and I am now trying to add a
> callback to receive values from a queue, add it to the existing poly
> line, and render the same using matplotlib. The code snippet is shown
> below:
>
> === BEGIN ===
>
> import matplotlib as mpl
> from mpl_toolkits.mplot3d import Axes3D
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.animation as animation
> import sys
> import paho.mqtt.client as mqtt
>
> def update_line(num, x, y, z, l):
> print x, y, z
> l, = ax.plot(x, y, z, label='Line')
> return l,
>
> def on_connect(client, userdata, flags, rc):
> print("Connected with result code "+str(rc))
> client.subscribe("hello/world")
>
> def on_message(client, userdata, msg):
> data = msg.payload
> print(msg.topic+" "+str(msg.payload))
> point = np.asarray([float(x) for x in data.split()])
> print point
> x=np.concatenate((x,[point[0]]))
> y=np.concatenate((y,[point[1]]))
> z=np.concatenate((z,[point[2]]))
> l, = ax.plot(x, y, z, label='Line')
> return l,
>
> fig = plt.figure()
> ax = fig.gca(projection='3d')
> ax.set_xlabel('X')
> ax.set_ylabel('Y')
> ax.set_zlabel('Z')
>
> x = np.array([1.0, 2.0, 3.0])
> print type(x)
> y = np.array([4.0, 7.0, 8.0])
> z = np.array([6.0, 9.0, 5.0])
>
> l, = ax.plot(x, y, z, label='Line')
> ax.legend()
>
> client = mqtt.Client()
> client.on_connect = on_connect
> client.on_message = on_message
> client.connect_async("localhost", 1883, 60)
> client.loop_start()
>
> line_ani = animation.FuncAnimation(fig, update_line, 25, fargs=(x, y,
> z, l), interval=2000, blit=True)
>
> plt.show()
>
> === END ===
>
> I now hit the following error:
>
> === ERROR ===
>
>  $ python mat-3.py
> 
> [ 1.  2.  3.] [ 4.  7.  8.] [ 6.  9.  5.]
>  Connected with result code 0
> [ 1.  2.  3.] [ 4.  7.  8.] [ 6.  9.  5.]
> [ 1.  2.  3.] [ 4.  7.  8.] [ 6.  9.  5.]
> [ 1.  2.  3.] [ 4.  7.  8.] [ 6.  9.  5.]
> hello/world 34.56 15.912 0.72
> [ 34.56   15.912   0.72 ]
> Exception in thread Thread-1:
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
> self.run()
>   File "/usr/lib/python2.7/threading.py", line 763, in run
> self.__target(*self.__args, **self.__kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py",
> line 2287, in _thread_main
> self.loop_forever()
>   File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py",
> line 1261, in loop_forever
> rc = self.loop(timeout, max_packets)
>   File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py",
> line 811, in loop
> rc = self.loop_read(max_packets)
>   File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py",
> line 1073, in loop_read
> rc = self._packet_read()
>   File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py",
> line 1475, in _packet_read
> rc = self._packet_handle()
>   File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py",
> line 1943, in _packet_handle
> return self._handle_publish()
>   File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py",
> line 2118, in _handle_publish
> self._handle_on_message(message)
>   File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py",
> line 2274, in _handle_on_message
> self.on_message(self, self._userdata, message)
>   File "mat-3.py", line 23, in on_message
> x=np.concatenate((x,[point[0]]))
> ValueError: zero-dimensional arrays cannot be concatenated
>
> [ 1.  2.  3.] [ 4.  7.  8.] [ 6.  9.  5.]
> [ 1.  2.  3.] [ 4.  7.  8.] [ 6.  9.  5.]
> [ 1.  2.  3.] [ 4.  7.  8.] [ 6.  9.  5.]
>
> ...
>
> === END ===
>
> Is there a better way to re-render the plot after receiving data?
>
> Thanks!
>
> SK
>
> --
> Shakthi Kannan
> http://www.shakthimaan.com
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--

Re: [Matplotlib-users] TypeError: can't multiply sequence by non-int of type 'float'

2015-09-28 Thread Benjamin Root
Jerzy,

On Mon, Sep 28, 2015 at 4:25 PM, Jerzy Karczmarczuk <
jerzy.karczmarc...@unicaen.fr> wrote:

>
> Le 28/09/2015 21:03, Benjamin Root a écrit :
>
>> Where does he multiply a list by a float? The traceback shows the
>> multiplication happening much further down in the draw stack.
>>
>
> Look, Benjamin Root, I don't know, and I will not "investigate" where this
> operation happens.


I did not ask you to investigate anything for me. You made the assertion
that the user was multiplying a list by a float, therefore, I assumed that
you were seeing something that I had not seen.


> The diagnosis is a standard Python message. Thus, I took the program of
> Shakhti Kannan, and in a few seconds I changed
>
>
> x = [1.0, 2.0, 3.0] into  x = np.array([1.0, 2.0, 3.0])
>
> and in update_line:   x.append(1.0)   into x=np.concatenate((x,[1.0]))
>
> And the program began to run without error messages. So, please, these are
> FACTS: somewhere the lists x,y,z get down in this draw stack.
>
>
I realize that, and that isn't in dispute. Nowhere did I say that
converting the lists into numpy arrays would not solve the problem.


> That shouldn't matter. ax.plot() accepts lists as valid inputs and it
>> should be converting them into numpy arrays under the hood.
>>
>
> There are two different issues, accepting any sequences/iterators is one,
> converting them into arrays - another one. This second operation visibly
> doesn't take place.
>
>
Of course the second operation isn't visible. I did say that it happens
"under the hood". His program is perfectly valid (albeit not ideal) and
demonstrated a bug in matplotlib's codebase. That is why I asked him to
file a bug report. My reading of your email is that you are upset for some
reason, but I have no clue why.

Ben Root
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TypeError: can't multiply sequence by non-int of type 'float'

2015-09-28 Thread Benjamin Root
On Mon, Sep 28, 2015 at 2:28 PM, Jerzy Karczmarczuk <
jerzy.karczmarc...@unicaen.fr> wrote:

> Shakhti Kannan tries to multiply a list by a float, and Python disagrees.
>
>
Where does he multiply a list by a float? The traceback shows the
multiplication happening much further down in the draw stack.


> Le 28/09/2015 17:43, Benjamin Root comments :
> > Could you file a bug report? This is going to need some investigating.
>
> ==
>
> I suspect that it can be solved without Hercule Poirot.
> Convert *at the beginning* your lists x,y,z into np.arrays.
> (also: append  ==>  concatenate)
>

That shouldn't matter. ax.plot() accepts lists as valid inputs and it
should be converting them into numpy arrays under the hood. Indeed, if one
takes out the animation creation, the code works just fine. Adding new
plots(), while inefficient, shouldn't cause this problem.

Ben Root
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TypeError: can't multiply sequence by non-int of type 'float'

2015-09-28 Thread Benjamin Root
Confirmed using a fairly recent matplotlib checkout. Could you file a bug
report? This is going to need some investigating.

As a side note though, the way you are updating the lines by calling
`ax.plot` repeatedly, is bad form. You want to update the lines object
itself, by calling its "set_data()" method. Also, move the call to
`ax.legend()` to after calling `ax.plot` to avoid the warnings about
unlabeled plotting objects.

On Sat, Sep 26, 2015 at 3:46 AM, Shakthi Kannan 
wrote:

> Hi,
>
> I am trying to create poly lines using matplotlib and animation. My
> code snippet is as follows:
>
> === BEGIN ===
>
> import matplotlib as mpl
> from mpl_toolkits.mplot3d import Axes3D
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.animation as animation
>
> def update_line(num, x, y, z, l):
> x.append(1.0)
> y.append (2.0)
> z.append(3.0)
> print x, y, z
> l, = ax.plot(x, y, z, label='Line')
> return l,
>
> fig = plt.figure()
> ax = fig.gca(projection='3d')
> ax.set_xlabel('X')
> ax.set_ylabel('Y')
> ax.set_zlabel('Z')
> ax.legend()
>
> x = [1.0, 2.0, 3.0]
> y = [4.0, 7.0, 8.0]
> z = [6.0, 9.0, 5.0]
>
> l, = ax.plot(x, y, z, label='Line')
>
> line_ani = animation.FuncAnimation(fig, update_line, 25, fargs=(x, y,
> z, l), interval=2000, blit=True)
>
> plt.show()
>
> === END ===
>
> The error that I get:
>
> === ERROR ===
>
> $ python mat-3.py
>
> /usr/lib/pymodules/python2.7/matplotlib/axes.py:4747: UserWarning: No
> labeled objects found. Use label='...' kwarg on individual plots.
>   warnings.warn("No labeled objects found. "
> [1.0, 2.0, 3.0, 1.0] [4.0, 7.0, 8.0, 2.0] [6.0, 9.0, 5.0, 3.0]
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1535, in __call__
> return self.func(*args)
>   File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 586, in callit
> func(*args)
>   File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py",
> line 363, in idle_draw
> self.draw()
>   File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py",
> line 348, in draw
> FigureCanvasAgg.draw(self)
>   File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py",
> line 451, 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 1034, in
> draw
> func(*args)
>   File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py",
> line 270, in draw
> Axes.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/axes.py", line 2086, in
> draw
> a.draw(renderer)
>   File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/art3d.py",
> line 117, in draw
> xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
>   File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/proj3d.py",
> line 194, in proj_transform
> return proj_transform_vec(vec, M)
>   File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/proj3d.py",
> line 153, in proj_transform_vec
> vecw = np.dot(M, vec)
> TypeError: can't multiply sequence by non-int of type 'float'
> [1.0, 2.0, 3.0, 1.0, 1.0] [4.0, 7.0, 8.0, 2.0, 2.0] [6.0, 9.0, 5.0, 3.0,
> 3.0]
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1535, in __call__
> return self.func(*args)
>   File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py",
> line 276, in resize
> self.show()
>   File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py",
> line 348, in draw
> FigureCanvasAgg.draw(self)
>   File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py",
> line 451, 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 1034, in
> draw
> func(*args)
>   File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py",
> line 270, in draw
> Axes.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/axes.py", line 2086, in
> draw
> a.draw(renderer)
>   File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/art3d.py",
> line 117, in draw
> xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
>   File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/proj3d.py",
> line 194, in proj_transform
> return proj_transform_vec(vec, M)
>   File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplo

Re: [Matplotlib-users] Fwd: bug report

2015-09-16 Thread Benjamin Root
Btw, I can't reproduce the problem using matplotlib master, numpy master
and linux. I know it isn't at all similar to your setup, but it is a data
point.

On Wed, Sep 16, 2015 at 9:43 AM, Benjamin Root  wrote:

> What version of numpy do you have installed?
>
> On Wed, Sep 16, 2015 at 5:35 AM, Bobby Wilkins 
> wrote:
>
>> OS: Windows 8.1 Pro
>>
>> matplotlib version: 1.4.3
>>
>> where obtained: http://www.lfd.uci.edu/~gohlke/pythonlibs/
>>
>> customizations: none
>>
>> Sample Program: attached py file; this is a Physics homework problem; I
>> have the answers I need, but would like to fix the errors to be able to
>> label all lines.
>>
>> Debug output in attached output.txt file
>>
>> If you uncomment line 180, the error is reported as if it came from that
>> line even though there is no float64 on that line (savefig).  If commented,
>> it does not report a line from my .py file...
>>
>> If you make line 170 read as follows, the error goes away:
>>
>> if (maxTerm<32):
>>
>> This suggests to me that the additional labels for the 32, 64, 128, and
>> 154 term runs is what is triggering the bug, but I cannot figure out what
>> it is.
>>
>> Also, separate note, just about any time I make figures, when closing the
>> last figure I get a python.exe app crash and this message:
>>
>> alloc: invalid block: 044E7680: 0 d
>>
>>
>> Thank you for any help,
>> Bobby
>>
>>
>>
>> --
>> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
>> Get real-time metrics from all of your servers, apps and tools
>> in one place.
>> SourceForge users - Click here to start your Free Trial of Datadog now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: bug report

2015-09-16 Thread Benjamin Root
What version of numpy do you have installed?

On Wed, Sep 16, 2015 at 5:35 AM, Bobby Wilkins 
wrote:

> OS: Windows 8.1 Pro
>
> matplotlib version: 1.4.3
>
> where obtained: http://www.lfd.uci.edu/~gohlke/pythonlibs/
>
> customizations: none
>
> Sample Program: attached py file; this is a Physics homework problem; I
> have the answers I need, but would like to fix the errors to be able to
> label all lines.
>
> Debug output in attached output.txt file
>
> If you uncomment line 180, the error is reported as if it came from that
> line even though there is no float64 on that line (savefig).  If commented,
> it does not report a line from my .py file...
>
> If you make line 170 read as follows, the error goes away:
>
> if (maxTerm<32):
>
> This suggests to me that the additional labels for the 32, 64, 128, and
> 154 term runs is what is triggering the bug, but I cannot figure out what
> it is.
>
> Also, separate note, just about any time I make figures, when closing the
> last figure I get a python.exe app crash and this message:
>
> alloc: invalid block: 044E7680: 0 d
>
>
> Thank you for any help,
> Bobby
>
>
>
> --
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Creating axes with fixed distance from figure edge

2015-09-09 Thread Benjamin Root
What might be more generally useful is to make it easier to specify which
coordinate system you wish some spec to apply to. To be frank, I can never
keep the transform names straight, and it isn't possible to specify it at
all in some places.
On Sep 9, 2015 6:04 PM, "Thomas Robitaille" 
wrote:

> I managed to write an Axes sub-class to do this:
>
> https://gist.github.com/astrofrog/8d579ea83e578a9cdb99
>
> Try running this then resize the figure and the margin between axes
> and figure edge will stay constant.
>
> Is this something that would be useful to have in Matplotlib itself? I
> could foresee something like:
>
> fig.add_axes([0.1, 0.1, 0.8, 0.8], preserve_absolute_margins=True)
>
> If this would be useful, I can open a pull request.
>
> Cheers,
> Tom
>
> On 9 September 2015 at 23:29, Thomas Robitaille
>  wrote:
> > Thanks Eric - unfortunately I need to be able to resize the figure
> > interactively and have the axes follow.
> >
> > So an alternative that would be equally useful for me would be to
> > specify axes using add_subplot or add_axes but then essentially have
> > an option to say that the distance to the edge of the figure should be
> > preserved when resizing. In other words, I'm not too concerned about
> > whether I specify the original axes position in relative units or in
> > inches, but the important thing is that the distance to the edge of
> > the figure stays constant in absolute terms.
> >
> > Is this something that would be easy to build as an Axes subclass?
> >
> > Cheers,
> > Tom
> >
> >
> >
> > On 9 September 2015 at 23:12, Eric Firing  wrote:
> >> On 2015/09/09 11:01 AM, Thomas Robitaille wrote:
> >>>
> >>> Hi everyone,
> >>>
> >>> I am interested in creating axes in an interactive figure where the
> >>> distance from the spines of the axes to the figure edge are constant
> >>> in absolute terms.
> >>>
> >>> To clarify what I mean, when using add_axes([0.1, 0.1, 0.8, 0.8]), the
> >>> spines of the axes are always located a distance from the edge of the
> >>> figure that is 10% of the size of the figure. However, in my case,
> >>> since the font size is constant, I want to be able to say that the
> >>> spines should always be e.g. 0.5" from the edge of the figure, which
> >>> would avoid wasting space when making the figure larger.
> >>>
> >>> Is there a way to do this currently?
> >>
> >>
> >> This is what I use for positioning in inches:
> >>
> >> def axes_inches(fig, rect, **kw):
> >> """
> >> Wrapper for Figure.add_axes in which *rect* is given in inches.
> >> The translation to normalized coordinates is done immediately
> >> based on the present figsize.
> >>
> >> *rect* is left, bottom, width, height in inches
> >> *kw* are passed to Figure.add_axes
> >>
> >> """
> >>
> >> fw = fig.get_figwidth()
> >> fh = fig.get_figheight()
> >> l, b, w, h = rect
> >> relrect = [l / fw, b / fh, w / fw, h / fh]
> >> ax = fig.add_axes(relrect, **kw)
> >> return ax
> >>
> >> Note, however, that this works correctly only if you don't change
> figsize
> >> after calling it, so maybe it is not what you are looking for.
> >>
> >> Eric
> >>
> >>>
> >>> (I am aware of set_tight_layout which would result in something
> >>> similar, but this is not what I am after - I would like to be able to
> >>> specify the exact absolute distance from the figure edge)
> >>>
> >>> Thanks!
> >>> Tom
> >>>
> >>>
> >>>
> --
> >>> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> >>> Get real-time metrics from all of your servers, apps and tools
> >>> in one place.
> >>> SourceForge users - Click here to start your Free Trial of Datadog now!
> >>> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> >>> ___
> >>> Matplotlib-users mailing list
> >>> Matplotlib-users@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>>
> >>
>
>
> --
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140___
Matplotl

Re: [Matplotlib-users] Matplotlib Curve Overlapping with Animated plot

2015-09-09 Thread Benjamin Root
Thales,

Sorry for the delay in responding. This mailing list has actually moved to
https://mail.python.org/mailman/listinfo/matplotlib-users

Let's start up a new thread there with this information, plus also which
version of matplotlib you are using and which backend.

Cheers!
Ben Root


On Wed, Aug 26, 2015 at 6:12 PM, Thales Maia  wrote:

> Hello,
>
> I am migrating from octave to python and found matplotlib as an useful and
> powerful resource.
> I played with many animations examples and tried to build my own.
>
> The objective is to build a live plot from data coming from an arduino.
> The serial is working perfect (I can receive and plot data without
> problem).
>
> Unfortunately, when I resize my animation windows, I get curves
> overlapped.
>
> I must use blit because I have 6 subplots.
>
> Please, check the attached files:
> Python:
> -> animationR00.py (main)
> -> lib/
>  -> AnalogPlot.py
>  -> RingBuffer.py
>  -> crc8.py
>
> Arduino:
> Teste.cpp (main)
> Teste.h
> ComSerial.cpp
> ComSerial.h
> OneWire.cpp
> OneWire.h
> I appreciate any help.
> -
> Thales Alexandre Carvalho Maia
>
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting from a data file

2015-08-14 Thread Benjamin Root
All "cbook.get_sample_data(..., asfileobj=False)" does is returns the full
filename path to a given file stored in our package for demonstration
purposes. You can ignore that entirely. Just say "fname = 'foobar.csv'" and
have your own csv file called "foobar.csv" sitting in your current working
directory. "plotfile()" works by reading in a CSV file and plotting the
columns given. So, the CSV file will need in its first line those column
headers. The first one given will be for the x-axis, while the rest are for
the individual lines.

Does that help?
Ben Root


On Fri, Aug 14, 2015 at 1:05 PM, Kevin Parks  wrote:

> Hi,
>
> That doesn’t work. Just having my own msft.csv file in my directory
> doesn't change anything as it is still pointing to some other msft.csv
> someplace on my computron. (what and where is this file?)
>
> I also have never opened a file this way. I had prevously just used
> something like:
>
> for l in open(filename).readlines():
>l = l.strip().split()
>data.append([float(l[0]), float(l[1]), float(l[2]), int(l[3])])
>
> values = [1,2,3,4]
>
> -
>
> I think ithis is just some example file that gets installed some place so
> that the examples work?
>
> What does asfileobj=False do?
>
> Goodness the whole world of Python has radically changed in the short time
> I have been out of the game.
>
>
>
> > On Aug 15, 2015, at 1:50 AM, Christian Alis  wrote:
> >
> > The sample code reads data from msft.csv. If you enter your data into
> > a text editor and save it as msft.csv in python's current working
> > directory, then the following minimal code (pruned from plotfile_demo)
> > should work:
> >
> > from pylab import plotfile, show, gca
> > import matplotlib.cbook as cbook
> >
> > fname = cbook.get_sample_data('msft.csv', asfileobj=False)
> >
> > #test 5; single subplot
> > plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False)
> >
> > show()
> >
>
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Error when importing pyplot from matplotlib: »invalid literal for float(): 19#«

2015-08-10 Thread Benjamin Root
I don't know for certain, but perhaps the font-forge program has a repair
utility? http://fontforge.github.io/en-US/

On Sat, Aug 8, 2015 at 5:51 AM, knight91  wrote:

> Okay, is there a way to get an afm font file with a nicely formed header?
> How
> could I try to solve this problem?
>
>
> Thomas Caswell wrote
> > You have an afm font file with a badly formed header.  I thought this was
> > fixed on the master branch though
> >
> > On Fri, Aug 7, 2015 at 4:51 PM knight91 <
>
> > knight91@
>
> > > wrote:
> >
> >> Python claims to be unable to import pyplot. Apart from that, it has
> been
> >> running absolutely fine.
> >>
> >> I tried different versions of matplotlib, the one provided in my package
> >> manager (apt-get) and two (stable & last stable) releases compiled from
> >> source. I reinstalled all packages containting "python" on my system
> >> (Ubuntu
> >> 14.04 LTS). This error still occurs and prevents me from using pyplot.
> >>
> >> What should I try next?
> >>
> >> Python 2.7.6 (default, Jun 22 2015, 17:58:13)
> >> [GCC 4.8.2] on linux2
> >> >>> from matplotlib import pyplot
> >> Traceback (most recent call last):
> >> File "
> > 
> > ", line 1, in
> > 
> >> File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in
> >>
> > 
> >>   import matplotlib.colorbar
> >> File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in
> >>
> > 
> >>   import matplotlib.collections as collections
> >> File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23,
> >> in
> >>
> > 
> >>   import matplotlib.backend_bases as backend_bases
> >> File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line
> 50,
> >> in
> >>
> > 
> >>   import matplotlib.textpath as textpath
> >> File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 11, in
> >>
> > 
> >>   import matplotlib.font_manager as font_manager
> >> File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
> >> 1356,
> >> in
> > 
> >>   _rebuild()
> >> File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
> >> 1341,
> >> in _rebuild
> >>   fontManager = FontManager()
> >> File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
> >> 1008,
> >> in __init__
> >>   self.afmlist = createFontList(self.afmfiles, fontext='afm')
> >> File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
> 563,
> >> in
> >> createFontList
> >>   font = afm.AFM(fh)
> >> File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 342, in
> >> __init__
> >>   parse_afm(fh)
> >> File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 330, in
> >> parse_afm
> >>   dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
> >> File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 203, in
> >> _parse_char_metrics
> >>   bbox = _to_list_of_floats(vals[3][2:])
> >> File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 69, in
> >> _to_list_of_floats
> >>   return [_to_float(val) for val in s.split()]
> >> ValueError: invalid literal for float(): 19#
> >>
>
>
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000p46002.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [matplotlib-devel] IMPORTANT: Mailing lists are moving

2015-07-31 Thread Benjamin Root
nabble is also another fairly commonly used resource for viewing archived
discussions.

On Fri, Jul 31, 2015 at 2:14 PM, Jouni K. Seppänen  wrote:

> Neal Becker  writes:
>
> > I read via gmane: I guess this will need to be updated?
>
> I attempted to send a message to gmane.discuss to request this, but it
> seems there is some problem with that mailing list - the latest message
> is from July 17 when viewed via NNTP, and usually there are at several
> messages per week. I have emailed the gmane.org administrator to ask
> about the status.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
>
> --
> ___
> Matplotlib-devel mailing list
> matplotlib-de...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib differences MacOSXAgg and others

2015-07-15 Thread Benjamin Root
We have been recently fixing a bunch of issues in the macosx backend (which
is default on Macs). Having the circle be dotted sounds exactly like the
sort of problem that would be caused by some of the bugs we are addressing.
I think we have some of the fixes committed to the master branch, so if you
could build and install from git, you can see if the problem is fixed yet
or not.

Ben Root


On Wed, Jul 15, 2015 at 10:29 AM, John Coppens  wrote:

> Hello again,
>
> I've posted these two issues in separate mails, as I suspect they're
> actually different problems.
>
> This error is particular to the default version of MacOSX's matplotlib
> version 1.4.3:
>
> When doing a simple plot:
>
> import matplotlib.pyplot as plt
>
> def test_plot():
> x = range(11)
> y = [x0**2 for x0 in x]
>
> plt.plot(x, y, 'o:', fillstyle='none', label = "1", ms = 10)
> plt.legend()
> plt.show()
>
> def main(args):
> test_plot()
> return 0
>
> if __name__ == '__main__':
> import sys
> sys.exit(main(sys.argv))
>
> Much of the data is available on this thread on stackoverflow:
>
>
> http://stackoverflow.com/questions/31408928/how-can-i-plot-hollowed-symbols-connected-with-dotted-lines-in-one-go/31410105?noredirect=1#comment50794519_31410105
>
> The gist is that a dotted line ('o:') works correctly
> on my system (Linux Slackware/matplotlib 1.3.1 and 1.4.3), on C.C.Yang's
> Linux Mint, but not on his MacOSX (on which the _circle symbols_ are also
> dotted).
>
> It does work if he defines TkAgg or GtkAgg (even though he does not have
> Gtk installed on his Mac)
>
> Any suggestions to solve this?
>
> Is there a problem in the MacOSXAgg backend?
>
> John
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib 1.4.3 Agg problem

2015-07-15 Thread Benjamin Root
If your backend is set to Agg, then no interactive window will appear upon
call to show(). Agg is intended for headless servers. What might be
happening is that somewhere, you have Agg set as the default backend.

Ben Root

On Wed, Jul 15, 2015 at 10:16 AM, John Coppens  wrote:

> Hello all.
>
> I had MatPlotLib 1.3.1 installed, and decided to upgrade to 1.4.3. I
> compiled the
> .tar.gz package, which went without a hitch (except for a number of
> warnings
> from gcc). Installation also completed without problems.
>
> But, on running the same simple plot I was working on, no plot was output:
>
> import matplotlib.pyplot as plt
>
> def test_plot():
> x = range(11)
> y = [x0**2 for x0 in x]
>
> plt.plot(x, y, 'o:', fillstyle='none', label = "1", ms = 10)
> plt.legend()
> plt.show()
>
> def main(args):
> test_plot()
> return 0
>
> if __name__ == '__main__':
> import sys
> sys.exit(main(sys.argv))
>
> which was somewhat annoying, as I was trying to help out someone on
> Stackoverflow. Only after experimenting somewhat, I found that
> setting the Agg to GtkAgg, the plot started working again:
>
> import matplotlib
> matplotlib.use('GtkAgg')
>
> Is this normal? I'm not actually using gtk in this project.
> TkAgg also works.
>
> John
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question on spherical coordinate plots

2015-07-10 Thread Benjamin Root
Your theta and phi were essentially 1D rather than 2D, so it didn't allow
for 2 degrees of freedom. And you don't need np.outer() for this:

theta = np.linspace(0,   np.pi, 500)[:, None]
phi   = np.linspace(0, 2*np.pi, 500)[None, :]

r = f(theta, phi)
x = r**2 * np.cos(phi) * np.sin(theta)
y = r**2 * np.sin(phi) * np.sin(theta)
z = r**2 * np.cos(theta)

The use of np.outer() in the original example acted a bit like a creating a
grid of u/v values in a 2D grid. However, your formulation required
computing a 2D grid of radius values in order to work correctly.

Cheers!
Ben Root

On Fri, Jul 10, 2015 at 7:54 AM, Romain Madar  wrote:

>  Dear experts,
>
> I am trying to plot spherical harmonics with matplotlib and I have some
> troubles. I am starting from the example
> http://matplotlib.org/examples/mplot3d/surface3d_demo2.html where I
> change the factor 10 in a function of r=f(theta,phi) (or r=f(u,v) as they
> are named in the example). I observe very strange behaviours:
>
> (1) (x,y,z) = (r cos(phi) sin(theta) , r sin(phi) sin(theta) , r
> cos(theta)). But np.outer(a,b) is not commutative while the multiplication
> is. So how to choose the order in the np.outer() product? In fact,
> different order gives very different results.
>
> (2) It's seem impossible to reproduce the well known Ylm(theta,phi) plots.
> Using for example this document
> http://www.cs.dartmouth.edu/~wjarosz/publications/dissertation/appendixB.pdf
> :
>
>
>
>
>
> I don't know if I am doing something wrong or so, but I don't understand
> ... My full code is bellow.
>
> Thanks a lot in advance !
> Cheers,
> Romain
>
>
> PS:
>
> import math
> import numpy as np
> import pylab as p
> from mpl_toolkits.mplot3d import Axes3D
>
> def f(theta,phi):
> return np.sin(phi)*np.cos(phi)*np.sin(theta)**2
>
> fig = p.figure()
> ax = fig.add_subplot(111, projection='3d')
>
> theta = np.linspace(0,   np.pi, 500)
> phi   = np.linspace(0, 2*np.pi, 500)
>
> r = f(theta,phi)
> x = r**2 * np.outer( np.cos(phi) , np.sin(theta) )
> y = r**2 * np.outer( np.sin(phi) , np.sin(theta) )
> z = r**2 * np.outer(np.ones(phi.shape), np.cos(theta))
>
> #x = r**2 * np.outer( np.sin(theta) , np.cos(phi)
> )
>
> #y = r**2 * np.outer( np.sin(theta) , np.sin(phi) )
> #z = r**2 * np.outer( np.cos(theta), np.ones(theta.shape) )
>
> ax.plot_surface(x,y,z)
> ax.set_xlabel("X")
> ax.set_ylabel("Y")
> ax.set_zlabel("Z")
>
> p.show()
>
>
> --
> =
>   Romain Madar
>
> Laboratoire de Physique Corpusculaire de Clermont-Ferrand
>   Campus Universitaire des Cézeaux
>   4 avenue Blaise Pascal
>   TSA 60026, CS 60026
>   63178 Aubière cedex, FRANCE
>
> Email: romain.ma...@cern.ch
> Tel. : +33 (0)4 73 40 71 57
> Off. : 8204-8205
> =
>
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Efficient matplotlib use on iOS and Android apps

2015-07-10 Thread Benjamin Root
The way matplotlib does its MathText rendering is 1) incomplete (we don't
support all of MathTex), and 2) has *massive* overhead (relatively
speaking). Matplotlib is intended for producing figures with many disparate
components. The amount of code it takes to just generate a simple plot is
fairly significant (along with also firing up a python interpreter).
Meanwhile, MathJax is much lighter in the sense that all it needs to do is
parse a string and render out font characters.

As for matplotlib vs. MathJax, you will likely sending bitmaps to OpenGL
(if possible) anyway because that is pretty much what you will need to do
with matplotlib as well as MathJax. It is technically possible to obtain
the stroke data to send the font lines to OpenGL, but it will not look the
same as it would if you let a font renderer generate the bitmap. There are
a few reasons why matplotlib does not have an OpenGL backend yet, one of
them is because OpenGL does a terrible job in rendering text.

This is not to say that what you are thinking of doing is impossible to do.
It may be quite possible, but given that no one (that I am aware of) have
managed to get matplotlib running on a mobile OS, you have a huge
undertaking ahead of you just to get started. And, once you get there, it
is quite likely that the performance won't be what you need. In addition,
you might not like the resulting render. More power to you if you can get
it working, and I know many people who are interested in getting that stack
working on tablets and such.

On the other hand, there are plenty of documentation on how to build mobile
apps that take advantage of javascript-based technologies. Your startup
cost is very low here. And given that you will likely going to need to use
bitmaps anyway, it might not be all that bad of an option. I have no clue
what the performance penalty of firing up a javascript renderer on a mobile
OS, but in the face of the unknown, I avoid guessing. Don't fall victim to
premature optimization. I have been very surprised at how fast certain
(slow) technologies can be.

A minimalist LaTeX distro is an intriguing idea. I have no clue how much
effort it would take to do that, but that may be quite feasible.

Best of luck to you, and I look forward to finding out what you manage to
get working.

Cheers!
Ben Root

On Fri, Jul 10, 2015 at 4:37 AM, asiga  wrote:

> Why do you suggest MathJax? I assume Javascript will be less efficient than
> Python. Moreover, I'm not sure I can get the MathJax output as polygonal
> primitives that I can send to OpenGL. And, to complicate things, you cannot
> use JIT Javascript engines on iOS such as V8, due to sandboxing.
>
> In fact, I'm considering to build myself a minimal LaTeX distro. Maybe that
> would be the best option.
>
>
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Efficient-matplotlib-use-on-iOS-and-Android-apps-tp45901p45914.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] background color of text plots as foreground

2015-07-09 Thread Benjamin Root
Which backend are you using? It works fine for me with a recent-ish master
using Qt4Agg backend.

Ben Root

On Thu, Jul 9, 2015 at 6:52 AM, Mark Bakker  wrote:

> Hello list,
>
> I am trying to set the backgroundcolor of a textbox:
>
> from pylab import *
> plot([1, 2, 3])
> text(1, 2, 'Hello', backgroundcolor = 'red')
>
> This plots a nice red box but no text. It looks like the backgroundcolor
> is set as the foreground. Am I doing something wrong or is this a bug? mpl
> version 1.4.3
>
> Thanks, Mark
>
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Efficient matplotlib use on iOS and Android apps

2015-07-09 Thread Benjamin Root
why not use MathJax?

On Thu, Jul 9, 2015 at 8:03 AM, asiga  wrote:

> Hi,
>
> I need to render LaTeX math formulas on mobile apps (iOS/Android), with
> high
> quality, and as efficiently as possible.
>
> I'm considering matplotlib as the best candidate at the moment. Maybe it
> might be a bit overkill because I don't need plotting, just math formulas
> rendering, but it has a "copycenter" license (very welcome when you target
> iOS), and it seems to render LaTeX math with high quality. So I think it
> beats other options I found (MathGL: copyleft license; and MathJax: setting
> a complete Javascript engine just for rendering math does seem overkill to
> me).
>
> However, I still have some doubts before choosing matplotlib:
>
> 1) Can I redirect the output of math rendering to OpenGL calls, or convert
> it into a 2D triangle mesh for example? (if the drawing commands issued by
> matplotlib when rendering math are a relatively small set, I can translate
> them to OpenGL myself, but I need to know where should I do that
> translation
> (I've zero idea about matplotlib internals, and I'm a Python newbie -I'm
> here because I need math rendering, not because I use Python).
>
> (note that I wish to render through OpenGL because I want to be able to
> interactively pan and zoom math very efficiently: the best approach would
> be
> to cache the matplotlib output as a -for example- 2D triangle mesh, and
> then
> just send the triangles to OpenGL, without having to call matplotlib on
> each
> screen redraw, which would kill performance)
>
> 2) In order to get matplotlib running as efficient as possible on mobile
> devices, would you recommend that I translate matplotlib to C/C++ using any
> of the translators available? If affirmative, what translator would you
> suggest me to use?
>
> Thanks a lot!!
>
>
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Efficient-matplotlib-use-on-iOS-and-Android-apps-tp45901.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plot : Too many ticks on X axe

2015-07-08 Thread Benjamin Root
Your code example is incomplete. Even if I add in the typical imports and
"fig, ax = plt.subplots()" and "plt.show()", The x tick labels aren't
rotated, and I certainly don't have too many tick labels. Could you provide
a complete working example that demonstrate the problem?

Ben Root

On Wed, Jul 8, 2015 at 9:15 AM, manik971  wrote:

> 
> date_range = (735599.0, 735745.0)
> x = (735610.5, 735647.0, 735647.5, 735648.5, 735669.0, 735699.0, 735701.5,
> 735702.5, 735709.5, 735725.5, 735728.5, 735735.5, 735736.0)
> y = (227891.25361545716, 205090.4880046467, 208352.59317388065,
> 175462.99296699322, 98209.836461969651, 275063.37219361769,
> 219456.93600708069, 230731.12613806152, 209043.19805037521,
> 218297.51486296533, 208036.88967207001, 206311.71988471842,
> 216036.56824433553)
> y0 = 218206.79192
> x_after = (735610.5, 735647.0, 735647.5, 735701.5, 735702.5, 735709.5,
> 735725.5, 735728.5, 735735.5, 735736.0)
> y_after = (227891.25361545716, 205090.4880046467, 208352.59317388065,
> 219456.93600708069, 230731.12613806152, 209043.19805037521,
> 218297.51486296533, 208036.88967207001, 206311.71988471842,
> 216036.56824433553)
> ax.plot_date(x, numpy.array(y) / y0, color='r', xdate=True, marker='x')
> linex = -39.1175584541
> liney = 28993493.5251
>
> ax.set_xlim(date_range)
> steps = list(ax.get_xlim())
> steps.append(steps[-1] + 2)
> steps = [steps[0] - 2] + steps
> ax.plot(steps, numpy.array([linex * a + liney for a in steps]) / y0,
> color='b')
> 
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Plot-Too-many-ticks-on-X-axe-tp45893p45894.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Zorder and Clip_on issues

2015-07-03 Thread Benjamin Root
Which version of matplotlib? This is familiar I could have sworn we
fixed this.

Ben Root
On Jul 3, 2015 10:25 PM, "Gael Grissonnanche" 
wrote:

> Hi everyone,
>
>
>
> I had recently experienced a frustration regarding zorder and clip_on in
> Matplotlib.
>
>
>
> In figure 1 attached here, I would like to put blue horizontal error bars
> above the x-axis. As you can see right now, half of it is cut by the x-axis
> (for the blue point at H = 0). I used:
>
>
>
> axes.errorbar(data[:,0], data[:,1], xerr=data[:,2], fmt='', ls ="", c =
> ‘b’, capthick=2, elinewidth=2, clip_on = False, zorder = 10)
>
>
>
> But even if I change zorder = 1000, the error bar never goes above the
> axis. Is it a bug?
>
>
>
> Regarding the same topic, I also discovered that when using axes.twinx()
> in Figure 2 (A : axes; B : axes2 = axes.twinx()). The blue curve (A) never
> goes above the red curve (B), whatever zorder I use. I even tried
> axes2.set_axisbelow(True), but it doesn’t change anything. I really want
> “axes2” to be below the “axes”. Is it a bug? I had to change it manually
> with Illustrator and it worked, but it is of course really not convenient.
>
>
>
> Thank you very much for your help !
>
>
>
>
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a shapefile after it is loaded

2015-07-01 Thread Benjamin Root
You would need to save the artist object that is returned by
drawshapefile() in a list or something. Then, when you want to get rid of
it. you can call its `remove()` method or just do a `set_visible(False)` to
just hide it. This all requires having a reference to the artist object
itself.

Does that help?

Ben Root

On Wed, Jul 1, 2015 at 1:58 PM, Ronquillo, Edgar Nahum 
wrote:

>  Hello All,
>
>
>
> I am working with Basemap and loading several shapefiles using checkboxes
> in python. However, when I uncheck a checkbox I would like a shapefile to
> be removed and stay with the other shapefiles that are already loaded. I
> tried reloading and replotting the whole thing when I remove a checkbox but
> it will remove all the other shapefiles as well. In simpler words, is it
> possible to remove a shapefile from Basemap after m.readshapefile() has
> been called?
>
>
>
> Thanks in advance
>
>
>
>
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Multiple Projections On Same Axes

2015-06-30 Thread Benjamin Root
Well, the way those work is essentially overlay one axes object over
another along with some extra fanagiling to link up the shared axis and put
ticks on opposing sides. If your projection is already available as an
axes, then you are good to go that way. However, it sounds what you want is
to have some things follow one transform while others follow another? That
is certainly doable, it is just a question of bookkeeping.

I would check to see if the axis_artist1 toolkit supplies what you need (or
at least some of it).

Ben Root


On Tue, Jun 30, 2015 at 1:20 PM, T J  wrote:

> Ok, sounds like I'll have to copy what those do, as I'm not planning on
> working with Cartesian or even curvilinear coordinates.
>
> On Tue, Jun 30, 2015 at 11:36 AM, Benjamin Root  wrote:
>
>> twinx()/twiny() I think is your best bet. It isn't a fully generic
>> solution, but I think it addresses most needs.
>>
>> Ben Root
>>
>> On Mon, Jun 29, 2015 at 6:00 PM, T J  wrote:
>>
>>> When I read the transformations documentation:
>>>
>>>
>>> http://matplotlib.org/devel/add_new_projection.html#creating-a-new-projection
>>>
>>> it seems like each projection is tied to an Axes instance.  How might I
>>> go about plotting two different projections on the same axes? Let's just
>>> assume that the actual axes each projection draws is exactly same and all
>>> that differs between to the two is how data is mapped to axis coordinates.
>>>
>>>
>>>
>>>
>>> --
>>> Don't Limit Your Business. Reach for the Cloud.
>>> GigeNET's Cloud Solutions provide you with the tools and support that
>>> you need to offload your IT needs and focus on growing your business.
>>> Configured For All Businesses. Start Your Cloud Today.
>>> https://www.gigenetcloud.com/
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] get_3d_properties

2015-06-30 Thread Benjamin Root
Yeah, this is a long-standing design issue:
https://github.com/matplotlib/matplotlib/issues/1483

There are some changes that are happening that would make it possible for
me to refactor mplot3d in a way that would make this feasible. I could bite
the bullet and just provide a partial workaround to this problem by
providing a get_3d_data() method to each Artist3D subclass. Should be a
fairly easy task for someone at SciPy 2015.

On Tue, Jun 30, 2015 at 11:51 AM, kola  wrote:

> Hi,
>
> I am able to use set_3d_properties to set z data for my 3D line. However,
> if
> I want to get the zdata, I cannot find a function like get_zdata or
> get_3d_properites.
>
> Is there anyway to get the zdata associated with the line?
>
> Thanks,
> Kola
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/get-3d-properties-tp45851.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TypeError: Dimensions of C (645, 536) are incompatible with X (538) and/or Y (646); see help(pcolormesh)

2015-06-30 Thread Benjamin Root
It looks like your X data is one element larger than it needs to be. I know
pcolor() accepts grids that are (N+1,M+1), and I *think* pcolormesh does
the same. It will also accept grids that are (N,M) as well, but will drop
the last row and collumn.

Given your statement that it sometimes works, I suspect you have a bug in
your code somewhere that is causing your Xs and Ys to not always be exactly
the length you'd expect them to be.

I hope that helps!
Ben Root


On Mon, Jun 29, 2015 at 2:06 PM, Ronquillo, Edgar Nahum  wrote:

>  Hello,
>
> I am getting this error when I try calling pcolormesh this way:
>
>
>
> pcolormesh(x, y, data.T, cmap=cmap, vmin=0, vmax=100)
>
>
>
> I am doing the transpose of data so I don’t know what could be causing
> this. By the way, it does work with some images. Any suggestions?
>
>
>
> Thanks in advance
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Multiple Projections On Same Axes

2015-06-30 Thread Benjamin Root
twinx()/twiny() I think is your best bet. It isn't a fully generic
solution, but I think it addresses most needs.

Ben Root

On Mon, Jun 29, 2015 at 6:00 PM, T J  wrote:

> When I read the transformations documentation:
>
>
> http://matplotlib.org/devel/add_new_projection.html#creating-a-new-projection
>
> it seems like each projection is tied to an Axes instance.  How might I go
> about plotting two different projections on the same axes? Let's just
> assume that the actual axes each projection draws is exactly same and all
> that differs between to the two is how data is mapped to axis coordinates.
>
>
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Use _cntr.so in fortran?

2015-06-25 Thread Benjamin Root
_cntr.so has been deprecated (it might take a couple of releases before we
remove it entirely). _contour.so has a newer, better interface and comes
with a python wrapper.  Don't know if that is an issue at all for you, just
noting that is the case.

I might also suggest looking at scikit-image, as I think it has some
contouring algorithms that might be easier to link to.

Ben Root

On Thu, Jun 25, 2015 at 2:28 PM, Sterling Smith 
wrote:

> The contour finder in matplotlib is more robust than I currently have in a
> legacy fortran project.  I would like to link to matplotlib’s instead.  Has
> anyone done this before?  Are there any suggestions or pitfalls for
> proceeding?
>
> Thanks,
> Sterling
>
> --
> Monitor 25 network devices or servers for free with OpManager!
> OpManager is web-based network management software that monitors
> network devices and physical & virtual servers, alerts via email & sms
> for fault. Monitor 25 devices for free with no restriction. Download now
> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] zorder taking an array

2015-06-23 Thread Benjamin Root
Right, when zorder is not explicitly specified, all the artists of the same
type get the same default zorder (I think 2, but I can't remember). We then
use a stable sort to determine the draw order, so two artists with the same
zorder are drawn in the order that they were created (the exception being
mplot3d, because it mucks about with zorders to achieve the 3d effect).

Ben Root

On Tue, Jun 23, 2015 at 1:53 PM, Jody Klymak  wrote:

>
> For my backend (nbagg), the order of the data determines the order of
> drawing.  So in the following, the third diamond covers the first two in
> the first plot, but the first diamond covers them all in the second plot.
> Perhaps not as elegant as a matrix zorder, but can achieve the effect you
> are after.
>
> Cheers,   Jody
>
> fig, ax = plt.subplots(2,1)
> x = np.arange(3)
> y = 0.*x
> ax[0].plot(x,y,'d',markersize=52)
> ax[0].set_xlim(-10.,10.)
> ax[1].plot(x[[2,1,0]],y[[2,1,0]],'d',markersize=52)
> ax[1].set_xlim(-10.,10.)
>
>
> On Jun 23, 2015, at  9:44 AM, Benjamin Root  wrote:
>
> I see what you are getting at. The issue is that artists are first sorted
> by the zorder and then drawn one at a time. The draw for a collection
> artist is an at-once operation, it can't (currently) be split out and
> interspersed with the draws from another artist. This is one of the major
> limitations for mplot3d, as it would be nice to compose a 3d scene properly
> so that everything is logically consistent.
>
> I have actually been working on some changes that would allow one to sort
> the draws of individual elements of a collection, but I still haven't
> figured out a way to "break out" the elements with other collection
> elements in a way that doesn't break the current design or introduce major
> performance penalties. Maybe I'll figure something out during SciPy2015.
>
> Cheers!
> Ben Root
>
>
> On Tue, Jun 23, 2015 at 5:44 AM, Simon Walker <
> s.r.walker...@googlemail.com> wrote:
>
>> When multiple datasets are plotted on the same axis, the points overlay
>> each other making it hard to see the points under the most recent ones. One
>> way to avoid this is to give each point a random zorder, randomising its
>> position in the z axis. This way, points from the first dataset may overly
>> points from the last dataset.
>>
>> This could be achieved nicely if the zorder keyword took an array so the
>> random zorder values per point can be pre-computed, but currently it only
>> accepts a single number for the whole dataset. Would this be a useful
>> feature for others to have? How difficult would it be to implement?
>>
>> Thanks,
>>
>> Simon Walker
>>
>> --
>> Monitor 25 network devices or servers for free with OpManager!
>> OpManager is web-based network management software that monitors
>> network devices and physical & virtual servers, alerts via email & sms
>> for fault. Monitor 25 devices for free with no restriction. Download now
>> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> --
> Monitor 25 network devices or servers for free with OpManager!
> OpManager is web-based network management software that monitors
> network devices and physical & virtual servers, alerts via email & sms
> for fault. Monitor 25 devices for free with no restriction. Download now
>
> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
> Monitor 25 network devices or servers for free with OpManager!
> OpManager is web-based network management software that monitors
> network devices and physical & virtual servers, alerts via email & sms
> for fault. Monitor 25 devices for free with no restriction. Download now
> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--

Re: [Matplotlib-users] zorder taking an array

2015-06-23 Thread Benjamin Root
I see what you are getting at. The issue is that artists are first sorted
by the zorder and then drawn one at a time. The draw for a collection
artist is an at-once operation, it can't (currently) be split out and
interspersed with the draws from another artist. This is one of the major
limitations for mplot3d, as it would be nice to compose a 3d scene properly
so that everything is logically consistent.

I have actually been working on some changes that would allow one to sort
the draws of individual elements of a collection, but I still haven't
figured out a way to "break out" the elements with other collection
elements in a way that doesn't break the current design or introduce major
performance penalties. Maybe I'll figure something out during SciPy2015.

Cheers!
Ben Root


On Tue, Jun 23, 2015 at 5:44 AM, Simon Walker 
wrote:

> When multiple datasets are plotted on the same axis, the points overlay
> each other making it hard to see the points under the most recent ones. One
> way to avoid this is to give each point a random zorder, randomising its
> position in the z axis. This way, points from the first dataset may overly
> points from the last dataset.
>
> This could be achieved nicely if the zorder keyword took an array so the
> random zorder values per point can be pre-computed, but currently it only
> accepts a single number for the whole dataset. Would this be a useful
> feature for others to have? How difficult would it be to implement?
>
> Thanks,
>
> Simon Walker
>
> --
> Monitor 25 network devices or servers for free with OpManager!
> OpManager is web-based network management software that monitors
> network devices and physical & virtual servers, alerts via email & sms
> for fault. Monitor 25 devices for free with no restriction. Download now
> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks not lining up with data

2015-06-17 Thread Benjamin Root
Then convert them to date objects? Also, I am guessing that the length of
indices.index is not the same as indices.carli, which could also be the
reason for a ValueError. So you would need to use whatever pandas variable
that indices.index derived from.

Ben Root

On Wed, Jun 17, 2015 at 12:48 PM, Ted To  wrote:

> Unless I recall incorrectly, I think I am using set_xticklabels because
> indices.index are strings.  When I tried specifying
> ax.plot(indices.index,indices.carli) I get a ValueError.
>
> Ted
>
>
> On 2015-06-17 10:28 am, Benjamin Root wrote:
>
>> Why are you calling ax.set_xticklabels()?. Why not pass the x values
>> to ax.plot() along with the y values? Then you won't need to set the
>> labels because matplotlib will do it for you.
>>
>> Ben Root
>>
>> On Wed, Jun 17, 2015 at 10:13 AM, Ted To  wrote:
>>
>>  Hi,
>>>
>>> I'm having a strange problem and I don't understand why this is
>>> happening. I am plotting the dataframe in:
>>> http://pastebin.com/C0Pt0iYd [1]
>>> but I'm getting too few tick marks. My code for the plot is:
>>>
>>> fig, ax = plt.subplots()
>>> plt.rc('text', usetex=True)
>>> fig.autofmt_xdate()
>>> ax.plot(indices.carli,'b-',label=r'textsf{Carli}')
>>> ax.plot(indices.geomean,'g-',label=r'textsf{GeoMean}')
>>> ax.plot(indices.laspeyres,'c-',label=r'textsf{Laspeyres}')
>>> ax.plot(indices.paasche,'m-',label=r'textsf{Paasche}')
>>> ax.plot(indices.tornqvist,'y-',label=r'textsf{T"ornqvist}')
>>> plt.xlabel(r'textsf{Month}')
>>> plt.ylabel(r'textsf{Index value}')
>>> ax.set_xticklabels(indices.index)
>>>
>>> Any ideas what I'm doing wrong?
>>>
>>> Thanks,
>>> Ted
>>>
>>>
>>>
>> --
>>
>>>
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users [2]
>>>
>>
>>
>>
>> Links:
>> --
>> [1] http://pastebin.com/C0Pt0iYd
>> [2] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks not lining up with data

2015-06-17 Thread Benjamin Root
Why are you calling ax.set_xticklabels()?. Why not pass the x values to
ax.plot() along with the y values? Then you won't need to set the labels
because matplotlib will do it for you.

Ben Root

On Wed, Jun 17, 2015 at 10:13 AM, Ted To  wrote:

> Hi,
>
> I'm having a strange problem and I don't understand why this is
> happening.  I am plotting the dataframe in: http://pastebin.com/C0Pt0iYd
> but I'm getting too few tick marks.  My code for the plot is:
>
>   fig, ax = plt.subplots()
>   plt.rc('text', usetex=True)
>   fig.autofmt_xdate()
>   ax.plot(indices.carli,'b-',label=r'\textsf{Carli}')
>   ax.plot(indices.geomean,'g-',label=r'\textsf{GeoMean}')
>   ax.plot(indices.laspeyres,'c-',label=r'\textsf{Laspeyres}')
>   ax.plot(indices.paasche,'m-',label=r'\textsf{Paasche}')
>   ax.plot(indices.tornqvist,'y-',label=r'\textsf{T\"ornqvist}')
>   plt.xlabel(r'\textsf{Month}')
>   plt.ylabel(r'\textsf{Index value}')
>   ax.set_xticklabels(indices.index)
>
> Any ideas what I'm doing wrong?
>
> Thanks,
> Ted
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib documentation from python notebook?

2015-06-08 Thread Benjamin Root
No, there isn't an accepted way to do that AFAIK. However, it doesn't seem
like it is all that far off. Our doc-build process will create the images
from the examples automatically, so you don't need to include the image
tag. It is sort of a way to make sure the examples work and that the image
matches the code correctly.

On Mon, Jun 8, 2015 at 1:06 PM, Jody Klymak  wrote:

>
> Hi all,
>
> If I want to contribute *.rst files to the matplotlib documentation, I can
> see a few styles already contributed, at least one of which makes extensive
> use of ipython (http://matplotlib.org/users/image_tutorial.html).
> However, even it makes use of `.. sourcecode:: python` and `.. plot::`
> blocks.
>
> If I convert an ipython notebook to rst, it formats as: `.. code:: python`
> and instead of making plots it loads images:
>  `.. image:: MyExample_files/MyExample_1_0.png`
>
> So, is there an acceptable way to directly make matplotlib documentation
> directly from a notebook?  I didn’t see anything, but wanted to check, as
> that would by far be the easiest way to make a *.rst that had structured
> text, code, and plots.
>
> Thanks,   Jody
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap Problems

2015-06-08 Thread Benjamin Root
By the way, if you want quick-n-easy plotting of shapefiles, I suggest
using GeoPandas, which makes it dead simple.

On Mon, Jun 8, 2015 at 1:49 PM, Ronquillo, Edgar Nahum 
wrote:

>  Hello,
> I am currently working with Basemap to plot a shapefile on the map.
> However, I am confused on how to initialize llcrnrx and llcrnry and same
> for the upper corner. I currently have both latitudes and longitudes for
> lower and upper corners in degrees. Does this mean I have to convert from
> degrees to x,y coordinates? I tried using llcrnrlon and llcrnrlat but it
> doesn't seem to like this. Please help me clarify this, any help would be
> great.
>
> Thank You
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [matplotlib-devel] RFC: candidates for a new default colormap

2015-06-05 Thread Benjamin Root
Furthermore, I think there is some work being done to add functionality to
the Norm to allow specifying a middle value along with a vmin and a vmax.

Ben Root

On Fri, Jun 5, 2015 at 3:20 PM, Eric Firing  wrote:

> On 2015/06/05 8:17 AM, Sourish Basu wrote:
> > Very often the "zero" of an anomaly is not at the center of the extrema,
> > and requires creating a custom diverging colormap anyway (see attached
> > example).
>
> Reminder: in matplotlib, color mapping is done with the combination of a
> colormap and a norm.  This allows one to design a norm to handle the
> mapping, including any nonlinearity or difference between the handling
> of positive and negative values.  This is more general than customizing
> a colormap; once you have a norm to suit your purpose, you can use it
> with any colormap.
>
> Maybe this is actually what you are already doing, but I wanted to point
> it out here in case some readers are not familiar with this
> colormap+norm strategy.
>
> Eric
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: [matplotlib-devel] RFC: candidates for a new default colormap

2015-06-05 Thread Benjamin Root
It is funny that you mention that you prefer the warmer colors over the
cooler colors. There has been some back-n-forth about which is better. I
personally have found myself adverse to using just cool or just warm
colors, preferring a mix of cool and warm colors. Perhaps it is my
background in meteorology and viewing temperature maps?

Another place where a mix of cool and warm colors are useful is for
severity indications such as radar maps. It is no accident that radar maps
are colored greens and blues for weak precipitation, then yellow for
heavier, and then reds for heaviest (possibly severe) precipitation -- it
came from the old FAA color guides. While we all know that that colormap is
fundamentally flawed, there was a rationale behind it.

Hopefully I will have some time today to play around with the D option. I
want to see if I can shift the curve a bit to include more yellows and
orange so that it can have a mix of cool and warm colors.

Ben Root


On Fri, Jun 5, 2015 at 11:21 AM, Philipp A.  wrote:

> I vote for A and B. Only B if i get just one vote.
>
> C is too washed out and i like the warm colors more than the cold ones in
> D.
>
> It’s funny that this comes up while I’m handling colormaps in my own work
> at the moment.
>
> Neal Becker  schrieb am Fr., 5. Juni 2015 um
> 12:58 Uhr:
>
>> I vote for D, although I like matlab's new default even better
>>
>>
>>
>> --
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Live Scrolling Matplotlib graph

2015-06-03 Thread Benjamin Root
The plot will autoscale base on the data that has been plotted to it. In
your code, you are repeatedly calling plot(), albeit with a "scrolled"
version of the data, but all of the previous calls to plot() are still
visible. Also, no x-coordinate information is provided to the calls to
plot(), so each new call to plot() only overlays on top of the previous
calls.

I also see that you are using the interactive mode. This isn't really
necessary. I would suggest reading through some of the animation examples
to see how to automatically update your plot:
http://matplotlib.org/examples/animation/index.html . I would particularly
point out the "animate_decay" example. While it isn't a scrolling example,
you can see how to update an existing plot with new data from a generator.
It would then just be a matter of updating the x-limits for each update.

I hope that helps!
Ben Root


On Wed, Jun 3, 2015 at 12:17 PM, Alejandro Ureta <
alejandro.r.ur...@gmail.com> wrote:

> Hi, I am trying to get a live scrolling graph built from data send by two
> arduino sensors. Although live data is being shown in the graph  I am not
> able to get  it scrolling. The arduino and Python codes I am working with
> are included below. I would very much appreciate if you can help me getting
> the scrolling graph working.
>
>
>
> PYTHON CODE:
>
> import serial # import Serial Library
>
> import numpy  # Import numpy
>
> import matplotlib.pyplot as plt #import matplotlib library
>
> from drawnow import *
>
>
>
> tempF= []
>
> pressure= []
>
>
>
> arduinoData = serial.Serial('com6', 115200) #Creating our serial object
> named arduinoData
>
> plt.ion() #Tell matplotlib you want interactive mode to plot live data
>
> cnt=0
>
>
>
> def makeFig(): #Create a function that makes our desired plot
>
> plt.ylim(0,500) #Set y min and max
> values
>
> plt.title('Frequency vs Time')  #Plot the title
>
> plt.grid(True)  #Turn the grid on
>
> plt.ylabel('Frequency (pulses/sec)')#Set
> ylabels
>
> plt.plot(tempF, 'ro-', label='pulses/sec')   #plot the temperature
>
> plt.legend(loc='upper left')#plot the legend
>
>
>
>
>
> plt2=plt.twinx()#Create a second y axis
>
> plt.ylim(0,500)   #Set limits of second y
> axis- adjust to readings you are getting
>
> plt2.plot(pressure, 'b^-', label='Pressure (Pa)') #plot pressure data
>
> plt2.set_ylabel('Pressrue (Pa)')#label second y
> axis
>
> plt2.ticklabel_format(useOffset=False)   #Force matplotlib to
> NOT autoscale y axis
>
> plt2.legend(loc='upper right')  #plot the legend
>
>
>
>
>
> while True: # While loop that loops forever
>
> while (arduinoData.inWaiting()==0): #Wait here until there is data
>
> pass #do nothing
>
> arduinoString = arduinoData.readline() #read the line of text from the
> serial port
>
> dataArray = arduinoString.split(',')   #Split it into an array called
> dataArray
>
> temp = float(dataArray[0])   #Convert first element to
> floating number and put in temp
>
> pres = float(dataArray[1])#Convert second element to
> floating number and put in P
>
> tempF.append(temp) #Build our tempF array by
> appending temp readings
>
> pressure.append(pres)#Building our pressure
> array by appending P readings
>
> drawnow(makeFig)   #Call drawnow to update our
> live graph
>
> plt.pause(.01) #Pause Briefly. Important to
> keep drawnow from crashing
>
> cnt=cnt+1
>
> if(cnt>10):#If you have 50 or more points,
> delete the first one from the array
>
> tempF.pop(0)   #This allows us to just see the
> last 50 data points
>
> pressure.pop(0)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  ARDUINO CODE:
>
>
>
>
>
> #include "Wire.h"// imports the wire library for talking over I2C
>
> #include "Adafruit_BMP085.h"  // import the Pressure Sensor Library
>
> Adafruit_BMP085 mySensor;  // create sensor object called mySensor
>
>
>
> float tempC;  // Variable for holding temp in C
>
> float tempF;  // Variable for holding temp in F
>
> float pressure; //Variable for holding pressure reading
>
>
>
> void setup(){
>
> Serial.begin(115200); //turn on serial monitor
>
> mySensor.begin();   //initialize mySensor
>
> }
>
>
>
> void loop() {
>
> tempC = mySensor.readTemperature(); //  Be sure to declare your variables
>
> tempF = tempC*1.8 + 32.; // Convert degrees C to F
>
> pressure=mySensor.readPressure(); //Read Pressure
>
>
>
>
>
> Serial.print(tempF);
>
> Serial.print(" , ");
>
> Serial.println(pressure);
>
> delay(250); //Pause between readings.
>
> }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> -

Re: [Matplotlib-users] Annotate not Drawing Properly in a Gridspec - Version 1.4.3

2015-05-26 Thread Benjamin Root
I think this is a feature/bug that got reverted in the master branch.
Perhaps you could try building matplotlib from source and seeing if the
problem goes away?

Cheers!
Ben Root

On Tue, May 26, 2015 at 3:00 PM, Sean Lake  wrote:

> Sterling,
>
> Thanks for the pointer. I've already used a workaround where I used "data"
> coordinates and put it at:
> 0.9 * (xmax - xmin) + xmin, and similar for y.
>
> I'm really only reporting this so that it can be fixed if there is someone
> who does need to annotate something in a grid.
>
> Sean
>
> > On May 26, 2015, at 11:54, Sterling Smith 
> wrote:
> >
> > Sean,
> >
> > Do you need an `annotate`, or just a `text`?  `text` has the `transform`
> keyword, to which you can pass `ax.transAxes`.
> >
> > ax.text(.9,.9, r"$\mathbf{" + lab +
> ")}$”,transform=ax.transAxes,ha=‘right’,va=‘center’)
> >
> > -Sterling
> >
> > On May 26, 2015, at 10:06AM, Sean Lake  wrote:
> >
> >> Hello all,
> >>
> >> I'm using matplotlib 1.4.3 installed using fink with python 2.7.
> >>
> >> I'm trying to produce a grid of plots using gridspec that has
> annotations to label each plot.
> >>
> >> Here is the call to annotate the current axes:
> >> ax.annotate( r"$\mathbf{" + lab + ")}$",
> >>xy=(0.5*(xmin+xmax), 0.5*(ymin+ymax)),
> >>xytext=(0.9, 0.9),
> >>textcoords="axes fraction", fontsize=14 )
> >>
> >> Where ax is initialized by:
> >> ax = plt.subplot(gs[ coords[0], coords[1] ])
> >>
> >> and gs by:
> >> gs = mpgs.GridSpec( 3, 2, wspace=0.0, hspace=0.0 )
> >>
> >> The trouble comes in when abs(ymax) < abs(ymin). When that is true, the
> labels are offset upward by one row, for some reason.
> >>
> >> I've attached a script that demonstrates the problem, and an example of
> the output. I can work around this problem by using "data" coordinates, but
> even so this reveals a bug somewhere.
> >>
> >> Thanks,
> >> Sean Lake
> >>
> >>
> --
> >> One dashboard for servers and applications across Physical-Virtual-Cloud
> >> Widest out-of-the-box monitoring support with 50+ applications
> >> Performance metrics, stats and reports that give you Actionable Insights
> >> Deep dive visibility with transaction tracing using APM Insight.
> >>
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
> >> Matplotlib-users mailing list
> >> Matplotlib-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting a imshow() image in 3d in matplotlib

2015-05-26 Thread Benjamin Root
On Tue, May 26, 2015 at 12:36 PM, Raj Kumar Manna 
wrote:

> import matplotlib.pyplot as plt
> from mpl_toolkits.mplot3d import Axes3D
> import numpy as np
>
> # create a 21 x 21 vertex mesh
> xx, yy = np.meshgrid(np.linspace(0,1,21), np.linspace(0,1,21))
>
> # create vertices for a rotated mesh (3D rotation matrix)
> X =  xx
> Y =  yy
> Z =  10*np.ones(X.shape)
>
> # create some dummy data (20 x 20) for the image
> data = np.cos(xx) * np.cos(xx) + np.sin(yy) * np.sin(yy)
>
> # create the figure
> fig = plt.figure()
>
> # show the reference image
> ax1 = fig.add_subplot(121)
> ax1.imshow(data, cmap=plt.cm.BrBG, interpolation='nearest',
> origin='lower', extent=[0,1,0,1])
>
> # show the 3D rotated projection
> ax2 = fig.add_subplot(122, projection='3d')
> ax2.plot_surface(X, Y, Z, rstride=1, cstride=1,
> facecolors=plt.cm.BrBG(data), shade=False)
>


The call to imshow() without vmin/vmax arguments will automatically scale
the colormap to cover the entire range of values. Meanwhile, when you did
plt.cm.BrBG(data), it assumed that the vmin/vmax is 0 and 1, respectively.
The min and max of your data is actually 0.292 and 1.708. If you normalize
your data, it should look much more correct.

Cheers!
Ben Root
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib.backends.backend_gtk3cairo memory leak

2015-05-26 Thread Benjamin Root
I take it that it doesn't happen using the GTK3Agg backend? What about the
threading portion? Does it happen if you take the threading out?

Ben Root

On Tue, May 26, 2015 at 8:23 AM, David  wrote:

> Hi, I seem to have a memory leak while generating a 'live' plot display.
> This wasn't the case for GTK2, but the example below is consuming
> ~800k/second (Matplotlib 1.4.3, PyGI aio-3.14.0_rev18, Windows 7 x64,
> python 3.4.3). I have checked the garbage collector but it doesn't show
> anything interesting (no massive incrementing count of uncollected items).
> Anyway, I would be very grateful if somebody could confirm and/or fix this
> (or tell me what I'm doing wrong). Many thanks David Code below:
>
> from gi.repository import Gtk, Gdk, GLib
>
>
> from matplotlib.figure import Figure
> # Tell matplotlib to use a GTK canvas for drawing
> #from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as 
> FigureCanvas
> from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as 
> FigureCanvas
>
>
> # Application Class
> class pyMatPlotLibTest(object):
>
> def update_gui(self):
> y = [self.index] * 1024
>
> self.index += 1
> if self.index > 1024: self.index = 0
>
> Gdk.threads_enter()
> self.line.set_ydata(y)
> self.axes.set_title("%d" % self.index)
> self.canvas.draw()
> Gdk.threads_leave()
>
> return True
>
> def __init__(self):
> self.index = 0
> self.x = range(1024)
>
> # Initialise the threads system and allow threads to work with GTK
> GLib.threads_init()
>
> # Draw scope
> self.figure = Figure(dpi=100)
> self.canvas = FigureCanvas(self.figure)  # a Gtk.DrawingArea
> #self.widget.alignment_ScopeDisplay.add(self.canvas)
>
> # Draw initial scope
> self.axes = self.figure.add_subplot(111)
> self.line, = self.axes.plot(self.x, [0]* 1024)
> self.axes.set_title("None")
> self.axes.set_xbound(0.0, 1024)
> self.axes.set_ybound(-16, 1040)
>
> self.window_main = Gtk.Window(title="pyMatPlotLibTest")
> self.window_main.connect("destroy", lambda x: Gtk.main_quit())
> self.window_main.add(self.canvas)
> self.window_main.show_all()
>
> # Ticker for the update of the input state monitoring
> Gdk.threads_add_timeout(priority = GLib.PRIORITY_DEFAULT_IDLE,
> interval = 10, # msec
> function = self.update_gui)
> Gtk.main()
>
>
> if __name__ == "__main__":
> gui = pyMatPlotLibTest()
>
>
> --
> View this message in context: matplotlib.backends.backend_gtk3cairo
> memory leak
> 
> Sent from the matplotlib - users mailing list archive
>  at
> Nabble.com.
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime Error on Solaris - Error Closing Dupe File Handle

2015-05-24 Thread Benjamin Root
Bryan,

First off, avoid importing things from modules that start with an
underscore. Because Python doesn't have semantics for public/private APIs
like C++ and Java does, the underscore is treated as an indicator to
developers that it is to be treated as private. The implication is that we
are free to change the API of "private" modules and functions between
releases, without warning or recourse, which would lead to breakage of your
scripts if you use them. So, use it at your peril.

I would recommend using plt.imread() instead, or use the Pillow package to
read your data as a numpy array that you can then plot.

Now, onto your issue. I suspect it might be related to changes we made in
1.4 to have a cross-platform file-handle. However, the solaris platform is
not regularly tested by anybody, so it is quite likely we broke something
there. Now, in the master branch on github, we completely rewrote nearly
all of the C++ code, so I while it may still be broken there, perhaps we
might get a more useful error message or something different entirely? Can
you try building from the master branch and letting us know?

Cheers!
Ben Root

P.S. - The script in question wasn't perhaps written originally by a former
Meteorologist colleague from the University of Oklahoma? ;-) If it was, he
was my officemate!


On Thu, May 21, 2015 at 4:08 PM, Bryan Williams <
bryan.williams7...@gmail.com> wrote:

> Good afternoon,
>
>
>
> My name is Bryan Williams. I work for the Florida Forest Service in their
> Forest Logistics and Support Bureau.
>
>
>
> I’m working on a program that takes weather data and visualizes it using
> matplotlib and Basemap. I’m currently having an issue with matplotlib 1.4.3
> for Python 3.4.3 running under Solaris 5.10. I am getting a Runtime Error
> whenever I try calling the read_png file from matplotlib._png. (I’m using
> this to add a small .png file of the Forest Service’s sheld to the
> picture). The error is the following:
>
>
>
> Traceback (most recent call last):
>
>   File "drawmaps.py", line 845, in 
>
> arr_lena = read_png(fn)
>
> RuntimeError: Error closing dupe file handle
>
>
>
> I don’t quite understand the error I’m getting, and as you can see, the
> traceback gives very little information. I also tried Google for help, but
> to no avail; entering the error message as is into Google doesn’t return
> anything relating to the problem, and putting quotes around “Error closing
> dupe file handle” yields about 10 results, with one of them being an
> unanswered question from 2014 regarding the same issue.
>
>
>
> As per your request on the website, here’s what I get from uname –a:
>
>
>
> SunOS [server name withheld] 5.10 Generic_141444-09 sun4v sparc
> SUNW,SPARC-Enterprise-T5220
>
>
>
> I built Python 3.4.3 from source and installed matplotlib through pip, and
> didn’t make any changes to the matplotlibrc file.
>
>
>
> I was able to reproduce the problem again running these commands in the
> Python interactive prompt, which emulates the snippet of script that causes
> the error:
>
>
>
> Python 3.4.3 (default, May 15 2015, 13:52:23)
>
> [GCC 4.9.2] on sunos5
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from matplotlib._png import read_png
>
> >>> from matplotlib.cbook import get_sample_data
>
> >>> import os; path=os.getcwd()
>
> >>> fn = get_sample_data(path + '/resources/shield.png', asfileobj=False)
>
> >>> arr_lena = read_png(fn)
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
>
> RuntimeError: Error closing dupe file handle
>
>
>
>
>
> If you’d like a copy of the problem script, please let me know. Any and
> all help is greatly appreciated.
>
>
>
> Thank you in advance!
>
>
>
> -- BMW
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] streamplot: vectors not pointing in the right direction!

2015-05-22 Thread Benjamin Root
The documentation for streamplot:

```
*x*, *y* : 1d arrays
an *evenly spaced* grid.
*u*, *v* : 2d arrays
x and y-velocities. Number of rows should match length of y, and
the number of columns should match x.
```

Note that the rows in *u* and *v* should match *y*, and the columns should
match *x*. I think your *u* and *v* are transposed.

Cheers!
Ben Root


On Fri, May 22, 2015 at 2:50 AM, Gabriele Brambilla <
gb.gabrielebrambi...@gmail.com> wrote:

> Hi,
>
> I have problems with streamplot
>
> I want to use a 3d vector field in coordinates (x,y,z) stored in a numpy
> array, and plot slices of it with streamplot.
>
> To test it I wanted to use a vector field with arrows pointed up in the
> z>0 region and pointed down in the z<0 region.
>
>
> import numpy as np
>
> import matplotlib.pyplot as plt
>
> from math import *
>
>
>
> max = 100
>
> min = -100
>
>
>
>
>
> X = np.linspace(min, max, num=100)
>
> Y = np.linspace(min, max, num=100)
>
> Z = np.linspace(min, max, num=100)
>
>
>
> N = X.size
>
>
>
> #single components in the 3D matrix
>
>
> Bxa = np.zeros((N, N, N))
>
> Bya = np.zeros((N, N, N))
>
> Bza = np.zeros((N, N, N))
>
>
>
>
>
> for i, x in enumerate(X):
>
> for j, y in enumerate(Y):
>
> for k, z in enumerate(Z):
>
> Bxa[ i, j, k] = 0.0 #x
>
> Bya[ i, j, k] = 0.0 #y
>
> Bza[ i, j, k] = z
>
>
>
> #I take a slice close to Y=0
>
> Bx_sec = Bxa[:,N/2,:]
>
> By_sec = Bya[:,N/2,:]
>
> Bz_sec = Bza[:,N/2,:]
>
>
>
> fig = plt.figure()
>
> ax = fig.add_subplot(111)
>
> ax.streamplot(X, Z, Bx_sec, Bz_sec, color='b')
>
> ax.set_xlim([X.min(), X.max()])
>
> ax.set_ylim([Z.min(), Z.max()])
>
>
>
> plt.show()
>
>
> But I obtain something that looks like if I have put Bza = x! I tried to
> invert the order of vectors but it is unuseful!
>
> I attach the picture. Do you understand why? (the code I posted should run)
>
> Gabriele
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fixing axes for imshow plot on top of a figure

2015-05-21 Thread Benjamin Root
I think you want figimage():
http://matplotlib.org/examples/pylab_examples/figimage_demo.html

I use it all the time for adding the company's logo to graphs. Keep in mind
that it will plot the unsampled version of the image, so the final result
depends on the figure size and resolution.

I hope that helps!
Ben Root


On Wed, May 20, 2015 at 7:43 AM, aradand  wrote:

> I'm trying to plot an image on top of a Figure, but imshow seems to always
> distort the size of the axes. What I want is that the lower part of the top
> image stay always in the same position, for any image height
>
> This minimal example shows my issue
>
> import matplotlib.pyplot as plt
> import numpy as np
>
> fig = plt.figure()
> ax = fig.add_axes([0.1, 0, 1, 1])
>
> # Top figure aligned with the bottom figure
> # keeping the same width (?)
> ax2 = fig.add_axes([0.1, 1, 1, 1])
> ax2.set_xticks([])
>
> # Depending on the number of rows or columns
> # the top image will be moved further to the top
> # or will be stretched if rows > columns
> # I dont know how to control this to stay always
> # with the same separation with respect
> # to the bottom figure and keeping the same width
> # (so the frame is the same width than the bottom figure)
> im = np.random.rand(10, 30)
> ax2.imshow(im)
> plt.plot()
>
> If it is possible to
>
> I would prefer to avoid using subplots or grid, since I have already
> specified a lot of things using the add_axes method.
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Fixing-axes-for-imshow-plot-on-top-of-a-figure-tp45579.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to plot a 2d streamline in 3d view in matplotlib

2015-05-21 Thread Benjamin Root
Sorry, it is "line_collection_2d_to_3d()".

On Thu, May 21, 2015 at 12:02 PM, Raj Kumar Manna 
wrote:

> Its giving a error,
>
> art3d.linecollection_2d_to_3d(stream.lines)
> AttributeError: 'module' object has no attribute 'linecollection_2d_to_3d'
>
>
>
> Here is my script,
>
>
> import matplotlib.pyplot as plt
> from matplotlib.patches import Circle, PathPatch
> from mpl_toolkits.mplot3d import Axes3D
> import mpl_toolkits.mplot3d.art3d as art3d
> import numpy as np
> from pylab import *
> from matplotlib.collections import LineCollection
>
>
>
> fig = plt.figure()
> ax=fig.gca(projection='3d')
>
>
> f=np.loadtxt('flow-velocity343.dat')
> dx,dz=1.0,1.0
>
> xmin,zmin,xmax,zmax=min(f[:,0]),min(f[:,2]),max(f[:,0]),max(f[:,2])
> nbinx,nbinz=int((xmax-xmin)/dx)+1,int((zmax-zmin)/dz)+1
> Ux=np.zeros([nbinz,nbinx],'d')
> Uy=np.zeros([nbinz,nbinx],'d')
> Uz=np.zeros([nbinz,nbinx],'d')
> speed=np.zeros([nbinz,nbinx],'d')
> logv=np.zeros([nbinz,nbinx],'d')
>
>
>
> for f1 in f:
> binx,binz=int((f1[0]-xmin)/dx),int((f1[2]-zmin)/dz)
> Ux[binz][binx]=f1[3]
> Uy[binz][binx]=f1[4]
> Uz[binz][binx]=f1[5]
> speed[binz][binx] = np.sqrt( Ux[binz][binx]*Ux[binz][binx] +
> Uz[binz][binx]*Uz[binz][binx] + Uy[binz][binx]*Uy[binz][binx] )
> logv[binz][binx] = log(speed[binz][binx])
> x,z=np.arange(xmin,xmax+dx,dx),np.arange(zmin,zmax+dz,dz)
> y=np.arange(0,71,1)
> X,Z=np.meshgrid(x,z)
>
> stream = ax.streamplot(X, Z, Ux, Uz, color='black', linewidth=2)
> #lines = stream.lines.get_paths()
>
> art3d.linecollection_2d_to_3d(stream.lines)
> for p in stream.arrows:
> art3d.patch_2d_to_3d(p)
>
>
>
> plt.show()
>
>
>
>
>
> Thanks
> Raj
>
>
> On Thu, May 21, 2015 at 9:19 PM, Benjamin Root  wrote:
>
>> (keeping the discussion on the mailing list)
>>
>> The object you get back have two attributes: "lines" and "arrows". This
>> is just psuedo-code, but it would look something like this:
>>
>> ```
>> stream = ax.streamplot(..)
>> art3d.linecollection_2d_to_3d(stream.lines, )
>> for p in stream.arrows:
>> art3d.patch_2d_to_3d(p, ...)
>> ```
>> Again, I have no clue if this actually would work. I haven't tried doing
>> this myself.
>>
>> Ben Root
>>
>> On Thu, May 21, 2015 at 11:39 AM, Raj Kumar Manna <
>> rajphysics@gmail.com> wrote:
>>
>>> Thanks for your quick reply.
>>>
>>> I have plotted the streamplot in 2d . I am not able to extract lines or
>>> arrow from streamplot. I am new user of matplotlib, can you please tell me
>>> the syntax to extract lines and arrows from streamplot().
>>>
>>> Thanks for you help.
>>> Raj
>>>
>>> On Thu, May 21, 2015 at 8:30 PM, Benjamin Root  wrote:
>>>
>>>> Well, there is the new 3D quiver feature:
>>>> http://matplotlib.org/examples/mplot3d/quiver3d_demo.html. Not quite
>>>> streamlines, but it might do in a pinch.
>>>>
>>>> Another approach:
>>>> There is the 2d streamplot() function that returns a specialized
>>>> object. From the docstring:
>>>> ```
>>>> Returns:
>>>>
>>>> *stream_container* : StreamplotSet
>>>> Container object with attributes
>>>>
>>>> - lines: `matplotlib.collections.LineCollection` of
>>>> streamlines
>>>>
>>>> - arrows: collection of
>>>> `matplotlib.patches.FancyArrowPatch`
>>>>   objects representing arrows half-way along stream
>>>>   lines.
>>>> ```
>>>>
>>>> You might be able to get away with using the "lines" object and feeding
>>>> it through art3d.line_collection_2d_to_3d(), kind of like how it is done
>>>> for pathpatch objects here:
>>>> http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html. You
>>>> might also be able to pass the individual objects in the "arrows" list
>>>> through art3d.patch_2d_to_3d(), but I have no clue if that would actually
>>>> work or not.
>>>>
>>>> I hope that helps!
>>>> Ben Root
>>>>
>>>>
>>>> On Thu, May 21, 2015 at 7:45 AM, Raj Kumar Manna <
>>>> rajphysics@gmail.com> wro

Re: [Matplotlib-users] How to plot a 2d streamline in 3d view in matplotlib

2015-05-21 Thread Benjamin Root
(keeping the discussion on the mailing list)

The object you get back have two attributes: "lines" and "arrows". This is
just psuedo-code, but it would look something like this:

```
stream = ax.streamplot(..)
art3d.linecollection_2d_to_3d(stream.lines, )
for p in stream.arrows:
art3d.patch_2d_to_3d(p, ...)
```
Again, I have no clue if this actually would work. I haven't tried doing
this myself.

Ben Root

On Thu, May 21, 2015 at 11:39 AM, Raj Kumar Manna 
wrote:

> Thanks for your quick reply.
>
> I have plotted the streamplot in 2d . I am not able to extract lines or
> arrow from streamplot. I am new user of matplotlib, can you please tell me
> the syntax to extract lines and arrows from streamplot().
>
> Thanks for you help.
> Raj
>
> On Thu, May 21, 2015 at 8:30 PM, Benjamin Root  wrote:
>
>> Well, there is the new 3D quiver feature:
>> http://matplotlib.org/examples/mplot3d/quiver3d_demo.html. Not quite
>> streamlines, but it might do in a pinch.
>>
>> Another approach:
>> There is the 2d streamplot() function that returns a specialized object.
>> From the docstring:
>> ```
>> Returns:
>>
>> *stream_container* : StreamplotSet
>> Container object with attributes
>>
>> - lines: `matplotlib.collections.LineCollection` of
>> streamlines
>>
>> - arrows: collection of
>> `matplotlib.patches.FancyArrowPatch`
>>   objects representing arrows half-way along stream
>>   lines.
>> ```
>>
>> You might be able to get away with using the "lines" object and feeding
>> it through art3d.line_collection_2d_to_3d(), kind of like how it is done
>> for pathpatch objects here:
>> http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html. You might
>> also be able to pass the individual objects in the "arrows" list through
>> art3d.patch_2d_to_3d(), but I have no clue if that would actually work or
>> not.
>>
>> I hope that helps!
>> Ben Root
>>
>>
>> On Thu, May 21, 2015 at 7:45 AM, Raj Kumar Manna <
>> rajphysics@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I need to plot a 2d streamline in 3d view like this
>>> <http://stackoverflow.com/questions/14963004/continuous-shades-on-matplotlib-3d-surface>.
>>> As suggested by the post
>>> <http://stackoverflow.com/questions/16252231/symmetric-streamplot-with-matplotlib/16373060#16373060>,
>>> I need to extract streamlines and arrows from a 2d plot and then transform
>>> it to 3d data. How to transform this 2d streamline data to 3d data and plot
>>> using mplot3d?
>>>
>>> Thanks in advance.
>>>
>>> Raj
>>>
>>>
>>> --
>>> ##
>>> Raj Kumar Manna
>>> Complex Fluid & Biological Physics Lab
>>> IIT Madras
>>>
>>> Ph. No. 8144637401
>>>
>>> alternate email: r...@physics.iitm.ac.in 
>>> 
>>>
>>>
>>> --
>>> One dashboard for servers and applications across Physical-Virtual-Cloud
>>> Widest out-of-the-box monitoring support with 50+ applications
>>> Performance metrics, stats and reports that give you Actionable Insights
>>> Deep dive visibility with transaction tracing using APM Insight.
>>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>
>
> --
> ##
> Raj Kumar Manna
> Complex Fluid & Biological Physics Lab
> IIT Madras
>
> Ph. No. 8144637401
>
> alternate email: r...@physics.iitm.ac.in 
> 
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to plot a 2d streamline in 3d view in matplotlib

2015-05-21 Thread Benjamin Root
Well, there is the new 3D quiver feature:
http://matplotlib.org/examples/mplot3d/quiver3d_demo.html. Not quite
streamlines, but it might do in a pinch.

Another approach:
There is the 2d streamplot() function that returns a specialized object.
>From the docstring:
```
Returns:

*stream_container* : StreamplotSet
Container object with attributes

- lines: `matplotlib.collections.LineCollection` of
streamlines

- arrows: collection of `matplotlib.patches.FancyArrowPatch`
  objects representing arrows half-way along stream
  lines.
```

You might be able to get away with using the "lines" object and feeding it
through art3d.line_collection_2d_to_3d(), kind of like how it is done for
pathpatch objects here:
http://matplotlib.org/examples/mplot3d/pathpatch3d_demo.html. You might
also be able to pass the individual objects in the "arrows" list through
art3d.patch_2d_to_3d(), but I have no clue if that would actually work or
not.

I hope that helps!
Ben Root


On Thu, May 21, 2015 at 7:45 AM, Raj Kumar Manna 
wrote:

> Hi,
>
> I need to plot a 2d streamline in 3d view like this
> .
> As suggested by the post
> ,
> I need to extract streamlines and arrows from a 2d plot and then transform
> it to 3d data. How to transform this 2d streamline data to 3d data and plot
> using mplot3d?
>
> Thanks in advance.
>
> Raj
>
>
> --
> ##
> Raj Kumar Manna
> Complex Fluid & Biological Physics Lab
> IIT Madras
>
> Ph. No. 8144637401
>
> alternate email: r...@physics.iitm.ac.in 
> 
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot problem

2015-05-18 Thread Benjamin Root
I noticed in your output that another figure seems to have been created
(you see its output as ""). It
would be useful to add some print statements to figure out exactly which
line is emitting that. Second, you are calling "plt.savefig()" in the
for-loop for the same filename. I suspect that isn't what you want. I am
going to assume that you want to save a final figure after the for-loop is
complete, right?

Also, it would be more clear to use "fig.savefig()" instead of the more
"magical" plt.savefig() as the latter would automatically create a figure
if one didn't exist for some reason.

Ben Root


On Sat, May 16, 2015 at 11:57 AM, Thomas Caswell  wrote:

> This is coming out of the pandas plotting tools, you might get better
> answers on their mailing list.
>
> Tom
>
> On Sat, May 16, 2015 at 11:51 AM Juan Wu  wrote:
>
>> Hi, List experts,
>>
>> I have a matplotlib problem when I tried to use a tool called HDDM. As
>> HDDM is another issue, I here just post my problem with Matplotlib. In
>> short, the error alarm appeard when I input fig = plt.figure(). I am a
>> beginner with those stuff.
>>
>> I would appreciate if anyone can give me any good pointers.
>>
>> Thanks so much,
>> Juan
>>
>> ==
>>
>> In [8]: fig = plt.figure()
>> 
>>
>> In [9]: ax = fig.add_subplot(111, xlabel='RT', ylabel='count',
>> title='RT distributions')
>>
>> In [10]: for i, subj_data in data.groupby('subj_idx'):
>> ...: subj_data.rt.hist(bins=20, histtype='step', ax=ax)
>> ...: plt.savefig('hddm_demo_fig_00.pdf')
>>
>> 
>> Traceback (most recent call last):
>>
>>   File "", line 2, in 
>> subj_data.rt.hist(bins=20, histtype='step', ax=ax)
>>
>>   File "C:\Anaconda\lib\site-packages\pandas\tools\plotting.py", line
>> 2830, in hist_series
>> raise AssertionError('passed axis not bound to passed figure')
>>
>> AssertionError: passed axis not bound to passed figure
>>
>> (relevant link:
>> https://groups.google.com/forum/#!topic/hddm-users/yBeIRJaHGwo
>> there very few experts view and reply questions)
>>
>>
>> --
>> One dashboard for servers and applications across Physical-Virtual-Cloud
>> Widest out-of-the-box monitoring support with 50+ applications
>> Performance metrics, stats and reports that give you Actionable Insights
>> Deep dive visibility with transaction tracing using APM Insight.
>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Good line plot color cycle for colorblind readers?

2015-05-15 Thread Benjamin Root
I am a huge fan of cycling line styles in conjunction with cycling colors
in general. There is a cycler PR that achieves that goal fairly nicely:
https://github.com/matplotlib/matplotlib/pull/4258

On Fri, May 15, 2015 at 5:59 PM, Eric Firing  wrote:

> On 2015/05/15 11:41 AM, Nathan Goldbaum wrote:
> > Hi all,
> >
> > This is a bit of a case of lazy mailing list, but I'm hoping there might
> > be some experts here who can point me in the right direction.
> >
> > Does anyone know of a good resource to pull a color cycle for line plots
> > that are good for color-blind readers?  I'm currently writing a paper
> > that includes a number of plots that include multiple line plots in the
> > same axes, and it would be nice if I'm not alienating a significant
> > fraction of my readers with a poor color choice.
>
> You might want to cycle line types and/or thicknesses along with colors.
>   You could also check out the seaborn line color palettes.
>
> http://stanford.edu/~mwaskom/software/seaborn/
>
> Eric
>
> >
> > Thanks very much for your help!
> >
> > -Nathan
> >
> >
> >
> --
> > One dashboard for servers and applications across Physical-Virtual-Cloud
> > Widest out-of-the-box monitoring support with 50+ applications
> > Performance metrics, stats and reports that give you Actionable Insights
> > Deep dive visibility with transaction tracing using APM Insight.
> > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> >
> >
> >
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap - UTM Support

2015-05-14 Thread Benjamin Root
Nick,

Just to be clear, cartopy is intended to supersede basemap, but there are
still many advantages at the moment to basemap over cartopy. The codebase
is much more mature, and it is much easier to install than cartopy. I still
regularly use basemap because I don't need the more advanced features of
cartopy (yet).

This isn't to discourage you from cartopy, just simply to help put the
utility of the projects in the right context.

Cheers!
Ben Root


On Wed, May 13, 2015 at 6:20 PM, Nick Eubank  wrote:

> Thanks Don. The consensus seems to be that I need to move to Cartopy,
> which apparently supersedes Basemap.
>
> (Just realized the helpful responses I received weren't cc'd to the list,
> so responding here for the record).
>
> On Wed, May 13, 2015 at 1:47 PM Don Morton 
> wrote:
>
>> Hi,
>>
>> I only partially know what I'm talking about, but what the heck.  Have
>> you considered pyproj (which Basemap is apparently built on)?  Pyproj seems
>> to support any kind of projection you could even imagine, and a quick
>> ggogle suggests UTM would be included.
>>
>> I had to learn all about this to some depth in order to teach it last
>> summer to a group in Vienna, and I have slides at
>>
>>
>> https://sites.google.com/a/borealscicomp.com/zamg-scientific-python-aug-sep-2014/home
>>
>> and if you go to course slides, 06-PlottingMetData, starting at about
>> Slide 60, I have some examples which lead up to Basemap.  My intent was to
>> try to get students to understand the how and why of plotting grids in
>> projections, then moving on to Basemap.  This way they might have a better
>> idea of how to deal with Basemap when things go wrong.  I think I just
>> confused them, though :)
>>
>> At any rate, I haven't tried it, but I think it would be fairly simple to
>> do what you want, IF you understand some of the low-level aspects.  But,
>> maybe UTM is harder than I am imagining.
>>
>> All the best,
>>
>> Don Morton
>>
>>
>>
>> ---
>> Don Morton, Owner/Manager
>> Boreal Scientific Computing LLC
>> Fairbanks, Alaska USA
>> http://www.borealscicomp.com/
>> http://www.borealscicomp.com/Miscellaneous/MortonBio/
>>
>> On Mon, May 11, 2015 at 4:45 PM, Nick Eubank 
>> wrote:
>>
>>> Hi All,
>>>
>>> Trying to move from ArcGIS into pure python GIS, but am a little
>>> surprised to find that UTM is not (directly) supported as a projection.
>>> Going through the machinations in the utmtest.py file
>>> 
>>> every time I want to plot a map in UTM seems a little unwieldy.
>>>
>>> Please excuse my ignorance, but is there a reason it is so hard to
>>> support / any plans to integrate in the future / any other easier paths to
>>> plotting UTMs I don't know about?
>>>
>>> Thanks,
>>>
>>> Nick
>>>
>>>
>>> --
>>> One dashboard for servers and applications across Physical-Virtual-Cloud
>>> Widest out-of-the-box monitoring support with 50+ applications
>>> Performance metrics, stats and reports that give you Actionable Insights
>>> Deep dive visibility with transaction tracing using APM Insight.
>>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Cartopy install problem: this correct forum?

2015-05-13 Thread Benjamin Root
No, it isn't this list. I think it is the Iris list instead:
https://groups.google.com/forum/#!forum/scitools-iris

On Wed, May 13, 2015 at 1:06 PM, Nick Eubank  wrote:

> Not sure if this is the right forum; also posting to Stack Overflow (
> http://stackoverflow.com/questions/30221047/cartopy-conda-install-error-osx-library-not-loaded-rpath-libproj-0-dylib
> ). Will re-post any answers from here to SO.
>
> Did conda install:
>
> conda install -c scitools cartopy
>
> Seemed to go find, but now I'm getting the following error:
>
> import cartopy.crs as ccrs
> Traceback (most recent call last):
>
>   File "", line 1, in 
> import cartopy.crs as ccrs
>
>   File 
> "/Users/Nick/anaconda/lib/python2.7/site-packages/cartopy/__init__.py", line 
> 110, in 
> import cartopy.crs
>
>   File "/Users/Nick/anaconda/lib/python2.7/site-packages/cartopy/crs.py", 
> line 37, in 
> from cartopy._crs import CRS, Geocentric, Geodetic, Globe, PROJ4_RELEASE
> ImportError: 
> dlopen(/Users/Nick/anaconda/lib/python2.7/site-packages/cartopy/_crs.so, 2): 
> Library not loaded: @rpath/libproj.0.dylib
>   Referenced from: 
> /Users/Nick/anaconda/lib/python2.7/site-packages/cartopy/_crs.so
>   Reason: image not found
>
> Any suggestions?
>
> I also tried building from source and got the same problem.
>
> I had a prior install of GDAL Complete, if that matters.
> Thanks!
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] getting equation from a surface-fit model

2015-05-08 Thread Benjamin Root
This question would be much more suited for the scipy mailing list.

On Fri, May 8, 2015 at 2:19 AM, diffracteD  wrote:

> Hi.
>   I have a data set like following:
> x = [2.06, 2.07, 2.14, 2.09, 2.2, 2.05, 1.92, 2.06, 2.11, 2.07]
> y = [171.82, 170.8, 159.59, 164.28, 169.98, 162.23, 167.37, 173.81,166.66,
> 155.13]
> z = [-1.41, -1.26, -1.07, -1.07, -1.46, -0.95, -0.08, -1.28, -1.2, -0.86]
>
> Using matplotlib, scipy.linalg.lstsq function I've got a surface-fit model.
> But is it possible to print the "equation of the surface ??"
> Found no clue in documentation page.
>
> Please help !
> thank you.
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/getting-equation-from-a-surface-fit-model-tp45490.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug in zorder example

2015-05-07 Thread Benjamin Root
But, why is it doing that only along the top edge and not the other edges
(or are my eyes that bad)?

On Thu, May 7, 2015 at 11:30 AM, Thomas Caswell  wrote:

> zorder can be negative, if you want to ensure that all of your lines are
> always below all of the standard axis components simple decrease  the
> zorder of the elements you want behind rather than increasing the zorder of
> the elements you want in front.
>
> @ben look at the top left of
> http://matplotlib.org/mpl_examples/pylab_examples/zorder_demo_01.hires.png
> and compare where it looks like the red and green lines are clipped.
>
> Tom
>
> On Thu, May 7, 2015 at 11:14 AM plotter  wrote:
>
>> The second example on
>> http://matplotlib.org/examples/pylab_examples/zorder_demo.html seems to
>> expose a bug, which is clearly visible in the vector version:
>>
>> The blue curve with zorder=2 is plotted below the frame and all others
>> with
>> zorder >= 3 are plotted above the frame. This is because the frame zorder
>> is
>> hardcoded to be 2.5. This behaviour is certainly unexpected by most users.
>> How can one modify the mutual zorder of lines without conflicting with
>> standard axis elements?
>>
>>
>>
>> --
>> View this message in context:
>> http://matplotlib.1069221.n5.nabble.com/bug-in-zorder-example-tp45342.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> --
>> One dashboard for servers and applications across Physical-Virtual-Cloud
>> Widest out-of-the-box monitoring support with 50+ applications
>> Performance metrics, stats and reports that give you Actionable Insights
>> Deep dive visibility with transaction tracing using APM Insight.
>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2D data plotted in a 3D plot by adding time flow dimension

2015-05-07 Thread Benjamin Root
Looks like nabble swallowed your code snippet. Here it is:

```

import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
import numpy.random as rnd
import numpy as np

TILL = 200 # just to have an end in the for loop

def SSI(t): #Simulated Serial Input
T = np.asarray(t)
X = np.sin(T)
Y = np.cos(T)
return X,Y,T

t = range(0,TILL/2)

plt.ion()
fig = plt.figure()
ax = p3.Axes3D(fig)
#ax = fig.gca(projection='3d') # same result as Axes3D
X,Y,T = SSI(t)
g, = ax.plot(X,Y,T) # for set_data method
#ax.plot(X,Y,T) # not using set_data method

plt.ylim([-1.5,1.5])
plt.xlim([-1.5,1.5])

for i in range(TILL):
val = rnd.random(1)
t.append(val)
t.pop(0)
X,Y,T = SSI(t)
#plt.plot(X,Y,T)
g.set_data(X,Y) #
#ax.set_zlim(i,i+100) # to make the time axis sliding
plt.draw()
#g.axes.figure.canvas.draw() # Same result as plt.draw()


```

Unfortunately, IIRC, set_data() for the 3d objects is probably not what you
want. See https://github.com/matplotlib/matplotlib/issues/1483.

Ben Root


On Sat, May 2, 2015 at 7:05 AM, arjunascagnetto 
wrote:

> hi,
>
>
> I try to make my question as clear as possible. I need to plot 2
> dimensional
> data coming from the serial onto a 3d plot with the third axes made of time
> flowing.
>
> I wrote this code (it's just one of the many tries). It's about the
> plotting
> only, not worring about buffer from serial etc etc...
>
>
>
>
> With set_data i have a static picture, with ax.plot at every for index I
> can't understand what's happening.
>
> any help would be really appreciate.
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/2D-data-plotted-in-a-3D-plot-by-adding-time-flow-dimension-tp45468.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to draw circles in logscale plots

2015-05-07 Thread Benjamin Root
A quick-n-dirty way would be to use markers via the scatter() function.
Just set the facecolor to 'none', and some very large markersize value.

Ben Root

On Wed, Apr 8, 2015 at 12:49 PM, LowDepth  wrote:

> Hello,
>
> how can I plot circles or other shapes in plots which have logarithmic
> axis?
> I have a grid of 3 plots and want to plot some kind of sketches in the
> lower
> right corner of
> each subplot. How should I do that?
>
> import numpy as np
> from matplotlib import pyplot as plt
> from matplotlib import gridspec
>
> fig = plt.figure(figsize=(6, 10))
> gs = gridspec.GridSpec(3, 1, height_ratios=[1.5, 1, 1])#, height_ratios=[2,
> 1, 1])
> ax0 = plt.subplot(gs[0])
> ax1 = plt.subplot(gs[1])
> ax2 = plt.subplot(gs[2])
> plt.setp(ax_new.get_yticklabels(), visible=False)
> plt.setp(ax_new.get_xticklabels(), visible=False)
> ax_new = fig.add_axes([0,0,1,1], frameon=False,aspect="equal")
> ax_new.axes.get_yaxis().set_visible(False)
> ax_new.axes.get_xaxis().set_visible(False)
> circle1=plt.Circle((0.2,0.0),0.05, color="0.8")
> circle2=plt.Circle((0.4,0.0),0.05, color="0.8")
> ax_new.add_artist(circle1)
> ax_new.add_artist(circle2)
>
> ax0.semilogx(x,x**2, "k-", linewidth=2)
> ax1.semilogx(x,x**3, "k--", linewidth=2)
> ax2.semilogx(x,np.exp(-x)+x**4, "k-.", linewidth=2)
> plt.tight_layout()
> plt.show()
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/How-to-draw-circles-in-logscale-plots-tp45367.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug in zorder example

2015-05-07 Thread Benjamin Root
you can always change the zorder of the frame using set_zorder(). Are you
talking about the frame of the legend or the plotting area?

On Mon, Apr 6, 2015 at 11:23 AM, plotter  wrote:

> The second example on
> http://matplotlib.org/examples/pylab_examples/zorder_demo.html seems to
> expose a bug, which is clearly visible in the vector version:
>
> The blue curve with zorder=2 is plotted below the frame and all others with
> zorder >= 3 are plotted above the frame. This is because the frame zorder
> is
> hardcoded to be 2.5. This behaviour is certainly unexpected by most users.
> How can one modify the mutual zorder of lines without conflicting with
> standard axis elements?
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/bug-in-zorder-example-tp45342.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-29 Thread Benjamin Root
add_subplot(111, projection='3d')
> Y, Z, X = arr
>
> mainwindow.addmpl(fig1)
> ax1f1.mouse_init()
>
> ax1f1.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
>
> than mouse rotation is back online, no warning, no error.
>
> As I asked at the beginning, it was just the right place where the
> mouse_init() has to be put.
> It bothered me so much that I dug into API again and searched for
> mouse_init(). Taking the error message into account, "mouse rotation off" I
> figured out that it's an axis problem. It's not the canvas which is
> rotated, it's all about the axis, so I found the usage for the mouse_init().
>
> Thank you very much for all your effort and the patience to go this way
> with me.
>
> At last I have a good advice for you: Go and switch to using Qt Designer
> and PyQt5, it really helps having good gui's for the uninitiated.
>
> cheers,
> Christian
>
> Ps: I'll get back to you, when I'm done reading your book completely.
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
>   On Wednesday, April 29, 2015 1:46 PM, Benjamin Root 
> wrote:
>
>
> Here is a proof of concept (yes, it uses qt4... my work computer doesn't
> have qt5, but that should be a straight-forward modification to make). Note
> the complete lack of any call to mouse_init() and the complete lack of any
> use of pyplot (in fact, I commented it out to make the point that you
> shouldn't use pyplot *at all* when doing this sort of embedding).
>
> ```
> import numpy as np
> #import matplotlib.pyplot as plt
> import sys
> from matplotlib.backends.qt4_compat import QtGui, QtCore
> from matplotlib.figure import Figure
> from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
> FigureCanvas
>
> from mpl_toolkits.mplot3d import Axes3D
>
>
> if __name__ == '__main__':
> # Must come before any Qt widgets are made
> app = QtGui.QApplication(sys.argv)
> win = QtGui.QMainWindow()
> fig = Figure()
> canvas = FigureCanvas(fig)
> ax = fig.add_subplot(1, 1, 1, projection='3d')
>
> xs = np.random.rand(25)
> ys = np.random.rand(25)
> zs = np.random.rand(25)
> ax.scatter(xs, ys, zs)
>
> win.resize(int(fig.bbox.width), int(fig.bbox.height))
> win.setWindowTitle("Embedding with Qt")
> # Needed for keyboard events
> canvas.setFocusPolicy(QtCore.Qt.StrongFocus)
> canvas.setFocus()
> win.setCentralWidget(canvas)
> win.show()
> sys.exit(app.exec_())
> ```
>
> I hope this helps!
> Ben Root
>
>
> On Wed, Apr 29, 2015 at 5:38 AM, Christian Ambros 
> wrote:
>
> Ok, back from revision...
>
> The is no mix-up for the show command. The only explicit show() command is
> commented out in line 41. It can be deleted. But I haven't done that, yet.
> There are several bits of code which are remains of the design process
> since this is work in progress. Code cleaning will be done when the main
> functionality is in place.
>
> Back to addmpl where I embedded gui elements into the canvas. Taking out
> the matplotlib taskbar doesn't change a thing as I wrote earlier, but to
> make sure it doesn't bother the mainloop, it should be commented out. I may
> not put it back in, because I don't see the point in needing it. It was
> just to see if it's possible.
>
> >>But option 2 relinquishes that control to the developer's GUI app. You
> *cannot* use pyplot for option 2, which is what you are doing.
>
> Is that so? In line 116 I create the canvas, which is derived from
> matplotlib's backend's FigureCanvasQTAgg and given to the QWidget at line
> 119. That's the only part where both interact with each other. the rest is
> handle by matplotlib.
>
> The error message says that Axes3D.figure.canvas is 'None' and that's why
> mouse rotation is disabled.
> It's None because there is no content at that point, when it's passed to
> the QWidget. It's filled with content in line 38. So if matplotlib disables
> the mouse rotation by default, when the canvas is empty how do I prevent
> this disabling by default?
> If I can't, at what point do I have to pass the filled canvas to the
> QWidget? How does that impact the GUI itself?
> If I can't enable the mouse rotation by hand and I just can pass filled
> canvas around, do I have to build a work around with initialize it with an
> empty 2D canvas and replace it later with the filled 3D canvas? How

Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-29 Thread Benjamin Root
Here is a proof of concept (yes, it uses qt4... my work computer doesn't
have qt5, but that should be a straight-forward modification to make). Note
the complete lack of any call to mouse_init() and the complete lack of any
use of pyplot (in fact, I commented it out to make the point that you
shouldn't use pyplot *at all* when doing this sort of embedding).

```
import numpy as np
#import matplotlib.pyplot as plt
import sys
from matplotlib.backends.qt4_compat import QtGui, QtCore
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
FigureCanvas

from mpl_toolkits.mplot3d import Axes3D


if __name__ == '__main__':
# Must come before any Qt widgets are made
app = QtGui.QApplication(sys.argv)
win = QtGui.QMainWindow()
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(1, 1, 1, projection='3d')

xs = np.random.rand(25)
ys = np.random.rand(25)
zs = np.random.rand(25)
ax.scatter(xs, ys, zs)

win.resize(int(fig.bbox.width), int(fig.bbox.height))
win.setWindowTitle("Embedding with Qt")
# Needed for keyboard events
canvas.setFocusPolicy(QtCore.Qt.StrongFocus)
canvas.setFocus()
win.setCentralWidget(canvas)
win.show()
sys.exit(app.exec_())
```

I hope this helps!
Ben Root


On Wed, Apr 29, 2015 at 5:38 AM, Christian Ambros  wrote:

> Ok, back from revision...
>
> The is no mix-up for the show command. The only explicit show() command is
> commented out in line 41. It can be deleted. But I haven't done that, yet.
> There are several bits of code which are remains of the design process
> since this is work in progress. Code cleaning will be done when the main
> functionality is in place.
>
> Back to addmpl where I embedded gui elements into the canvas. Taking out
> the matplotlib taskbar doesn't change a thing as I wrote earlier, but to
> make sure it doesn't bother the mainloop, it should be commented out. I may
> not put it back in, because I don't see the point in needing it. It was
> just to see if it's possible.
>
> >>But option 2 relinquishes that control to the developer's GUI app. You
> *cannot* use pyplot for option 2, which is what you are doing.
>
> Is that so? In line 116 I create the canvas, which is derived from
> matplotlib's backend's FigureCanvasQTAgg and given to the QWidget at line
> 119. That's the only part where both interact with each other. the rest is
> handle by matplotlib.
>
> The error message says that Axes3D.figure.canvas is 'None' and that's why
> mouse rotation is disabled.
> It's None because there is no content at that point, when it's passed to
> the QWidget. It's filled with content in line 38. So if matplotlib disables
> the mouse rotation by default, when the canvas is empty how do I prevent
> this disabling by default?
> If I can't, at what point do I have to pass the filled canvas to the
> QWidget? How does that impact the GUI itself?
> If I can't enable the mouse rotation by hand and I just can pass filled
> canvas around, do I have to build a work around with initialize it with an
> empty 2D canvas and replace it later with the filled 3D canvas? How's the
> mouse rotation activated then?
>
> In general, I wouldn't have to enable the rotation if it wouldn't be
> switch off for an empty canvas.
>
> I'm going to consult your book, now, for different ways of coping with
> such things...
>
> cheers,
> Christian
>
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
>   On Tuesday, April 28, 2015 8:28 PM, Benjamin Root 
> wrote:
>
>
> One thing I see off the bat is your addmpl() method:
>
> ```
> def addmpl(self, fig):
> #FigureCanvas.__init__(self, fig)
> self.canvas = FigureCanvas(fig)
>
> Axes3D.mouse_init(self, rotate_btn=1, zoom_btn=2)
> self.mplvl.addWidget(self.canvas)
> self.canvas.draw()
> self.toolbar = NavigationToolbar(self.canvas, self.mplwindow,
> coordinates=True)
> self.mplvl.addWidget(self.toolbar)
> ```
>
> You are calling Axes3D.mouse_init() on the Main object (that is `self`).
> That is completely wrong. It can only be called for the 3d axes objects.
>
> Also, what I see happening here is some mixing up of how to do embedding.
> There are two approaches to embedding. 1) you can embedded GUI elements
> into your canvas widget, or 2) you can embed your canvas widget into your
> GUI app. The important distinction between the two is who controls the
> mainloop. In option

Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-28 Thread Benjamin Root
One thing I see off the bat is your addmpl() method:

```
def addmpl(self, fig):
#FigureCanvas.__init__(self, fig)
self.canvas = FigureCanvas(fig)

Axes3D.mouse_init(self, rotate_btn=1, zoom_btn=2)
self.mplvl.addWidget(self.canvas)
self.canvas.draw()
self.toolbar = NavigationToolbar(self.canvas, self.mplwindow,
coordinates=True)
self.mplvl.addWidget(self.toolbar)
```

You are calling Axes3D.mouse_init() on the Main object (that is `self`).
That is completely wrong. It can only be called for the 3d axes objects.

Also, what I see happening here is some mixing up of how to do embedding.
There are two approaches to embedding. 1) you can embedded GUI elements
into your canvas widget, or 2) you can embed your canvas widget into your
GUI app. The important distinction between the two is who controls the
mainloop. In option 1 (and in matplotlib in general), pyplot will create
the GUI app for you automatically (it is completely transparent to you) and
kicks it off upon call to show(). But option 2 relinquishes that control to
the developer's GUI app. You *cannot* use pyplot for option 2, which is
what you are doing. Rip out all of the pyplot stuff, and instantiate the
Qt5 Figure object directly, and then obtain the axes objects from the
figure object via calls to add_subplot(). You shouldn't even need to do the
whole mouse_init() stuff.

I now think this has nothing to do with Qt Designer. While I don't
specifically cover qt5 in my book, I do make all of these distinctions very
clear in chapter 5 of my book "Interactive Applications using Matplotlib".

Cheers!
Ben Root


On Tue, Apr 28, 2015 at 4:03 PM, Christian Ambros  wrote:

> Hi Benjamin,
>
> I would do that if my task were my private stuff, but in this case it's
> work-related and my boss wants me to use the designer and he already set a
> deadline, which, I already knew, is set to tight. I told him before, that
> it would be just a try but he sold it to his boss after some pressure. You
> know how the bosses' bosses are, they don't get the idea that innovation
> can't be dictated. They don't understand the concept that software is
> written and doesn't come into existence out of nothing.
>
> Without PyQt5 it's working fine. I got the plots and they are gorgeous,
> but that doesn't help when presenting to the bosses. If I just would know
> how to activate the 3d-draw's mouse action again, by hand, than it has to
> last just some moments for the presentation, afterwards I have the time to
> examine and find a more robust solution.
>
> Thanks for the effort.
> cheers,
> Christian
>
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
>   On Tuesday, April 28, 2015 7:30 PM, Benjamin Root 
> wrote:
>
>
> I think there is something wrong with the embedding code rather than there
> being an actual bug. I have embedded mplot3d stuff before (admittedly, not
> in qt5) with no problems. I haven't had the time yet to examine your code
> to see what the potential issue is, though. I have also never used Qt
> designer, so I have no clue if there is something that it is doing that
> might be making things difficult.
>
> I already know that the code you originally posted has errors in it. I
> would suggest first making a prototype without Qt Designer as a
> proof-of-concept, perhaps starting with one of our examples in the gallery?
>
> Ben Root
>
>
> On Tue, Apr 28, 2015 at 2:12 PM, Christian Ambros 
> wrote:
>
>  Since there seems to be no progress with this issue, may I assume there
> isn't any interest in it?
> I took a further look around in the internet but couldn't any solution.
> It leads to an other question: How many users of matplotlib are using
> 3d-plots anyway? It we are just a few and there won't be anyone who wants
> to embed it in PyQt5, than I can understand that this issue doesn't concern
> no-one and I have to look somewhere else to find a 3d-plotting lib which is
> embedable.
>
> cheers,
> Christain
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
>   On Tuesday, April 21, 2015 1:44 PM, Benjamin Root 
> wrote:
>
>
> The addmpl() method isn't right. You created a canvas object, assigned it
> to self.canvas, but then tried to call FigureCanvas.__init__(), passing it
> whatever object "self" is. What class is addmpl() a part of? What does it
> subclass?
>
> On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros 
> wrote:

Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-28 Thread Benjamin Root
I think there is something wrong with the embedding code rather than there
being an actual bug. I have embedded mplot3d stuff before (admittedly, not
in qt5) with no problems. I haven't had the time yet to examine your code
to see what the potential issue is, though. I have also never used Qt
designer, so I have no clue if there is something that it is doing that
might be making things difficult.

I already know that the code you originally posted has errors in it. I
would suggest first making a prototype without Qt Designer as a
proof-of-concept, perhaps starting with one of our examples in the gallery?

Ben Root


On Tue, Apr 28, 2015 at 2:12 PM, Christian Ambros  wrote:

>  Since there seems to be no progress with this issue, may I assume there
> isn't any interest in it?
> I took a further look around in the internet but couldn't any solution.
> It leads to an other question: How many users of matplotlib are using
> 3d-plots anyway? It we are just a few and there won't be anyone who wants
> to embed it in PyQt5, than I can understand that this issue doesn't concern
> no-one and I have to look somewhere else to find a 3d-plotting lib which is
> embedable.
>
> cheers,
> Christain
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
>   On Tuesday, April 21, 2015 1:44 PM, Benjamin Root 
> wrote:
>
>
> The addmpl() method isn't right. You created a canvas object, assigned it
> to self.canvas, but then tried to call FigureCanvas.__init__(), passing it
> whatever object "self" is. What class is addmpl() a part of? What does it
> subclass?
>
> On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros 
> wrote:
>
> Hi,
>
> I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get
> the following error:
>
> /usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009:
> UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled.  Set
> canvas then call Axes3D.mouse_init().
>   warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation
> disabled.  Set canvas then call Axes3D.mouse_init().')
>
> From Stackoverflow, which host to question about this, I know that mouse
> actions are disabled when the canvas is re-initialized by whatever.
>
> The only position I do such an operation is in here:
>
>
>
>
>
>
>
> *def addmpl(self, fig):self.canvas = FigureCanvas(fig)
> #FigureCanvas.__init__(self, fig)#Axes3D.mouse_init(self)
> self.mplvl.addWidget(self.canvas)self.canvas.draw()
> self.toolbar = NavigationToolbar(self.canvas, self.mplwindow,
> coordinates=True)self.mplvl.addWidget(self.toolbar)*
>
> On of the Stackoverflow suggestion says, that re initializing FigureCanvas
> should do the trick but I'll get:
>
> Traceback (most recent call last):
>   File "./ex_0.1.py", line 145, in 
> main(sys.argv)
>   File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
>   File "./ex_0.1.py", line 116, in addmpl
> FigureCanvas.__init__(self, fig)
>   File
> "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py",
> line 181, in __init__
> FigureCanvasQT.__init__(self, figure)
>   File
> "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py",
> line 237, in __init__
> super(FigureCanvasQT, self).__init__(figure=figure)
> TypeError: super(type, obj): obj must be an instance or subtype of type
>
> as follow-up error message.
>
> just using *Axes3D.mouse_init()* , as suggested by matplotlib itself,
> leads to:
>
> Traceback (most recent call last):
>   File "./ex_0.1.py", line 146, in 
> main(sys.argv)
>   File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
>   File "./ex_0.1.py", line 118, in addmpl
> Axes3D.mouse_init()
> TypeError: mouse_init() missing 1 required positional argument: 'self'
>
> adding self leads to:
>
> Traceback (most recent call last):
>   File "./ex_0.1.py", line 146, in 
> main(sys.argv)
>   File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
>   File "./ex_0.1.py", line 118, in addmpl
> Axes3D.mouse_init(self)
>   File
> "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py",
> line 1002, in mouse_init
> canv = self.figure.canvas
> AttributeError: 'Main' object has no attribute 'figure'
> ./ex_0.1.py &
>
> Maybe I'm adding 

Re: [Matplotlib-users] animation.FuncAnimation example --- how does it work?

2015-04-23 Thread Benjamin Root
"Thanks for this also Ben --- I will quite likely get this book. However,
considering the complexity of Matplotlib --- only 174 pages bothers me a
little. :-)"

I am just that good!  No, really though, the book focuses only on a subset
of features in Matplotlib, and it does assume that you are somewhat
comfortable with the language (or at least, understand the basics of Object
Oriented Programming and terminology). There will be another book that will
come out in a few months that is intended to be a complete refresh of
Sandro Toshi's 2009 book that might be more up your alley, but I don't know
how much it will cover of Animations. Sandro's book was released before the
animation module was even a twinkle in Ryan May's eye...

Cheers!
Ben Root


On Thu, Apr 23, 2015 at 1:40 PM, Virgil Stokes  wrote:

>  On 23-Apr-2015 18:48, Benjamin Root wrote:
>
>  ... keeping conversation on-list ...
>
>  The reason why you get that error is because you took out the argument
> from the call signature. But, FuncAnimation assumes that it can send in at
> least one argument. That argument is not optional, even if you aren't using
> it. So, animate() was called with an argument by FuncAnimation internally,
> but since animate() as defined by you did not have that argument, it fails.
>
> Ok --- thanks again for the clarification. Who knows, with a little help
> from this list, I might someday be able to create some useful animations
> with Matplotlib ;-)
>
>
>  Cheers!
> Ben Root
>
>
> On Thu, Apr 23, 2015 at 12:32 PM, Virgil Stokes  wrote:
>
>>  On 23-Apr-2015 18:25, Benjamin Root wrote:
>>
>>   The documentation should say "the number", not "a number". This
>> particular argument expects either a generator, an iterable, or an integer.
>> If none is given, it will try and figure out something for itself. The
>> integer is used to create a number generator, and so you effectively have
>> an iterable that supplies the first argument to the animation function.
>>
>>  Ok Benjamin :-)   --- thanks for the clarification.
>>
>>
>>  Often times, the first argument to this function is just a frame index.
>> It is quite possible that you don't need it at all, but it is a part of the
>> defined API that the FuncAnimation assumes to be able to call the
>> user-supplied function.
>>
>>  Does that help?
>>
>>  Yes, this does indeed help. But I am still puzzled by the error message
>> given when I remove the argument to the animate function.
>>
>>
>>  Ben Root
>>
>>  
>>  P.S. - My new book "Interactive Applications using Matplotlib" has an
>> entire chapter devoted to animations
>>  
>>
>>Thanks for this also Ben --- I will quite likely get this book.
> However, considering the complexity of Matplotlib --- only 174 pages
> bothers me a little. :-)
>
>
>>
>> On Thu, Apr 23, 2015 at 12:05 PM, Virgil Stokes  wrote:
>>
>>>  Thanks for your reply to my post, Jerzy.
>>>
>>> On 23-Apr-2015 13:18, Jerzy Karczmarczuk wrote:
>>>
>>>
>>>
>>> Le 23/04/2015 12:22, Virgil Stokes a écrit :
>>>
>>> The following interesting example (random_data.py) is posted at:
>>>
>>> http://matplotlib.org/1.4.2/examples/animation/random_data.html
>>>
>>>
>>> import matplotlib.pyplot as plt
>>> import matplotlib.animation as animation
>>>
>>> import numpy as np
>>>
>>>   Yes, I forgot to include this
>>>
>>>
>>> fig, ax = plt.subplots()
>>> line, = ax.plot(np.random.rand(10))
>>> ax.set_ylim(0, 1)
>>>
>>> def update(data):
>>> line.set_ydata(data)
>>> return line,
>>>
>>> def data_gen():
>>> while True: yield np.random.rand(10)
>>>
>>> ani = animation.FuncAnimation(fig, update, data_gen, interval=100)
>>> plt.show()
>>>
>>> This codes works; but, I am very confused by it. For example:
>>>
>>> 1. There are 3 positional arguments given for animation.FuncAnimation;
>>> but, in the
>>> API documentation for this class (
>>> <http://matplotlib.org/api/animation_api.html>
>>> http://matplotlib.org/api/animation_api.html), only
>>> two positional arguments are shown.
>>>
>>> The third one is the third one,
>>> "*frames* can be a generator, an iterable, or a number of frames."
>>>
>>>  This makes very little sense to me --- what does "or a number of
>>> frames" m

Re: [Matplotlib-users] animation.FuncAnimation example --- how does it work?

2015-04-23 Thread Benjamin Root
Brendan, good catch, I didn't notice Virgil's confusion earlier. I think
that is a good explanation. I remember getting very confused by all of that
stuff back when I started in Python. I think mostly because I don't know of
any other language that does argument handling like how Python does it. I
learned it all by "school-of-hard-knocks". Does anybody recommend a really
good online reference that explains the ins-and-outs of positional and
keyword arguments for newbies?

Cheers!
Ben Root


On Thu, Apr 23, 2015 at 1:00 PM, Brendan Barnwell 
wrote:

> On 2015-04-23 03:22, Virgil Stokes wrote:
> >
> > 1. There are 3 positional arguments given for animation.FuncAnimation;
> > but, in the
> > API documentation for this class
> > (http://matplotlib.org/api/animation_api.html), only
> > two positional arguments are shown.
>
> One thing I think may be misleading you is that you seem to be
> misunderstanding how positional and keyword arguments work in Python.
> Specifying a default value for an argument in a function definition
> doesn't mean that you can *only* pass it by keyword when you call it.
> Any named argument can always be passed positionally or by keyword (in
> Python 2).  For instance, if I define a function like this:
>
> def foo(a, b=2):
>  print a+b
>
> I can still call it like this:
>
> foo(8, 10)
>
> I can even call it like this (passing both arguments as keywords "out of
> order")
>
> foo(b=10, a=8)
>
> Writing "b=2" in the function definition doesn't so much "make b a
> keyword argument" as just "specify a default value for b".  So in the
> FuncAnimation documentation you mentioned, "frames" is not required to
> be a keyword argument, and can still be passed positionally.  (In Python
> 3 there are keyword-only arguments, and even in Python 2 the variadic
> **kwargs syntax collects only keyword arguments, but those aren't
> involved as far as the "frame" argument here is concerned.)
>
> --
> Brendan Barnwell
> "Do not follow where the path may lead.  Go, instead, where there is no
> path, and leave a trail."
> --author unknown
>
>
> --
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animation.FuncAnimation example --- how does it work?

2015-04-23 Thread Benjamin Root
... keeping conversation on-list ...

The reason why you get that error is because you took out the argument from
the call signature. But, FuncAnimation assumes that it can send in at least
one argument. That argument is not optional, even if you aren't using it.
So, animate() was called with an argument by FuncAnimation internally, but
since animate() as defined by you did not have that argument, it fails.

Cheers!
Ben Root


On Thu, Apr 23, 2015 at 12:32 PM, Virgil Stokes  wrote:

>  On 23-Apr-2015 18:25, Benjamin Root wrote:
>
>   The documentation should say "the number", not "a number". This
> particular argument expects either a generator, an iterable, or an integer.
> If none is given, it will try and figure out something for itself. The
> integer is used to create a number generator, and so you effectively have
> an iterable that supplies the first argument to the animation function.
>
> Ok Benjamin :-)   --- thanks for the clarification.
>
>
>  Often times, the first argument to this function is just a frame index.
> It is quite possible that you don't need it at all, but it is a part of the
> defined API that the FuncAnimation assumes to be able to call the
> user-supplied function.
>
>  Does that help?
>
> Yes, this does indeed help. But I am still puzzled by the error message
> given when I remove the argument to the animate function.
>
>
>  Ben Root
>
>  
>  P.S. - My new book "Interactive Applications using Matplotlib" has an
> entire chapter devoted to animations
>  
>
>
> On Thu, Apr 23, 2015 at 12:05 PM, Virgil Stokes  wrote:
>
>>  Thanks for your reply to my post, Jerzy.
>>
>> On 23-Apr-2015 13:18, Jerzy Karczmarczuk wrote:
>>
>>
>>
>> Le 23/04/2015 12:22, Virgil Stokes a écrit :
>>
>> The following interesting example (random_data.py) is posted at:
>>
>> http://matplotlib.org/1.4.2/examples/animation/random_data.html
>>
>>
>> import matplotlib.pyplot as plt
>> import matplotlib.animation as animation
>>
>> import numpy as np
>>
>>  Yes, I forgot to include this
>>
>>
>> fig, ax = plt.subplots()
>> line, = ax.plot(np.random.rand(10))
>> ax.set_ylim(0, 1)
>>
>> def update(data):
>> line.set_ydata(data)
>> return line,
>>
>> def data_gen():
>> while True: yield np.random.rand(10)
>>
>> ani = animation.FuncAnimation(fig, update, data_gen, interval=100)
>> plt.show()
>>
>> This codes works; but, I am very confused by it. For example:
>>
>> 1. There are 3 positional arguments given for animation.FuncAnimation;
>> but, in the
>> API documentation for this class (
>> <http://matplotlib.org/api/animation_api.html>
>> http://matplotlib.org/api/animation_api.html), only
>> two positional arguments are shown.
>>
>> The third one is the third one,
>> "*frames* can be a generator, an iterable, or a number of frames."
>>
>>  This makes very little sense to me --- what does "or a number of frames"
>> mean?
>>
>> The name "data_gen" could suggest its meaning (after having read the
>> doc).
>>
>>  I am not sure what you are referencing as "the doc"; but I did read the
>> documentation several times and English is my native language.
>>
>> Note please that the keyword parameters are specified extra.
>>
>>  I am aware of this.  Perhaps, I am a Python dummy --- when I see
>> something like value = None in a Python API argument, I interpret this as a
>> keyword argument and not a generator.
>>
>>
>>  2. data, the argument to the update function seems to be undefined.
>>
>> FuncAnimation usually passes the frame number: 0, 1, 2, ... as the first
>> parameter of the update function, when "frames" is None, or the number of
>> frames. If - as here - the third parameter is a generator, it passes the
>> yielded data to update.
>>  It may be used or not.
>>
>>  Ok, I understand that better now. But, you say "or *the number* of
>> frames" but the documentation reads "or *a number* of frames" --- what
>> does this mean?
>>
>> And I still do not understand how to use the first argument of the
>> function to be called for the animation. In another animation example (
>> histogram.py), the animation function is defined by:
>>
>> def animate(i):
>> # simulate new data coming in
>> data = np.random.randn(1000
>> n, bins = np.histogram(data, 100)
>> top = bottom + n
>> verts[1::5

Re: [Matplotlib-users] animation.FuncAnimation example --- how does it work?

2015-04-23 Thread Benjamin Root
The documentation should say "the number", not "a number". This particular
argument expects either a generator, an iterable, or an integer. If none is
given, it will try and figure out something for itself. The integer is used
to create a number generator, and so you effectively have an iterable that
supplies the first argument to the animation function.

Often times, the first argument to this function is just a frame index. It
is quite possible that you don't need it at all, but it is a part of the
defined API that the FuncAnimation assumes to be able to call the
user-supplied function.

Does that help?

Ben Root


P.S. - My new book "Interactive Applications using Matplotlib" has an
entire chapter devoted to animations



On Thu, Apr 23, 2015 at 12:05 PM, Virgil Stokes  wrote:

>  Thanks for your reply to my post, Jerzy.
>
> On 23-Apr-2015 13:18, Jerzy Karczmarczuk wrote:
>
>
>
> Le 23/04/2015 12:22, Virgil Stokes a écrit :
>
> The following interesting example (random_data.py) is posted at:
>
> http://matplotlib.org/1.4.2/examples/animation/random_data.html
>
>
> import matplotlib.pyplot as plt
> import matplotlib.animation as animation
>
> import numpy as np
>
> Yes, I forgot to include this
>
>
> fig, ax = plt.subplots()
> line, = ax.plot(np.random.rand(10))
> ax.set_ylim(0, 1)
>
> def update(data):
> line.set_ydata(data)
> return line,
>
> def data_gen():
> while True: yield np.random.rand(10)
>
> ani = animation.FuncAnimation(fig, update, data_gen, interval=100)
> plt.show()
>
> This codes works; but, I am very confused by it. For example:
>
> 1. There are 3 positional arguments given for animation.FuncAnimation;
> but, in the
> API documentation for this class (
> http://matplotlib.org/api/animation_api.html), only
> two positional arguments are shown.
>
> The third one is the third one,
> "*frames* can be a generator, an iterable, or a number of frames."
>
> This makes very little sense to me --- what does "or a number of frames"
> mean?
>
> The name "data_gen" could suggest its meaning (after having read the doc).
>
> I am not sure what you are referencing as "the doc"; but I did read the
> documentation several times and English is my native language.
>
> Note please that the keyword parameters are specified extra.
>
> I am aware of this.  Perhaps, I am a Python dummy --- when I see something
> like value = None in a Python API argument, I interpret this as a keyword
> argument and not a generator.
>
>
>  2. data, the argument to the update function seems to be undefined.
>
> FuncAnimation usually passes the frame number: 0, 1, 2, ... as the first
> parameter of the update function, when "frames" is None, or the number of
> frames. If - as here - the third parameter is a generator, it passes the
> yielded data to update.
>  It may be used or not.
>
> Ok, I understand that better now. But, you say "or *the number* of
> frames" but the documentation reads "or *a number* of frames" --- what
> does this mean?
>
> And I still do not understand how to use the first argument of the
> function to be called for the animation. In another animation example (
> histogram.py), the animation function is defined by:
>
> def animate(i):
> # simulate new data coming in
> data = np.random.randn(1000
> n, bins = np.histogram(data, 100)
> top = bottom + n
> verts[1::5,1] = top
> verts[2::5,1] = top
>
> This works of course; but, why is the "i" required? There is no other
> reference to it in the entire script. If I remove it; i.e. use def
> animate(): I get the following error:
>
> TypeError: animate() takes no arguments (1 given)
>
> I do not understand how this explains the fact that the function no longer
> has any arguments. Please explain the meaning of this error message?
>
>
> Please, in such cases test your programs by adding some simple tracing
> contraptions, say, print(data) inside update.
>
> I did this and more before posting my email. I would not have posted this
> unless I thought it was necessary. And I thought one purpose of this user
> group was to help people --- even if they ask a question which may be
> annoying or "stupid" in some subscribers opinion. I try to remember what a
> very wise teacher once said --- "there is no such thing as a stupid
> question".
>
>
> --
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--

Re: [Matplotlib-users] Axes3d.mouse_init(), facing problems when embedding matplotlib 3d-projection into PyQt5 App

2015-04-21 Thread Benjamin Root
The addmpl() method isn't right. You created a canvas object, assigned it
to self.canvas, but then tried to call FigureCanvas.__init__(), passing it
whatever object "self" is. What class is addmpl() a part of? What does it
subclass?

On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros  wrote:

> Hi,
>
> I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get
> the following error:
>
> /usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009:
> UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled.  Set
> canvas then call Axes3D.mouse_init().
>   warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation
> disabled.  Set canvas then call Axes3D.mouse_init().')
>
> From Stackoverflow, which host to question about this, I know that mouse
> actions are disabled when the canvas is re-initialized by whatever.
>
> The only position I do such an operation is in here:
>
>
>
>
>
>
>
> *def addmpl(self, fig):self.canvas = FigureCanvas(fig)
> #FigureCanvas.__init__(self, fig)#Axes3D.mouse_init(self)
> self.mplvl.addWidget(self.canvas)self.canvas.draw()
> self.toolbar = NavigationToolbar(self.canvas, self.mplwindow,
> coordinates=True)self.mplvl.addWidget(self.toolbar)*
>
> On of the Stackoverflow suggestion says, that re initializing FigureCanvas
> should do the trick but I'll get:
>
> Traceback (most recent call last):
>   File "./ex_0.1.py", line 145, in 
> main(sys.argv)
>   File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
>   File "./ex_0.1.py", line 116, in addmpl
> FigureCanvas.__init__(self, fig)
>   File
> "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py",
> line 181, in __init__
> FigureCanvasQT.__init__(self, figure)
>   File
> "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py",
> line 237, in __init__
> super(FigureCanvasQT, self).__init__(figure=figure)
> TypeError: super(type, obj): obj must be an instance or subtype of type
>
> as follow-up error message.
>
> just using *Axes3D.mouse_init()* , as suggested by matplotlib itself,
> leads to:
>
> Traceback (most recent call last):
>   File "./ex_0.1.py", line 146, in 
> main(sys.argv)
>   File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
>   File "./ex_0.1.py", line 118, in addmpl
> Axes3D.mouse_init()
> TypeError: mouse_init() missing 1 required positional argument: 'self'
>
> adding self leads to:
>
> Traceback (most recent call last):
>   File "./ex_0.1.py", line 146, in 
> main(sys.argv)
>   File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
>   File "./ex_0.1.py", line 118, in addmpl
> Axes3D.mouse_init(self)
>   File
> "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py",
> line 1002, in mouse_init
> canv = self.figure.canvas
> AttributeError: 'Main' object has no attribute 'figure'
> ./ex_0.1.py &
>
> Maybe I'm adding those lines at the wrong place, but I could fined
> anything useful in the matplotlib documantation, that would help me out,
> either.
>
> Any thougts that might help?
>
> Cheers,
> Christian
>
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
> --
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Qt4 Designer Example

2015-04-16 Thread Benjamin Root
That will be up to him. The only reason why I know about the work is
because our publisher wanted to make sure that our two books didn't cover
the same material. He isn't a regular on the mailing list, so I don't know
if he even would see this message. I'll let him know that there is interest.

Ben Root

On Wed, Apr 15, 2015 at 9:16 PM, Chris O'Halloran  wrote:

> On 16 April 2015 at 09:51, Benjamin Root  wrote:
>
>> A little birdie has told me that someone else is writing a new
>> comprehensive matplotlib book (I think it would replace Sandros' book).
>> Last I heard from the birdie, he was most of the way done with the
>> manuscript. Based on my experience with the edit/review process, I would
>> guess 2-3 more months to see it finished and published.
>>
>>
> Oh cool. I'll look out for this. Will it be advertised on this list?
>
>
> --
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Some questions regarding pcolor(mesh)/nbagg/FuncAnimate

2015-04-16 Thread Benjamin Root
I just noticed your use of "animated=True". I have had trouble using that
in the past with the animation module. It is a leftover from the days
before the animation module and isn't actually used by it, IIRC. Try not
supplying that argument.

On Thu, Apr 16, 2015 at 8:18 AM, Ryan Nelson  wrote:

> Tom,
>
> Thanks for the code. As it was given, I had to change `blit=True` in the
> `FuncAnimation` call in order to get this to work in a regular Qt backend.
> It did not work with the nbagg backend; however, if I used this code it
> works fine:
> 
> %matplotlib nbagg
>
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.animation as animate
>
> class Testing(object):
> def __init__(self, ):
> self.fig = plt.figure()
> array = np.random.rand(4,5)
> array = np.zeros((4,5))
> self.pc = plt.pcolor(array, edgecolor='k', linewidth=1.)#,
> animated=True)
> self.pc.set_clim([0, 1])
> self.points = [plt.scatter(np.random.rand(), np.random.rand())]#,
> animated=True)]
>
> def update(self, iter_num):
> array = np.random.rand(4*5)
> self.pc.set_array(array)
> for point in self.points:
> point.set_offsets([np.random.rand(), np.random.rand()])
> #return (self.pc, ) + tuple(self.points)
>
>
> test = Testing()
> ani = animate.FuncAnimation(test.fig, test.update, interval=250,
> blit=False, frames=50)
> plt.show()
> 
> Also this code solves the problem I was having with several scatter points
> being displayed upon multiple runs of the same code cell.
>
> I wasn't familiar with the "animated" keyword, and it is not well
> documented yet. Can you give me a quick explanation of what it is doing?
>
> Ben: thanks for the hint about the _stop() method. I might look into that
> for my example.
>
> Thank you all for your assistance. Things are working pretty much as I
> need now!
>
> Ryan
>
> On Sun, Apr 12, 2015 at 9:24 AM, Thomas Caswell 
> wrote:
>
>> You can
>>
>>
>> ```
>>
>> #import matplotlib
>>
>> #matplotlib.use('nbagg')
>>
>> #%matplotlib nbagg
>>
>> import numpy as np
>>
>> import matplotlib.pyplot as plt
>>
>> import matplotlib.animation as animate
>>
>>
>> class Testing(object):
>>
>> def __init__(self, ):
>>
>> self.fig = plt.figure()
>>
>> array = np.random.rand(4,5)
>>
>> array = np.zeros((4,5))
>>
>> self.pc = plt.pcolor(array, edgecolor='k', linewidth=1.,
>> animated=True)
>>
>> self.pc.set_clim([0, 1])
>>
>> self.points = [plt.scatter(np.random.rand(), np.random.rand(),
>> animated=True)]
>>
>>
>> def update(self, iter_num):
>>
>> array = np.random.rand(4*5)
>>
>> self.pc.set_array(array)
>>
>> for point in self.points:
>>
>> point.set_offsets([np.random.rand(), np.random.rand()])
>>
>>
>> return (self.pc, ) + tuple(self.points)
>>
>>
>>
>> test = Testing()
>>
>> ani = animate.FuncAnimation(test.fig, test.update, interval=10,
>> blit=False, frames=50)
>>
>> plt.show()
>>
>> ```
>>
>> note the addition of the `set_clim` line in the `__init__` method.
>>
>>
>> You can also update the scatter artist in-place.  The other changes will
>> make it a bit for performant if you use bliting (which does not work with
>> nbagg currently)
>>
>> Sorry I missed that part of the question first time through.
>>
>> Tom
>>
>> On Sun, Apr 12, 2015, 08:31 Ryan Nelson  wrote:
>>
>>> Tom,
>>>
>>> Thanks for the links. It does seem like fragments of my problem are
>>> addressed in each of those comments, so I guess I'll have to wait for a bit
>>> until those things get resolved. For now, I can just tell my students to
>>> restart the IPython kernel each time they run the animation, which isn't
>>> that hard. It's too bad that there isn't a 'stop' method now, but it's good
>>> to hear that it isn't a completely terrible idea.
>>>
>>> I do still need help with Question #3 from my original email, though,
>>> because it affects both the Qt and nbagg backends, and it is a bit of a
>>> show stopper. I can't quite understand why initializing a pcolor(mesh) with
>>> random numbers makes it possible to update the array in an animation, but
>>> if you use all zeros or ones, it seems to be immutable.
>>>
>>> Ryan
>>>
>>> On Sat, Apr 11, 2015 at 8:35 PM, Thomas Caswell 
>>> wrote:
>>>
 Ryan,

 I have not looked at your exact issue yet, but there seems to be some
 underlying issues with animation and nbagg which we have not tracked down
 yet. See:

 https://github.com/matplotlib/matplotlib/pull/4290
 https://github.com/matplotlib/matplotlib/issues/4287
 https://github.com/matplotlib/matplotlib/issues/4288

 Running until a given condition is an interesting idea, but I think
 that means the animation objects needs to have a public 'stop' method 
 first!

 Tom

 On Fri, Apr 10, 2015 at 3:00 PM Ryan Nelson 
 wrote:

> Good afternoon, all!
>
> 

Re: [Matplotlib-users] Qt4 Designer Example

2015-04-15 Thread Benjamin Root
A little birdie has told me that someone else is writing a new
comprehensive matplotlib book (I think it would replace Sandros' book).
Last I heard from the birdie, he was most of the way done with the
manuscript. Based on my experience with the edit/review process, I would
guess 2-3 more months to see it finished and published.

Cheers!
Ben Root

On Wed, Apr 15, 2015 at 5:43 PM, Chris O'Halloran  wrote:

> That's cool. I just found the book provided the right level of detail for
> me to start using QtDesigner with my projects.  I can't speak for PyQt5 but
> I don't see the concepts have changed much over the past 5 or so years.
> Agreed though, if you're brand new to python and are only familiar with
> python3 then typing in the code verbatim (python2 style) may cause you
> problems that frustrate the learning process.
>
>
>
> On 15 April 2015 at 19:49, Christian Ambros  wrote:
>
>> No offense, but it really is outdated. Consider that it'll take two years
>> to do the writing and the lecture work the research material is form 2007
>> to 2008. We now are in 2015. As you can tell from other books which have
>> been published between 2013 and a really helpy book from March, 24th 2015
>> (yes, Benjamin Root wrote it), even they don't cover latest enhancements up
>> to six month before print, (which might be seen a reasonable since changing
>> is easy in a digitized world like ours).
>> A good tutorial for the once, who do not have much experience in this
>> field (I count myself in with the just one and a half year of experience in
>> gui programming) is two things, actual up to six month to a year and
>> straight forward, meaning It tells you what to do and doesn't bother you
>> with design thoughts, API explanations nor tries to teach you programming.
>> I have that book in my possession, but it didn't turn out to be helpful
>> if you do not have the time do read it in whole. If you have the time to
>> spin freely, you still will have conquered 80% by yourself and because it
>> is still outdated for pyhton3 and matplotlib 1.4.3 the use is questionable.
>>
>> cheers,
>> Christian
>>
>> --
>> "A little learning never caused anyone's head to explode!"
>>
>>
>> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>>
>>
>>
>>   On Wednesday, April 15, 2015 3:44 AM, Chris O'Halloran <
>> cmo...@gmail.com> wrote:
>>
>>
>> Can I recommend this book.  It was very helpful to me in figuring much of
>> this out.
>>
>>
>> https://www.packtpub.com/application-development/matplotlib-python-developers
>>
>> On 14 April 2015 at 18:14, Christian Ambros  wrote:
>>
>> Hi Ryan,
>>
>> wow! This tutorial is one of the best I ever encountered. Nothing is
>> missing, nothing is cryptic or unclear. What I like best is, that it get's
>> along without using Qt Designer plugins or something similar strange. It's
>> a good basis to start. Maybe you should write a book, covering all the
>> untold things one needs to solve problems like that. I browsed through
>> plenty of books the last weeks and what really is missing, is a cookbook
>> about Qt Designer, Glade and wxWidgets and how to fill it with python3 and
>> it's lib's like matplotlib, pyqtgraph, numpy, sympy etc.
>>
>> I would buy it right away!
>> cheers,
>> Christian
>>
>> --
>> "A little learning never caused anyone's head to explode!"
>>
>>
>> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>>
>>
>>
>>   On Friday, April 10, 2015 7:14 PM, Ryan Nelson 
>> wrote:
>>
>>
>> Christian,
>>
>> As it turns out, I wrote a blog post (for my terrible blog) about using
>> Designer to create a MPL based GUI (
>> http://blog.rcnelson.com/building-a-matplotlib-gui-with-qt-designer-part-1/).
>> I was going to write this up for the MPL docs... But it got really long (3
>> parts), so I just used my personal site. It got so long because this was
>> the second time I needed to figure this out, and I wanted to make a very
>> detailed outline for my own future reference. Unfortunately, I don't have
>> any experience with Qt5, but I imagine things are similar. I think they
>> just rearranged the locations of some of the widgets, but I'd be curious to
>> hear your experience. I gave up on PyQtdesignerplugins. I think it makes
>> more sense to just use a generic widget as the MPL container.
>>
>> I would

Re: [Matplotlib-users] Qt4 Designer Example

2015-04-15 Thread Benjamin Root
"even they don't cover latest enhancements up to six month before print"

In my defense, I was making updates at the last possible moment to cover
changes in the latest release (1.4.3), and provided vague guidance on
things to come, going so far as to replace references to a v1.5 release
with v2.1. My book does not cover all of the backends, and I didn't
explicitly cover Qt5 but only because I didn't have it installed on my
system. By the way, qt_compat *is* the layer one should be targeting for
Qt5. It makes one's application compatible with either PySide or PyQt5, and
it provides the Qt5 interface. It is qt4_compat that is deprecated.

If there is a second edition, I plan to greatly expand on the backends
covered, but that probably won't be for another year, unfortunately.

Cheers!
Ben Root


On Wed, Apr 15, 2015 at 3:49 AM, Christian Ambros  wrote:

> No offense, but it really is outdated. Consider that it'll take two years
> to do the writing and the lecture work the research material is form 2007
> to 2008. We now are in 2015. As you can tell from other books which have
> been published between 2013 and a really helpy book from March, 24th 2015
> (yes, Benjamin Root wrote it), even they don't cover latest enhancements up
> to six month before print, (which might be seen a reasonable since changing
> is easy in a digitized world like ours).
> A good tutorial for the once, who do not have much experience in this
> field (I count myself in with the just one and a half year of experience in
> gui programming) is two things, actual up to six month to a year and
> straight forward, meaning It tells you what to do and doesn't bother you
> with design thoughts, API explanations nor tries to teach you programming.
> I have that book in my possession, but it didn't turn out to be helpful if
> you do not have the time do read it in whole. If you have the time to spin
> freely, you still will have conquered 80% by yourself and because it is
> still outdated for pyhton3 and matplotlib 1.4.3 the use is questionable.
>
> cheers,
> Christian
>
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
>   On Wednesday, April 15, 2015 3:44 AM, Chris O'Halloran 
> wrote:
>
>
> Can I recommend this book.  It was very helpful to me in figuring much of
> this out.
>
>
> https://www.packtpub.com/application-development/matplotlib-python-developers
>
> On 14 April 2015 at 18:14, Christian Ambros  wrote:
>
> Hi Ryan,
>
> wow! This tutorial is one of the best I ever encountered. Nothing is
> missing, nothing is cryptic or unclear. What I like best is, that it get's
> along without using Qt Designer plugins or something similar strange. It's
> a good basis to start. Maybe you should write a book, covering all the
> untold things one needs to solve problems like that. I browsed through
> plenty of books the last weeks and what really is missing, is a cookbook
> about Qt Designer, Glade and wxWidgets and how to fill it with python3 and
> it's lib's like matplotlib, pyqtgraph, numpy, sympy etc.
>
> I would buy it right away!
> cheers,
> Christian
>
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
>   On Friday, April 10, 2015 7:14 PM, Ryan Nelson 
> wrote:
>
>
> Christian,
>
> As it turns out, I wrote a blog post (for my terrible blog) about using
> Designer to create a MPL based GUI (
> http://blog.rcnelson.com/building-a-matplotlib-gui-with-qt-designer-part-1/).
> I was going to write this up for the MPL docs... But it got really long (3
> parts), so I just used my personal site. It got so long because this was
> the second time I needed to figure this out, and I wanted to make a very
> detailed outline for my own future reference. Unfortunately, I don't have
> any experience with Qt5, but I imagine things are similar. I think they
> just rearranged the locations of some of the widgets, but I'd be curious to
> hear your experience. I gave up on PyQtdesignerplugins. I think it makes
> more sense to just use a generic widget as the MPL container.
>
> I would be very happy if you had comments for my Qt designer posts.
>
> Ryan
>
> On Wed, Apr 8, 2015 at 5:47 AM, Christian Ambros 
> wrote:
>
> Hi Ryan,
>
> could you write down, as a tutorial, how you built the example with the qt
> designer?
> In the last hours I read all most everything what can be found on the
> issue of getting matplotlib running with pyqt5 and the designer but 

Re: [Matplotlib-users] Some questions regarding pcolor(mesh)/nbagg/FuncAnimate

2015-04-13 Thread Benjamin Root
animation objects have a private _stop() method. That might have to be a
workaround.

On Sun, Apr 12, 2015 at 9:24 AM, Thomas Caswell  wrote:

> You can
>
>
> ```
>
> #import matplotlib
>
> #matplotlib.use('nbagg')
>
> #%matplotlib nbagg
>
> import numpy as np
>
> import matplotlib.pyplot as plt
>
> import matplotlib.animation as animate
>
>
> class Testing(object):
>
> def __init__(self, ):
>
> self.fig = plt.figure()
>
> array = np.random.rand(4,5)
>
> array = np.zeros((4,5))
>
> self.pc = plt.pcolor(array, edgecolor='k', linewidth=1.,
> animated=True)
>
> self.pc.set_clim([0, 1])
>
> self.points = [plt.scatter(np.random.rand(), np.random.rand(),
> animated=True)]
>
>
> def update(self, iter_num):
>
> array = np.random.rand(4*5)
>
> self.pc.set_array(array)
>
> for point in self.points:
>
> point.set_offsets([np.random.rand(), np.random.rand()])
>
>
> return (self.pc, ) + tuple(self.points)
>
>
>
> test = Testing()
>
> ani = animate.FuncAnimation(test.fig, test.update, interval=10,
> blit=False, frames=50)
>
> plt.show()
>
> ```
>
> note the addition of the `set_clim` line in the `__init__` method.
>
>
> You can also update the scatter artist in-place.  The other changes will
> make it a bit for performant if you use bliting (which does not work with
> nbagg currently)
>
> Sorry I missed that part of the question first time through.
>
> Tom
>
> On Sun, Apr 12, 2015, 08:31 Ryan Nelson  wrote:
>
>> Tom,
>>
>> Thanks for the links. It does seem like fragments of my problem are
>> addressed in each of those comments, so I guess I'll have to wait for a bit
>> until those things get resolved. For now, I can just tell my students to
>> restart the IPython kernel each time they run the animation, which isn't
>> that hard. It's too bad that there isn't a 'stop' method now, but it's good
>> to hear that it isn't a completely terrible idea.
>>
>> I do still need help with Question #3 from my original email, though,
>> because it affects both the Qt and nbagg backends, and it is a bit of a
>> show stopper. I can't quite understand why initializing a pcolor(mesh) with
>> random numbers makes it possible to update the array in an animation, but
>> if you use all zeros or ones, it seems to be immutable.
>>
>> Ryan
>>
>> On Sat, Apr 11, 2015 at 8:35 PM, Thomas Caswell 
>> wrote:
>>
>>> Ryan,
>>>
>>> I have not looked at your exact issue yet, but there seems to be some
>>> underlying issues with animation and nbagg which we have not tracked down
>>> yet. See:
>>>
>>> https://github.com/matplotlib/matplotlib/pull/4290
>>> https://github.com/matplotlib/matplotlib/issues/4287
>>> https://github.com/matplotlib/matplotlib/issues/4288
>>>
>>> Running until a given condition is an interesting idea, but I think that
>>> means the animation objects needs to have a public 'stop' method first!
>>>
>>> Tom
>>>
>>> On Fri, Apr 10, 2015 at 3:00 PM Ryan Nelson 
>>> wrote:
>>>
 Good afternoon, all!

 I'm really digging the nbagg backend, and I'm trying to use it to make
 an animation. As the subject suggests, though, I'm having some issues with
 these features. I'm using Python 3.4, Matplotlib 1.4.3, and IPython 3.1.
 Below is a small code sample that emulates my system. The pcolor call can
 be substituted for pcolormesh, and I see the same behavior. (Sorry this is
 a bit long. I tried to break it up as best as possible.)

 #
 #import matplotlib
 #matplotlib.use('nbagg')
 #%matplotlib nbagg
 import numpy as np
 import matplotlib.pyplot as plt
 import matplotlib.animation as animate

 class Testing(object):
 def __init__(self, ):
 self.fig = plt.figure()
 array = np.random.rand(4,5)
 #array = np.zeros((4,5))
 self.pc = plt.pcolor(array, edgecolor='k', linewidth=1.)
 self.points = [plt.scatter(np.random.rand(), np.random.rand())]

 def update(self, iter_num):
 array = np.random.rand(4*5)
 self.pc.set_array(array)
 for point in self.points:
 point.remove()
 self.points = [plt.scatter(np.random.rand(), np.random.rand())]

 test = Testing()
 animate.FuncAnimation(test.fig, test.update, interval=1000, blit=False)
 plt.show()
 ###

 1. As is, this code runs fine with a Qt backend. It also runs fine as a
 first call in a notebook if the `show` call is commented out and the
 `%matplotlib` line is uncommented. However, if the `show` call is left in
 and the `matplotlib.use` call is uncommented, then the pcolor array
 changes, but the scatterpoint only shows on the first update and then
 disappears forever. What is the difference between these two invocations?

 2. With the `%matplotlib` magic uncommented and `show` removed, the
 first invocation of this 

Re: [Matplotlib-users] Color Bar Limits

2015-04-02 Thread Benjamin Root
::Looks again::

Ok, I see what you did here:

cmap = plt.get_cmap('rainbow_r’)
start=0.2
stop = 1.
colors = cmap(np.linspace(start, stop, cmap.N))
# Create a new colormap from those colors
color_map = LinearSegmentedColormap.from_list('Upper Half', colors)

I missed this part the first time through, noticing only the change to the
vmin. Yeah, I think that would work just fine. Sorry for the confusion.

Cheers!
Ben Root


On Thu, Apr 2, 2015 at 12:56 PM, Jody Klymak  wrote:

>
>
> On 2 Apr 2015, at  9:50 AM, Benjamin Root  wrote:
>
> No, that's not what he is asking for. John wants the norm to go from -1 to
> 4, but he wants the colorbar to display only the 0 to 4 portion. Your
> approach (setting vmin=0) would change the normalization and change the
> colors.
>
>
> Hmm, well his values go from 0 to 4, and he wants his colorbar to go from
> 0 to 4, but just over the last 4/5ths of the colormap.  I think I gave him
> what he wants.  But I guess he can decide!
>
> Cheers,   Jody
>
> The axes limits do not appear to be scaled by the values. They are set to
> (0, 1). So, the kludgy way would seem to be to set the xlimits to be (0.2,
> 1) (taking out a fifth of the colorbar, but the frame is still there...
>
> Ben Root
>
> On Thu, Apr 2, 2015 at 12:32 PM, Jody Klymak  wrote:
>
>> Hi John,
>>
>> I got this off stack exchange, apologies to the original contributor...
>>
>> Cheers,   Jody
>>
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>> from matplotlib.colors import LinearSegmentedColormap
>>
>> x = np.arange(100)
>> y = np.random.rand(100)
>> z = 4 * np.random.rand(100)
>>
>> cmap = plt.get_cmap('rainbow_r’)
>> start=0.2
>> stop = 1.
>> colors = cmap(np.linspace(start, stop, cmap.N))
>> # Create a new colormap from those colors
>> color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
>>
>> fig = plt.figure(figsize=(12,9))
>> ax1 = plt.subplot(111)
>> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4)
>>
>> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
>> cb = fig.colorbar(sc, cax=position, orientation='horizontal',
>> drawedges=False)
>> cb.set_label('Z-Colors', fontsize=14)
>>
>> # I tried this after talking with Ben Root, but it
>> # results in some odd behavior
>> # cb.ax.set_xlim(0,4)
>>
>> plt.show()
>>
>>
>>
>> On 2 Apr 2015, at  5:47 AM, John Leeman  wrote:
>>
>> Hi all,
>>
>> I’m plotting some scatter points colored by a third variable, but want to
>> use a limited subset of a colormap. In the example below, the color axis
>> data ranges from 0-4, but I want to not use the red portion of the bar.
>> Doing the first part is just accomplished by setting the vmin/vmax. But
>> when I plot a color bar I don’t want to show the colors and values for
>> anything below zero. Other than just white-boxing that part of the bar I’m
>> not sure how to do it. I tried a suggestion of setting the limit properties
>> of the bar axis attribute, but that results in the bar getting shrunk and
>> shifted (a very weird behavior). Any ideas?
>>
>> Thank you,
>>
>> John Leeman
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> x = np.arange(100)
>> y = np.random.rand(100)
>> z = 4 * np.random.rand(100)
>>
>> color_map = plt.get_cmap('rainbow_r')
>>
>> fig = plt.figure(figsize=(12,9))
>> ax1 = plt.subplot(111)
>> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4)
>>
>> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
>> cb = fig.colorbar(sc, cax=position, orientation='horizontal',
>> drawedges=False)
>> cb.set_label('Z-Colors’, fontsize=14)
>>
>> # I tried this after talking with Ben Root, but it
>> # results in some odd behavior
>> # cb.ax.set_xlim(0,4)
>>
>> plt.show()
>> 
>>
>> --
>> 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@li

Re: [Matplotlib-users] Color Bar Limits

2015-04-02 Thread Benjamin Root
No, that's not what he is asking for. John wants the norm to go from -1 to
4, but he wants the colorbar to display only the 0 to 4 portion. Your
approach (setting vmin=0) would change the normalization and change the
colors.

The axes limits do not appear to be scaled by the values. They are set to
(0, 1). So, the kludgy way would seem to be to set the xlimits to be (0.2,
1) (taking out a fifth of the colorbar, but the frame is still there...

Ben Root

On Thu, Apr 2, 2015 at 12:32 PM, Jody Klymak  wrote:

> Hi John,
>
> I got this off stack exchange, apologies to the original contributor...
>
> Cheers,   Jody
>
>
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.colors import LinearSegmentedColormap
>
> x = np.arange(100)
> y = np.random.rand(100)
> z = 4 * np.random.rand(100)
>
> cmap = plt.get_cmap('rainbow_r’)
> start=0.2
> stop = 1.
> colors = cmap(np.linspace(start, stop, cmap.N))
> # Create a new colormap from those colors
> color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
>
> fig = plt.figure(figsize=(12,9))
> ax1 = plt.subplot(111)
> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4)
>
> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
> cb = fig.colorbar(sc, cax=position, orientation='horizontal',
> drawedges=False)
> cb.set_label('Z-Colors', fontsize=14)
>
> # I tried this after talking with Ben Root, but it
> # results in some odd behavior
> # cb.ax.set_xlim(0,4)
>
> plt.show()
>
>
>
> On 2 Apr 2015, at  5:47 AM, John Leeman  wrote:
>
> Hi all,
>
> I’m plotting some scatter points colored by a third variable, but want to
> use a limited subset of a colormap. In the example below, the color axis
> data ranges from 0-4, but I want to not use the red portion of the bar.
> Doing the first part is just accomplished by setting the vmin/vmax. But
> when I plot a color bar I don’t want to show the colors and values for
> anything below zero. Other than just white-boxing that part of the bar I’m
> not sure how to do it. I tried a suggestion of setting the limit properties
> of the bar axis attribute, but that results in the bar getting shrunk and
> shifted (a very weird behavior). Any ideas?
>
> Thank you,
>
> John Leeman
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> x = np.arange(100)
> y = np.random.rand(100)
> z = 4 * np.random.rand(100)
>
> color_map = plt.get_cmap('rainbow_r')
>
> fig = plt.figure(figsize=(12,9))
> ax1 = plt.subplot(111)
> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4)
>
> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
> cb = fig.colorbar(sc, cax=position, orientation='horizontal',
> drawedges=False)
> cb.set_label('Z-Colors’, fontsize=14)
>
> # I tried this after talking with Ben Root, but it
> # results in some odd behavior
> # cb.ax.set_xlim(0,4)
>
> plt.show()
> 
>
> --
> 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
>
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>
>
>
> --
> 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
>
>
--
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] [matplotlib-devel] 1.4.3 does not build on Ubuntu 14 with python3

2015-04-01 Thread Benjamin Root
Didn't we fix that in trunk recently?

On Wed, Apr 1, 2015 at 12:51 PM, Jens Nielsen 
wrote:

> Looking more closely at this I think it is a bug on our side. When
> freetype is not found it returns version as 'Failed to identify version.' 
> which
> it tries to compare to a version number. The version number is correctly
> converted from string to numbers using loosversion but this string just
> makes it through. The workaround at the moment is to install the freetype
> dev as Tom said.
>
>
> Jens
>
> ons. 1. apr. 2015 kl. 17.45 skrev Christian Ambros :
>
>> Hi,
>>
>> as you can see: 14.3.1 which is the latest, because before I started
>> upgrading, I read about possible issues here and upgraded the setuptools as
>> conclusion.
>>
>> Python 3.4.0 (default, Apr 11 2014, 13:05:11)
>> [GCC 4.8.2] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import setuptools
>> >>> print(setuptools.__version__)
>> 14.3.1
>> >>> exit()
>>
>> cheers,
>> Christian
>> --
>> "A little learning never caused anyone's head to explode!"
>>
>>
>> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>>
>>
>>
>>   On Wednesday, April 1, 2015 1:25 PM, Jens Nielsen <
>> jenshniel...@gmail.com> wrote:
>>
>>
>> I think we have seen this issue before and it seems to be caused by an
>> out of date version of setuptools. I tried reproducing it on fresh ubuntu
>> 14.04 machine but was not able to reproduce the issue. Do you know which
>> version of setuptools you are using?
>>
>> Jens
>>
>> ons. 1. apr. 2015 kl. 14.19 skrev Thomas Caswell :
>>
>> Make sure you have `freetype-dev` installed at the system level.
>>
>> Tom
>>
>> On Wed, Apr 1, 2015 at 8:02 AM Christian Ambros 
>> wrote:
>>
>> Hi,
>>
>> I'm facing the same trouble with installing matplotlib 1.4.3 and
>> 1.5.dev1. running
>>
>> python3 setup.py build
>>
>> in the unarchived directory gives this:
>>
>> 
>> Edit setup.cfg to change the build options
>>
>> BUILDING MATPLOTLIB
>> matplotlib: yes [1.5.dev1]
>> python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)  [GCC
>> 4.8.2]]
>>   platform: yes [linux]
>>
>> REQUIRED DEPENDENCIES AND EXTENSIONS
>>  numpy: yes [version 1.9.2]
>>six: yes [using six version 1.5.2]
>>   dateutil: yes [using dateutil version 2.0]
>>   pytz: yes [using pytz version 2012c]
>>tornado: yes [using tornado version 3.1.1]
>>  pyparsing: yes [using pyparsing version 2.0.1]
>> libagg: yes [Requires patches that have not been merged
>> upstream. Using local copy.]
>> Traceback (most recent call last):
>>   File "setup.py", line 153, in 
>> result = package.check()
>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 900,
>> in check
>> min_version='2.3', version=version)
>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 446,
>> in _check_for_pkg_config
>> if (not is_min_version(version, min_version)):
>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 173,
>> in is_min_version
>> return found_version >= expected_version
>>   File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
>> c = self._cmp(other)
>>   File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
>> if self.version < other.version:
>> TypeError: unorderable types: str() < int()
>>
>> I'm running Linux Mint 17 "Quina" which is based on Ubuntu's trusty
>> packges.
>>
>> pip3 is up to date. Running
>> print(setuptools.__file__)
>>
>> gives: /usr/local/lib/python3.4/dist-packages/setuptools/__init__.py
>> which is as expected.
>>
>> Using pip3 install matplotlib --upgrade #even to 1.4.3
>> get's me this:
>>
>>
>> Collecting matplotlib from
>> https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.3.tar.gz#md5=86af2e3e3c61849ac7576a6f5ca44267
>>   Downloading matplotlib-1.4.3.tar.gz (50.4MB)
>> 100% || 50.4MB 8.0kB/s
>> Traceback (most recent call last):
>>   File "", line 20, in 
>>   File "/tmp/pip-build-sezmzam8/matplotlib/setup.py", line 155, in
>> 
>> result = package.check()
>>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 961, in
>> check
>> min_version='2.3', version=version)
>>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 445, in
>> _check_for_pkg_config
>> if (not is_min_version(version, min_version)):
>>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 173, in
>> is_min_version
>> return found_version >= expected_version
>>   File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
>> c = self._cmp(other)
>>   File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
>>

Re: [Matplotlib-users] [matplotlib-devel] 1.4.3 does not build on Ubuntu 14 with python3

2015-04-01 Thread Benjamin Root
Yeah, that mirrors what others have stated. The common thread seems to be
that all of these users were comfortable with doing "sudo pip install
" (myself included). I was in a rush when I originally encountered
issues back in the summer on my 12.04 machine, so I just switched to
miniconda and didn't figure out what was wrong on my system.



On Wed, Apr 1, 2015 at 12:27 PM, Christian Ambros  wrote:

> Hi,
>
> as you can see: 14.3.1 which is the latest, because before I started
> upgrading, I read about possible issues here and upgraded the setuptools as
> conclusion.
>
> Python 3.4.0 (default, Apr 11 2014, 13:05:11)
> [GCC 4.8.2] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import setuptools
> >>> print(setuptools.__version__)
> 14.3.1
> >>> exit()
>
> cheers,
> Christian
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
>   On Wednesday, April 1, 2015 1:25 PM, Jens Nielsen <
> jenshniel...@gmail.com> wrote:
>
>
> I think we have seen this issue before and it seems to be caused by an out
> of date version of setuptools. I tried reproducing it on fresh ubuntu 14.04
> machine but was not able to reproduce the issue. Do you know which version
> of setuptools you are using?
>
> Jens
>
> ons. 1. apr. 2015 kl. 14.19 skrev Thomas Caswell :
>
> Make sure you have `freetype-dev` installed at the system level.
>
> Tom
>
> On Wed, Apr 1, 2015 at 8:02 AM Christian Ambros  wrote:
>
> Hi,
>
> I'm facing the same trouble with installing matplotlib 1.4.3 and 1.5.dev1.
> running
>
> python3 setup.py build
>
> in the unarchived directory gives this:
>
> 
> Edit setup.cfg to change the build options
>
> BUILDING MATPLOTLIB
> matplotlib: yes [1.5.dev1]
> python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)  [GCC
> 4.8.2]]
>   platform: yes [linux]
>
> REQUIRED DEPENDENCIES AND EXTENSIONS
>  numpy: yes [version 1.9.2]
>six: yes [using six version 1.5.2]
>   dateutil: yes [using dateutil version 2.0]
>   pytz: yes [using pytz version 2012c]
>tornado: yes [using tornado version 3.1.1]
>  pyparsing: yes [using pyparsing version 2.0.1]
> libagg: yes [Requires patches that have not been merged
> upstream. Using local copy.]
> Traceback (most recent call last):
>   File "setup.py", line 153, in 
> result = package.check()
>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 900,
> in check
> min_version='2.3', version=version)
>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 446,
> in _check_for_pkg_config
> if (not is_min_version(version, min_version)):
>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 173,
> in is_min_version
> return found_version >= expected_version
>   File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
> c = self._cmp(other)
>   File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
> if self.version < other.version:
> TypeError: unorderable types: str() < int()
>
> I'm running Linux Mint 17 "Quina" which is based on Ubuntu's trusty
> packges.
>
> pip3 is up to date. Running
> print(setuptools.__file__)
>
> gives: /usr/local/lib/python3.4/dist-packages/setuptools/__init__.py which
> is as expected.
>
> Using pip3 install matplotlib --upgrade #even to 1.4.3
> get's me this:
>
>
> Collecting matplotlib from
> https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.3.tar.gz#md5=86af2e3e3c61849ac7576a6f5ca44267
>   Downloading matplotlib-1.4.3.tar.gz (50.4MB)
> 100% || 50.4MB 8.0kB/s
> Traceback (most recent call last):
>   File "", line 20, in 
>   File "/tmp/pip-build-sezmzam8/matplotlib/setup.py", line 155, in
> 
> result = package.check()
>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 961, in
> check
> min_version='2.3', version=version)
>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 445, in
> _check_for_pkg_config
> if (not is_min_version(version, min_version)):
>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 173, in
> is_min_version
> return found_version >= expected_version
>   File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
> c = self._cmp(other)
>   File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
> if self.version < other.version:
> TypeError: unorderable types: str() < int()
>
> 
> Edit setup.cfg to change the build options
> BUILDING MATPLOTLIB
> matplotlib: yes [1.4.3]

Re: [Matplotlib-users] unsuscribe

2015-04-01 Thread Benjamin Root
You would need to go this link to unsubscribe:
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
I don't think sourceforge does automated unsubscribes.

On Wed, Apr 1, 2015 at 11:44 AM, AdolfoE Aguirre 
wrote:

> unsuscribe
>
>
> --
> 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
>
>
--
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] [matplotlib-devel] 1.4.3 does not build on Ubuntu 14 with python3

2015-04-01 Thread Benjamin Root
Good point. At least put up a decent message to help users understand what
is wrong.

On Wed, Apr 1, 2015 at 9:57 AM, Thomas Caswell  wrote:

> Independent of what exactly is going wrong, the issue is that it _isn't_
> finding the right version of freetype and iirc LooseVersion is handling the
> 'not found' return code badly.  This is coming up often enough we probably
> do need to special case this check with a try/except.
>
> On Wed, Apr 1, 2015 at 9:50 AM Benjamin Root  wrote:
>
>> Actually, look at the traceback... it is using distutils' version.py.
>> That's weird. Is that a result of setuptools monkey-patching?
>>
>> On Wed, Apr 1, 2015 at 9:25 AM, Jens Nielsen 
>> wrote:
>>
>>> I think we have seen this issue before and it seems to be caused by an
>>> out of date version of setuptools. I tried reproducing it on fresh ubuntu
>>> 14.04 machine but was not able to reproduce the issue. Do you know which
>>> version of setuptools you are using?
>>>
>>> Jens
>>>
>>> ons. 1. apr. 2015 kl. 14.19 skrev Thomas Caswell :
>>>
>>>> Make sure you have `freetype-dev` installed at the system level.
>>>>
>>>> Tom
>>>>
>>>> On Wed, Apr 1, 2015 at 8:02 AM Christian Ambros 
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm facing the same trouble with installing matplotlib 1.4.3 and
>>>>> 1.5.dev1. running
>>>>>
>>>>> python3 setup.py build
>>>>>
>>>>> in the unarchived directory gives this:
>>>>>
>>>>> 
>>>>> Edit setup.cfg to change the build options
>>>>>
>>>>> BUILDING MATPLOTLIB
>>>>> matplotlib: yes [1.5.dev1]
>>>>> python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)
>>>>> [GCC
>>>>> 4.8.2]]
>>>>>   platform: yes [linux]
>>>>>
>>>>> REQUIRED DEPENDENCIES AND EXTENSIONS
>>>>>  numpy: yes [version 1.9.2]
>>>>>six: yes [using six version 1.5.2]
>>>>>   dateutil: yes [using dateutil version 2.0]
>>>>>   pytz: yes [using pytz version 2012c]
>>>>>tornado: yes [using tornado version 3.1.1]
>>>>>  pyparsing: yes [using pyparsing version 2.0.1]
>>>>> libagg: yes [Requires patches that have not been merged
>>>>> upstream. Using local copy.]
>>>>> Traceback (most recent call last):
>>>>>   File "setup.py", line 153, in 
>>>>> result = package.check()
>>>>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line
>>>>> 900, in check
>>>>> min_version='2.3', version=version)
>>>>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line
>>>>> 446, in _check_for_pkg_config
>>>>> if (not is_min_version(version, min_version)):
>>>>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line
>>>>> 173, in is_min_version
>>>>> return found_version >= expected_version
>>>>>   File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
>>>>> c = self._cmp(other)
>>>>>   File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
>>>>> if self.version < other.version:
>>>>> TypeError: unorderable types: str() < int()
>>>>>
>>>>> I'm running Linux Mint 17 "Quina" which is based on Ubuntu's trusty
>>>>> packges.
>>>>>
>>>>> pip3 is up to date. Running
>>>>> print(setuptools.__file__)
>>>>>
>>>>> gives: /usr/local/lib/python3.4/dist-packages/setuptools/__init__.py
>>>>> which is as expected.
>>>>>
>>>>> Using pip3 install matplotlib --upgrade #even to 1.4.3
>>>>> get's me this:
>>>>>
>>>>>
>>>>> Collecting matplotlib from
>>>>> https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.3.tar.gz#md5=86af2e3e3c61849ac75

Re: [Matplotlib-users] [matplotlib-devel] 1.4.3 does not build on Ubuntu 14 with python3

2015-04-01 Thread Benjamin Root
Actually, look at the traceback... it is using distutils' version.py.
That's weird. Is that a result of setuptools monkey-patching?

On Wed, Apr 1, 2015 at 9:25 AM, Jens Nielsen  wrote:

> I think we have seen this issue before and it seems to be caused by an out
> of date version of setuptools. I tried reproducing it on fresh ubuntu 14.04
> machine but was not able to reproduce the issue. Do you know which version
> of setuptools you are using?
>
> Jens
>
> ons. 1. apr. 2015 kl. 14.19 skrev Thomas Caswell :
>
>> Make sure you have `freetype-dev` installed at the system level.
>>
>> Tom
>>
>> On Wed, Apr 1, 2015 at 8:02 AM Christian Ambros 
>> wrote:
>>
>>> Hi,
>>>
>>> I'm facing the same trouble with installing matplotlib 1.4.3 and
>>> 1.5.dev1. running
>>>
>>> python3 setup.py build
>>>
>>> in the unarchived directory gives this:
>>>
>>> 
>>> Edit setup.cfg to change the build options
>>>
>>> BUILDING MATPLOTLIB
>>> matplotlib: yes [1.5.dev1]
>>> python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)  [GCC
>>> 4.8.2]]
>>>   platform: yes [linux]
>>>
>>> REQUIRED DEPENDENCIES AND EXTENSIONS
>>>  numpy: yes [version 1.9.2]
>>>six: yes [using six version 1.5.2]
>>>   dateutil: yes [using dateutil version 2.0]
>>>   pytz: yes [using pytz version 2012c]
>>>tornado: yes [using tornado version 3.1.1]
>>>  pyparsing: yes [using pyparsing version 2.0.1]
>>> libagg: yes [Requires patches that have not been merged
>>> upstream. Using local copy.]
>>> Traceback (most recent call last):
>>>   File "setup.py", line 153, in 
>>> result = package.check()
>>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line
>>> 900, in check
>>> min_version='2.3', version=version)
>>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line
>>> 446, in _check_for_pkg_config
>>> if (not is_min_version(version, min_version)):
>>>   File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line
>>> 173, in is_min_version
>>> return found_version >= expected_version
>>>   File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
>>> c = self._cmp(other)
>>>   File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
>>> if self.version < other.version:
>>> TypeError: unorderable types: str() < int()
>>>
>>> I'm running Linux Mint 17 "Quina" which is based on Ubuntu's trusty
>>> packges.
>>>
>>> pip3 is up to date. Running
>>> print(setuptools.__file__)
>>>
>>> gives: /usr/local/lib/python3.4/dist-packages/setuptools/__init__.py
>>> which is as expected.
>>>
>>> Using pip3 install matplotlib --upgrade #even to 1.4.3
>>> get's me this:
>>>
>>>
>>> Collecting matplotlib from
>>> https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.3.tar.gz#md5=86af2e3e3c61849ac7576a6f5ca44267
>>>   Downloading matplotlib-1.4.3.tar.gz (50.4MB)
>>> 100% || 50.4MB 8.0kB/s
>>> Traceback (most recent call last):
>>>   File "", line 20, in 
>>>   File "/tmp/pip-build-sezmzam8/matplotlib/setup.py", line 155, in
>>> 
>>> result = package.check()
>>>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 961,
>>> in check
>>> min_version='2.3', version=version)
>>>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 445,
>>> in _check_for_pkg_config
>>> if (not is_min_version(version, min_version)):
>>>   File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 173,
>>> in is_min_version
>>> return found_version >= expected_version
>>>   File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
>>> c = self._cmp(other)
>>>   File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
>>> if self.version < other.version:
>>> TypeError: unorderable types: str() < int()
>>>
>>> 
>>> Edit setup.cfg to change the build options
>>> BUILDING MATPLOTLIB
>>> matplotlib: yes [1.4.3]
>>> python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)
>>> [GCC
>>> 4.8.2]]
>>>   platform: yes [linux]
>>> REQUIRED DEPENDENCIES AND EXTENSIONS
>>>  numpy: yes [version 1.9.2]
>>>six: yes [using six version 1.5.2]
>>>   dateutil: yes [using dateutil version 2.0]
>>>   pytz: yes [using pytz version 2012c]
>>>tornado: yes [using tornado version 3.1.1]
>>>  pyparsing: yes [using pyparsing version 2.0.1]
>>>  pycxx: yes [Official versions of PyCXX are not
>>> compatible
>>>  

[Matplotlib-users] Interactive Applications using Matplotlib

2015-03-31 Thread Benjamin Root
The book I have been working on has now been published! It is about how to
use most of the interactive features that comes with matplotlib in order to
create your own GUI applications. The concepts are taught by building up a
single application piece-by-piece, feature-by-feature. The final chapter
then shows how to bring in tools from other GUIs, and also how to embed
your figure into an existing GUI application (demonstrated for gtk,
tkinter, wx and qt4).

I really hope that the book is useful to the community, and that it is as
enjoyable to read as it was for me to write!

Cheers!
Ben Root

Order it on Amazon
http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843/

Or directly from Packt
https://www.packtpub.com/application-development/interactive-applications-using-matplotlib
--
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] Best way to display image from URL in Python3

2015-03-20 Thread Benjamin Root
According to the PR you reference, the fix for this was merged back in Jan
2013, so that means that this fix is in version 1.2.x and up. Are you
saying that you still can't do imread(urllib.request.urlopen(url))?

On Thu, Mar 19, 2015 at 8:54 PM, Ryan Nelson  wrote:

> Hello all,
>
> I'm porting over some code that used Py2.7 urllib2.urlopen(url) to grab
> some image data from the net and load with pyplot.imread. It doesn't work
> quite right in Py3.4. I found a couple of refs:
>
> https://github.com/matplotlib/matplotlib/pull/1650
>
> http://stackoverflow.com/questions/15183170/python-crash-when-downloading-image-as-numpy-array
>
> They suggest io.BytesIO(urllib.request.urlopen(url).read()) as a
> replacement for Py3. Is this the best practice? Does anyone know a simpler
> way to do this?
>
> Ryan
>
>
> --
> 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
>
>
--
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] segmentation fault when saving images

2015-03-19 Thread Benjamin Root
well, that still doesn't explain the segfaults. NaNs shouldn't cause
matplotlib to crash upon saving. I would still be interested in a
stacktrace.

Ben

On Thu, Mar 19, 2015 at 1:27 PM, Gabriele Brambilla <
gb.gabrielebrambi...@gmail.com> wrote:

> Actually Paul Hobson was right.
>
> Now it works.
>
> Thanks
>
> Gabriele
>
> On Thu, Mar 19, 2015 at 1:19 PM, Benjamin Root  wrote:
>
>> The warnings probably have nothing to do with the issue at hand. Try
>> this. Install the package "faulthandler" and add the appropriate lines to
>> your Bdipoly.py script and run it again. That way, we can get a traceback
>> and find out where it is segfaulting from.
>>
>> http://faulthandler.readthedocs.org/en/latest/
>>
>> Ben Root
>>
>> As a side-note: faulthandler is part of the standard library as of 3.3!
>> Neat!
>>
>>
>> On Thu, Mar 19, 2015 at 1:13 PM, Gabriele Brambilla <
>> gb.gabrielebrambi...@gmail.com> wrote:
>>
>>> Hi guys,
>>>
>>> I don't understand why now, after I save an image when it is prompted
>>> out, the image is not saved and it closes automatically and on the terminal
>>> appears segmentation fault.
>>>
>>> this is what my terminal shows:
>>>
>>> [gs66-stumbras:~/Desktop] gbrambil% python Bdipole.py
>>>
>>> Bdipole.py:52: RuntimeWarning: divide by zero encountered in divide
>>>
>>>   lwb = 5/(np.log10(modB.max()/modB))
>>>
>>> Bdipole.py:55: RuntimeWarning: divide by zero encountered in divide
>>>
>>>   lwe = 5/(np.log10(modE.max()/modE))
>>>
>>> Segmentation fault
>>>
>>>
>>> Thanks
>>>
>>>
>>> Gabriele
>>>
>>>
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>>
>>
>
--
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] segmentation fault when saving images

2015-03-19 Thread Benjamin Root
The warnings probably have nothing to do with the issue at hand. Try this.
Install the package "faulthandler" and add the appropriate lines to your
Bdipoly.py script and run it again. That way, we can get a traceback and
find out where it is segfaulting from.

http://faulthandler.readthedocs.org/en/latest/

Ben Root

As a side-note: faulthandler is part of the standard library as of 3.3!
Neat!


On Thu, Mar 19, 2015 at 1:13 PM, Gabriele Brambilla <
gb.gabrielebrambi...@gmail.com> wrote:

> Hi guys,
>
> I don't understand why now, after I save an image when it is prompted out,
> the image is not saved and it closes automatically and on the terminal
> appears segmentation fault.
>
> this is what my terminal shows:
>
> [gs66-stumbras:~/Desktop] gbrambil% python Bdipole.py
>
> Bdipole.py:52: RuntimeWarning: divide by zero encountered in divide
>
>   lwb = 5/(np.log10(modB.max()/modB))
>
> Bdipole.py:55: RuntimeWarning: divide by zero encountered in divide
>
>   lwe = 5/(np.log10(modE.max()/modE))
>
> Segmentation fault
>
>
> Thanks
>
>
> Gabriele
>
>
>
>
>
> --
> 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
>
>
--
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


  1   2   3   4   5   6   7   8   9   10   >