Re: [Matplotlib-users] cbook.report_memory IOError

2013-07-16 Thread Eric Firing
On 2013/07/16 5:50 PM, K.-Michael Aye wrote:
> Hi!
>
> I have just run an old code that I believe was working before on OSX.
> I am trying this with matplotlib 1.2.1 on an OSX EPD running Python 2.7.3

It works for me with OSX  Mountain Lion and mpl 1.2.1 compiled from 
source.  I don't think this is fundamentally a problem with 
cbook.report_memory.

Eric

>
>
> In [1]: from matplotlib.pylab import *
>
> In [2]: import matplotlib.cbook as cbook
>
> In [3]: data = ones((1500,1500,3))
>
> In [4]: imshow(data)
> Out[4]: 
>
> In [5]: ax = gca()
>
> In [6]: print cbook.report_memory()
> ---
> IOError   Traceback (most recent call last)
>  in ()
> > 1 print cbook.report_memory()
>
> /Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/cbook.py
> in report_memory(i)
> 1210 elif sys.platform.startswith('darwin'):
> 1211 a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
> -> 1212stdout=PIPE).stdout.readlines()
> 1213 mem = int(a2[1].split()[0])
> 1214 elif sys.platform.startswith('win'):
>
> IOError: [Errno 4] Interrupted system call
>
> First I thought, maybe this doesn't run in IPython for a reason, but
> trying it as a script also fails:
>
> (general_dev+)[maye@lunatic ~/Dropbox/src/pymars]$ python imshow_test.py
> Traceback (most recent call last):
>File "imshow_test.py", line 7, in 
>  print cbook.report_memory()
>File
> "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/cbook.py",
> line 1212, in report_memory
>  stdout=PIPE).stdout.readlines()
> IOError: [Errno 4] Interrupted system call
>
>
> Is this cbook recipe maybe broken?
>
> Best,
> Michael
>
>
>
>
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] numpy masked array plot - isolated single unmasked value is hidden

2013-07-18 Thread Eric Firing
On 2013/07/17 11:25 PM, Gregorio Bastardo wrote:
> Thanks Mike, it's hard to spot, but still better than nothing. Anyway,
> could it be the default behaviour of plotting masked arrays (single
> pixel for an isolated element)?

Gregorio,

I don't think this would be a good idea.  It adds quite a bit of 
complexity for a special case--and inevitably, the next request from 
someone would be to have the option of using any marker for the isolated 
points.  The concept of "single pixel" gets slippery across backends and 
output devices.

A better solution would be a simple function to identify such isolated 
points, for use when needed, to plot such points however you choose, 
typically with a separate call to "plot" specifying a marker.  This way, 
the extra complexity is called explicitly when needed, not carried along 
by every call to "plot".

Eric

>
> 2013/7/17 Michael Droettboom :
>> You could use a single pixel for a marker (','), I guess.  But as you
>> say, you need at least two points for a line segment.
>>
>> Mike
>>
>> On 07/17/2013 10:45 AM, Gregorio Bastardo wrote:
>>> Hi,
>>>
>>> The following example demonstrates the problem, value 5 could not be
>>> seen w/o marker:
>>>
>>> data = np.arange(10)
>>> mask = [0,0,0,1,1,0,1,0,0,0]
>>> x = np.ma.masked_array(data, mask)
>>> plot(x)
>>> plot(x, '+')
>>>
>>> In my datasets, isolated unmasked values are rare, but placing a
>>> marker to spot them makes the whole graph cluttered. I do realize that
>>> at least 2 valid points are needed for a line segment, but still, is
>>> there any way to visualize these isolated unmasked values w/o a
>>> marker?
>>>
>>> Thanks,
>>> Gregorio


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Pdf File sizes on newer versions of matplotlib is a lot larger

2013-07-30 Thread Eric Firing
On 2013/07/29 9:17 PM, Jeffrey Spencer wrote:
> I have three different versions of matplotlib that all output different
> file sizes with matplotlib 1.1.1 providing the smallest. This is for the
> same exact script. I can post the script if that helps.
>
> MPL 1.4.x: 539.32kb, Ubuntu 12.10
> MPL 1.1.1: 172.56kb Ubuntu 12.10
> MPL 1.2.1: 475.9kb, Ubuntu 13.04
>
> Is there a reason for this or why would such different file sizes be
> produced?? Also I tried using the matplotlib.use('cairo') with no
> difference. It actually says that the cairo backend is selected but the
> outputted pdf files show the matplotlib pdf backend was used.
>

I can't reproduce this failure to produce a pdf file with cairo.  With
mpl 1.4.x,

import matplotlib
matplotlib.use('cairo')
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.savefig("test.pdf")

The result is

efiring@manini3:~$ pdfinfo test.pdf
Creator:cairo 1.10.2 (http://cairographics.org)
Producer:   cairo 1.10.2 (http://cairographics.org)
Tagged: no
Pages:  1
Encrypted:  no
Page size:  576 x 432 pts
File size:  5261 bytes
Optimized:  no
PDF version:1.5

Repeating but without specifying the cairo backend I get:

efiring@manini3:~$ pdfinfo test_default.pdf
Creator:matplotlib 1.4.x, http://matplotlib.org
Producer:   matplotlib pdf backend
CreationDate:   Mon Jul 29 21:51:22 2013
Tagged: no
Pages:  1
Encrypted:  no
Page size:  576 x 432 pts
File size:  5184 bytes
Optimized:  no
PDF version:1.4

Eric

--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Update legend when lines change color?

2013-08-01 Thread Eric Firing
On 2013/08/01 4:23 PM, Drain, Theodore R (392P) wrote:
> I have an application where the user can edit line colors and other 
> attributes after the plot is drawn.  The artists update just fine but the 
> legend doesn't change.
>
>>From what I can see in the legend code, it doesn't seem like there is any 
>>mechanism in place for doing this.  Does anyone have any ideas on the best 
>>way to implement something like this?
>
> Here is a simplified script to show the issue:
>
> import pylab as p
> p.ion()
> l = p.plot( [1,2,3], 'b', label="foo" )
> p.legend()
>
> raw_input( "press return..." )
> l[0].set_color( "green" )
> p.draw()
>
> Thanks,
> Ted


If you keep a reference to the Legend object, then you can call its 
get_lines() method to get a list of Line2D objects corresponding to the 
objects returned by plot().  You can use the set_color() method on them.
Maybe this is enough if your application is simple enough.

Eric

--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Update legend when lines change color?

2013-08-02 Thread Eric Firing
On 2013/08/02 8:55 AM, Drain, Theodore R (392P) wrote:
> Thanks - we'll look into that.  We might also see how hard it would
> be to implement an update or refresh method on the legend that could
> be called when the lines change to keep the legend in sync.  Seems
> like the legend should own that functionality since it set up the
> mapping between the lines and what it's displaying...

I agree entirely.  It would be logical for the legend to either have a 
manual refresh method, or perhaps to be coupled to its targets the way a 
colorbar is coupled to its mappable, tracking it automatically.  The 
Legend is a very complex beast, however, so I suspect this is a real 
project.

--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Failed pip install on OSX

2013-08-05 Thread Eric Firing
On 2013/08/05 10:43 AM, Matthew Brett wrote:
> If Matplotlib is only expected to work for the Quartz installs - is it
> worth trying to detect that and warn / error at install time?

Logically, XQuartz should not be needed at all; mpl on the mac does not 
require X11.  It looks like XQuartz is an accidental dependency, as a 
way to get access to a suitable libpng.

A link from the libpng web site led to this:
http://ethan.tira-thompson.com/Mac_OS_X_Ports.html
which might be a viable alternative.

Eric

--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Importing pyplot blocks input thread

2013-08-06 Thread Eric Firing
On 2013/08/06 10:08 AM, John McFarland wrote:
> I am trying to write some code that uses an input thread to check for user
> input while another thread is running some calculations (see example below).
> What I have noticed is that just including an import of pyplot (regardless
> of whether it is used by the code or not) causes the call to raw_input in
> the input thread to block the main thread.  It works fine when I don't
> import pyplot.  Importing pyplot is a consequence of other libraries that I
> need to use in the code, so I would like to find a way to make this work.
>
> I have python 2.7.3, matplotlib 1.2.0, and am currently using the GTKAgg
> backend.  Any help is much appreciated.
>
> Here is the example code:
>
> import time
> import threading

Before the *first* import of pyplot, you need to have:

import matplotlib
matplotlib.use("agg")

or specify any other non-interactive backend.  Alternatively, you can 
specify the backend in a matplotlibrc file.

This assumes you don't actually need an interactive backend.  If you do 
need it, then I suspect you will need to change the strategy you are 
using in your program, ideally eliminating the input thread.  You might 
use a gtk idle event callback to handle the user input, for example. 
The problem here is that python threads and gui toolkits tend not to mix 
well.

I suspect that raw_input is using the PyOS_InputHook, which is also 
being used by gtk, so you are violating the prohibition against 
gui-related activities being in more than one thread.

Eric

> import matplotlib.pyplot  # Works fine if this is commented out
>
> def input_thread():
>  raw_input('Press a key:')
>  print "Input data received"
>
> thread = threading.Thread(target=input_thread)
> thread.start()
> time.sleep(.01)
> print
>
> # Main thread (e.g. a calculation that can take some time)
> for i in xrange(10):
>  print i
>  time.sleep(.5)
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Importing-pyplot-blocks-input-thread-tp41731.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] ion() is not working

2013-08-08 Thread Eric Firing
On 2013/08/08 12:33 AM, bruno.pace wrote:
> Hey all!
>
> I have been using interactive mode inside classes for a long time, but now
> I'm just trying to use it in a Shell (idle or even in terminal) and it's not
> working.
>
> I try even simple stuff like:
>
> import matplotlib.pyplot as plt
>
> plt.ion()
> plt.plot([1.6,2.7])
> plt.draw()
>
>
> I have found in a topic that using plt.pause(0.001) would work, and indeed
> it shows the graph. But after
>   a few seconds the window gets unresponsive. Note that when I turn off the
> interactive mode everything works normally as well...
>
> In my application, I am plotting a graph (with networkX) and I have to
> refresh it once in a while. When I use the interactive mode inside of a
> class, everything works fine. But now I'm using a module with no class
> inside (or even in the shell) and it refuses to plot!
>
> Any ideas?

The problem here is one of expectations.  See 
http://matplotlib.org/users/shell.html

Eric

>
> Thanks a lot!
>
> Bruno
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/ion-is-not-working-tp41755.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] how to create 2 plots?

2013-08-12 Thread Eric Firing
On 2013/08/12 8:35 PM, vwf wrote:
> Thank you for you reply. I tried to create one after the other but when
> I did this my second plot was on top of the first one. The old plot
> needs to be "flushed" before starting the second one.
>
> This doesn't work:
> import matplotlib.pyplot as plt
> a=plt.plot([1, 2], [1, 2])
> plt.savefig('1.png', dpi=100)

plt.close()


> b=plt.plot([1, 2], [2,1])
> plt.savefig('2.png', dpi=100)
>
> In 2.png, a and b are on top of each other
>


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


Re: [Matplotlib-users] Explicitly clearing Matplotlib/Pylab figure buffers

2013-08-23 Thread Eric Firing
On 2013/08/23 3:55 AM, Kari Aliranta wrote:
> Hello, fellow Matplotlib users,
>
>
> I'm embedding some Matplotlib figures into GUI (PyQt4) windows or widget
> canvases using qt4agg as the backend. I'm having problems with these
> figures popping up any time when some other part of the program calls
> pyplot.show().

Generally, when embedding, one simply does not use the pyplot interface 
at all, so this sort of problem does not arise.  Is there any reason why 
you can't use this approach?
>
> How do you avoid this showing of previous figures? Is there some hidden
> buffer where the figures go? If there is, what is the way to clear this
> buffer, or preferably avoid putting figures in this buffer altogether?
> I'd be happy to handle these figures as simple individual objects.

To remove a figure created by pyplot, use pyplot.close(fig); but still, 
trying to use the pyplot interface for anything more complicated than 
direct interactive use and simple non-interactive scripts is likely to 
cause more problems than it solves. It's just not what pyplot is 
designed for.

Eric
>
> (I'm aware that this "hidden buffer" may be the pylab/pyplot buffer. I
> tried deepcopying the figure and then clearing the pylab buffer with
> pylab.clf() , but figures don't seem to be deepcopyable.)
>
>
> A  typical situation is the following:
>
> - There is a window with a widget. The widget (widgetMpl in the code
> below) has a slightly customized FigureCanvas in it. The drawing code is
> activated by clicking a button in the window. The code goes as follows.
>
>   # The plot method returns a complicated instance of Figure with
> several axes, constructed with Pylab.
>   previewFigure =
> self.parent.experiment.file_to_plot.plot(show=False, n_channels=10)
>
>   self.ui.widgetMpl.canvas.figure = previewFigure
>   self.ui.widgetMpl.canvas.draw()
>
>
> - I draw the figure in the window once, or several times with different
> file_to_plot, by pressing the button. I may or may not close the window
> with the aforementioned widget.
>
> - Elsewhere in the program there is another window with very simple
> drawing code using pyplot. When this code calls pyplot.show(), all the
> figures drawn in the first window will show up.
>
>
>
>
> --
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Broken clabel manual=True in 1.3.0

2013-09-29 Thread Eric Firing
On 2013/09/28 11:15 AM, Felix Patzelt wrote:
> Dear all,
>
> manually placing labels when using clabel seems to be broken in Matplotlib 
> 1.3.0.
>
> I'm on OS X 10.8.5 and have Matplotlib installed via macports. Today I 
> updated all installed ports and thereby got the new version of Matplotlib. 
> Now manually placing cline labels creates weird artefacts. I attached a demo 
> script at the bottom and uploaded a screenshot at 
> http://i.imgur.com/u6BLcRB.png . As you can see there is also a depreciation 
> warning. Now I downgraded to Matoplotlib 1.2.1 again (keeping all other 
> updates in place) and the problem is gone. I currently have very little time 
> for bug hunting and therefore will just stay away from updates for a while. 
> Maybe someone can figure out what's going wrong.
>
> Best,
> Felix
>

Felix,

Thanks for the report.  I have turned it into a Github issue: 
https://github.com/matplotlib/matplotlib/issues/2475.

Eric


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] datestr2num of year and month fails for February on September 30

2013-09-30 Thread Eric Firing
On 2013/09/30 3:45 AM, Mark Bakker wrote:
> The design of the function datestr2num, unfortunately, has an undesired
> side-effect.
> Today (September 30) I cannot convert monthly data, as February doesn't
> have 30 days.
> Conversion of:
> datestr2num('2000-02')
> Gives an error:
> ValueError: day is out of range for month
>
> Should I file a bug report or a feature request?

I would classify it as a bug resulting from a bad default in dateutil.

Eric

>
> Thanks,
>
> Mark
>
>
>
> On Thu, Sep 19, 2013 at 11:38 PM, Goyo  > wrote:
>
> 2013/9/19 Mark Bakker  >:
>  > Hello List,
>  >
>  > When I use datestr2num('2010-05') it nicely converts that to
> a number
>  > representing the date.
>  > When I convert that number back with num2date, it turns out
> it sets the day
>  > to the 19th of the month. The dime is 0:00:00.
>  > Any reason it is set to the 19th instead of the first?
>  > Maybe because today it the 19th, or is that just a coincidence?
>
> datestr2num calls dateutil.parser.parse, which by default uses the
> current date at 00:00:00 for missing fields. The dateutil function
> also can use a "default" argument to change this bahavoir but it is
> not available in datestr2num.
>
> 
> http://labix.org/python-dateutil#head-a23e8ae0a661d77b89dfb3476f85b26f0b30349c
>
> Goyo
>
>
>
>
>
> --
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AttributeError: 'BarContainer' object has no attribute 'autoscale_None'

2013-10-11 Thread Eric Firing
On 2013/10/10 8:52 PM, Nils Wagner wrote:
> Hi all,
>
> I tried to add a colorbar to a bar plot
>
> coolwarm = cm =  plt.get_cmap('coolwarm')
> values = range(100)
> cNorm  = colors.Normalize(vmin=0, vmax=values[-1])
> scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=coolwarm)
> colours = []
> for value in values:
>  colorVal = scalarMap.to_rgba(value)
>  colours.append(colorVal)
>
> fig = plt.figure()
> ax  = fig.add_subplot(111,projection='3d')
> hist,bin_edges = np.histogram(efratio,bins=100,range=(0.,1.),density=False)
> width = 0.7*(bin_edges[1]-bin_edges[0])
> center = (bin_edges[:-1]+bin_edges[1:])/2
> heatmap = ax.bar(center, hist, zs=z, zdir='y', align = 'center', width =
> width,color=colours)
> plt.colorbar(heatmap)
>
>
>
>
>
>  mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
> AttributeError: 'BarContainer' object has no attribute 'autoscale_None'

This is because it is not an instance of ScalarMappable, which is what 
colorbar() requires as its argument.
>
> How can I fix the problem ?

Use scalarMap as the argument instead of heatmap.  I think you will need 
to provide either the cax or the ax kwarg in addition.

examples/api/colorbar_only.py might also be helpful.

Eric
>
> Nils
>
>
>
> --
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Maidir le: Memory leak when using pyplot.ion() ?

2013-10-14 Thread Eric Firing
On 2013/10/14 7:48 AM, OCuanachain, Oisin (Oisin) wrote:
> Hi Mike,
>
> ion(), ioff() are useful to get immediate feedback when developing a
> script, when it is fully debugged I then increase the number of
> iterations and leave it running over the weekend. At that point I could
> obviously also have removed ion(), ioff() but given that I had no idea
> that this was necessary my sim crashed and I lost a weekend’s worth of
> sim time. Anyway, whether or not ion(),ioff() are needed in this
> particular script is really besides the point. If the script, however
> unusual, is revealing a bug in matplotlib it should be logged so that it
> can hopefully be fixed.
>
> Oisín

Oisín,

Certainly we want to find and fix bugs, with memory leaks being high 
priority. (I don't think we have seen a genuine mpl memory leak for 
quite a while; I am not aware of any at present.) We are not trying to 
maintain old mpl versions such as 1.0.1, however.  You are using the emf 
backend, which has been removed.  Therefore, unless you can reproduce 
the problem with mpl 1.3.x or 1.4.x in a SSCCE (http://sscce.org/), it 
is unlikely that your report will lead to a bug fix.  Perhaps it will 
lead to some useful insight, however.

I see someone has suggested that the problem might be in Windows. 
Another possibility is that it is in TkAgg, which I suspect is your 
default interactive backend.  I dimly recall that there was a time when 
TkAgg could leak memory, but I don't remember whether that was fixed by 
1.0.1 or not.

Eric


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Maidir le: Maidir le: Memory leak when using pyplot.ion() ?

2013-10-14 Thread Eric Firing
On 2013/10/14 8:26 AM, OCuanachain, Oisin (Oisin) wrote:
>

>
> Hi Eric,
>
> If .emf is no longer supported in current versions of matplotlib is
> there an alternative SVG-type format I can use ? I use .emf because I
> find that it tends to produce the clearest plots independent of how I
> re-size them when imported into documents. If memory serves I used to
> have a lot of problems with legibility when using raster-type formats
> like .png. If I get a chance I will try installing an up-to-date
> version of matplotlib and see if I can re-produce the behaviour.
>
> Oisin.
>

Oisin,

The ps, pdf, and svg vector formats are fully supported.  (Postscript 
inherently lacks support for transparency, though, so pdf and svg are 
recommended.)

Eric


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scatterplot c arg and NaN values, autonomous underwater vehicle

2013-11-13 Thread Eric Firing
On 2013/11/13 11:40 AM, robertdcurrier wrote:
> I've pulled my hair out for the past day trying to solve this problem and
> have done extensive searches to no avail. Here's my situation:
>
> I have data from an autonomous underwater vehicle. I have three np arrays to
> plot:
> 1) time on the x axis
> 2) vehicle depth on the y axis
> 3) sensor reading to set the color for the scatter plot at time/depth point.
>
> Unfortunately for me the vehicle reports sensors at different rates which
> means that I might have a time and depth stamp with a 'NaN' for the sensor
> value. The x/y portion of scatter deals with the NaNs with no problem, but
> when I call scatter(time, depth, c=mySensorArray) and mySensorArray contains
> a 'NaN'  matplotlib borks.   I have not been able to come up with a method
> to allow the values of the sensor being plotted to set the color of the
> scatter or skip the entry when the value is a 'NaN'.

mySensorArray = np.ma.masked_invalid(mySensorArray)

Eric


--
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Error installing matplotlib

2013-11-18 Thread Eric Firing
On 2013/11/18 1:09 PM, Cristóbal Ganter wrote:
> Hi I'm trying to install matplotlib in debian wheezy. But I get the
> following error:
> GotoBLAS : Architecture Initialization failed. No initialization function 
> found.
> I can't find anything useful in google.

Matplotlib doesn't know about blas directly, as far as I know, so my 
guess is that the error is actually coming from an attempt to import numpy.

Can you import and run numpy on the system in question?

Based on your link below, I suspect it is indeed a KVM problem; the 
error message suggests that GotoBLAS is trying to configure itself based 
on the architecture it is running on.  Maybe the KVM VM is not 
identifying itself in a way that GotoBLAS recognizes.

Eric

>
> You can find more details of my question in:
> http://stackoverflow.com/questions/20058653/gotoblas-error-when-installing-matplotlib-with-pip-in-a-virtualenv-on-debian-whe
>
> Thanks!


--
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Color of masked values in pcolor plots

2013-12-01 Thread Eric Firing
On 2013/12/01 5:11 AM, lin.h...@europe.com wrote:
> Z = X**2 + Y**2
> Z[(X**2+Y**2 < r**2) | (X**2+Y**2 > R**2)] = np.ma.masked

The problem is that Z is not a masked array.  Change the first line 
above to Z = np.ma.array(X**2 + Y**2).

Also, use pcolormesh instead of pcolor.  Pcolormesh is much faster.

Eric

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


Re: [Matplotlib-users] Matplotlib interactive shortcuts?

2014-01-08 Thread Eric Firing
On 2014/01/08 11:40 AM, Skip Montanaro wrote:
> Apologies. Gmail (or my fingers) were acting up...
>
> On Wed, Jan 8, 2014 at 3:39 PM, Skip Montanaro  wrote:
>> I'm happy with the draggable legends, but I have a problem. It seems
>> there are three pointer modes, the initial mode (updates x, y as you
>> move the mouse), zoom rectangle mode, and pan/zoom mode. Once I enter
>> either of those modes, I can't see how to get back to the original
>> mode. I found this navigation documentation:
>
> http://matplotlib.org/users/navigation_toolbar.html
>
> but I didn't see any way to get back to the starting mode (what's that
> mode called?), and the legend can only be moved as far as I can tell
> when that is the current mode.

If you are in pan/zoom or rectangle mode, just unselect it by clicking 
its select button again.

Ideally we would have an obvious radio button setup for this.

Eric

>
> Thx,
>
> Skip


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


Re: [Matplotlib-users] pyplot.plot plotting points in wrong order making loops in the graph display

2014-01-09 Thread Eric Firing
On 2014/01/09 1:57 AM, vargfran wrote:
> Dear all
> pyplot seems to be plottting(joining points with lines) in the wrong order I
> have checked all the algorithms relating the data being plotted and
> everything is in order
> 
> this can be observed in the image on how it makes these closed loops by
> plotting a line between two points skipping one or several points in time
> then going back to them before continuing to the next. I wonder if anyone
> has encountered this problem before or knows a solution.

This looks like a problem in parsing date/time x values in a text input 
file, not a problem in the actual plotting.

Eric



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


Re: [Matplotlib-users] Basemap Plotting on Floating(?) Axes

2014-01-23 Thread Eric Firing
On 2014/01/22 1:51 PM, geo_leeman wrote:
> Hello all,
>
> Several of us have been stumped on how to create a map with basemap that
> doesn't have a rectangular bounding box.  I've attached an example of what
> we are trying to create (done with GMT and not ours).  Browsing the docs I
> thought it may be possible with a floating axis as in the gallery, but that
> doesn't do the trick either.  Is there a way to create such a plot with
> basemap?

I don't think so. Not easily, with labeled meridians and parallels.

Eric

>
> Thanks,
> J.L.
>
> 
>


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


Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-28 Thread Eric Firing
On 2014/01/28 10:01 AM, A Short wrote:
> Hi - Ive now improved my code and confirmed the use of the right grib file
> but i cant for the life of me figure out the missing data near the
> coastline..? Could anyone help?

The present contouring algorithm works with rectangular blocks, and if 
any corner has missing data, nothing is filled for that block.

Eric

>
> `import Nio
> from mpl_toolkits.basemap import Basemap
> import matplotlib.pyplot as plt
> import numpy as np
>
> f = Nio.open_file('nww3.t12z.grib(2).grib2')
> lons = f.variables['lon_0'][:]
> lats = f.variables['lat_0'][::-1] # flip latitudes so data goes S-->N
> times = f.variables['forecast_time0'][:]
> ntime = 5
> data = f.variables['HTSGW_P0_L1_GLL0'][ntime,::-1]
>
> fig = plt.figure(figsize=(16,16))
> m = Basemap(llcrnrlon=-35.,llcrnrlat=42.,urcrnrlon=5.,urcrnrlat=65.,
>  projection='lcc',lat_1=10.,lat_2=15.,lon_0=10.,
>  resolution ='h',area_thresh=1000.)
>
> x, y = m(*np.meshgrid(lons, lats))
> m.fillcontinents(color='#477519')
> m.drawcoastlines(linewidth=0.5, color='k', antialiased=1, ax=None,
> zorder=None )
>
> m.contourf(x, y, data, np.arange(0,9.9,0.1))
> plt.show() `
>
> Resulting plot is here
> 
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42790.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-29 Thread Eric Firing
On 2014/01/28 11:40 PM, Ian Thomas wrote:
> On 29 January 2014 03:21, Eric Firing  <mailto:efir...@hawaii.edu>> wrote:
>
> On 2014/01/28 10:01 AM, A Short wrote:
>  > Hi - Ive now improved my code and confirmed the use of the right
> grib file
>  > but i cant for the life of me figure out the missing data near the
>  > coastline..? Could anyone help?
>
> The present contouring algorithm works with rectangular blocks, and if
> any corner has missing data, nothing is filled for that block.
>
>
> This will improve shortly, cutting off the corners of some of those
> empty blocks. I am currently testing the new algorithm for this prior to
> submitting it for others' approval.

Ian,

I'm glad to hear that!  One possibility would be to use a temporary 
rcParam (temporary in that it might be phased out after a couple 
releases) to allow switching between the two algorithms.  This would 
make it much easier to test, and it would also allow a transition during 
which people could reproduce results obtained with earlier mpl.  It 
would also be a safety measure, in case someone hits a corner case which 
the new algorithm doesn't handle but the old one does--not that I'm 
expecting such cases to arise.

Eric

>
> Ian


--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-29 Thread Eric Firing
On 2014/01/29 5:41 AM, A Short wrote:
> Is there any work around so it looks like the below image?

It looks like with any reasonable contouring algorithm, this would 
require interpolating into land regions, contouring, and then plotting 
the land on top.  The key is the interpolation, not the plotting.  The 
example you show might have been interpolated to a finer grid 
everywhere, not just in the missing value regions.

I can't comment on the file itself.

Eric

>
> Could anyone confirm that this would be the correct grib file for The North
> Atlantic..?
> ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/wave.20140129/nww3.t06z.grib.grib2
>
> Thanks for all the help
>
> 
>
>
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42798.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Clabel conflicts with contourf

2014-01-30 Thread Eric Firing
On 2014/01/30 1:10 AM, Alexis Praga wrote:
> Hi,
>
> I've attached a reproducible example : when clabel is used, there are some 
> empty (i.e white) triangles in the countour.
> It does not occur without clabel.

Thanks for the report--but clabel is intended to be used only with 
contour, not with contourf.  Typically one would call contourf, and then 
call contour, perhaps with a subset of the levels used in contourf.  The 
ContourSet resulting from the contour call would then be used in the 
call to clabel.  Example:

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

In this example the contour lines are black, but if you don't want the 
lines to show up at all, you could make them transparent, and then 
include a "colors" kwarg in the clabel call.

Eric

>
> Tested with matplotlib 1.2.0, python 2.7 on Fedora 14, 64 bits.
>
> Cheers,
>



--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] trouble with Arrow

2014-02-02 Thread Eric Firing
On 2014/02/02 6:52 PM, Alan G Isaac wrote:
> Also, despite setting `edgecolor=None`, the edge is still stroked.

I suspect you need edgecolor='none'.  In general, specifying a color as 
the string 'none' means "don't draw it".

--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] trouble with Arrow

2014-02-02 Thread Eric Firing
On 2014/02/02 7:45 PM, Alan G Isaac wrote:
> Last question about this for now ...
>
> Yet another issue with `arrow`: the
> docs say a dashed linestyle is supported
> http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.arrow
> but really it is not: the *edge* is dashed rather than the tail!
>
> Maybe I'm missing the intended usage here.  But
> I'm starting to think Matplotlib could use a "SimpleArrow".
> The tail would just be a line.
> The head would just be  a filled triangle.
> The default would be length_includes_head=True.
>
> Alan Isaac
>

Alan,

I think you are raising good points. (The default of not including the 
head in the length is puzzling, to say the least.) Actually making a 
*good* simple arrow is not as simple as it might seem, but it can be 
done.  The main difficulty is the need to use a mix of coordinates and 
transforms to handle varying axes sizes and aspect ratios.  In any case, 
I think you have pointed to one of many areas where mpl's present design 
and user interface could be improved.  It's all a matter of volunteer 
labor to make such improvements--with the added difficulty of needing to 
maintain backward compatibility over fairly long periods.

For your immediate needs, might quiver work better?  It's interface is 
also rather complex because of the use cases it covers.

If you are using the arrows for annotation rather than as 
representations of vectors, then of course the annotate() function is 
appropriate.

Eric

--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] reduce the number of ticks

2014-02-17 Thread Eric Firing
On 2014/02/17 4:58 AM, Pierre Haessig wrote:
> Hi,
>
> In order to get a plot with a small number of ticks, it is possible to
> create a matplotlib.ticker.MaxNLocator object with a small value for
> `nbins`.
>
> However, I found it also possible to modify the existing AutoLocator
> instances, since AutoLocator derives from MaxNLocator :
>
> ax.xaxis.major.locator.set_params(nbins=5)
> ax.yaxis.major.locator.set_params(nbins=5)
>
> (the default nbins value seems to be 9)
>
> The advantage of this inplace solution is that it doesn't any
> importing/browsing in the mpl namespace. However, it's still a bit long.
>
> I was then wondering :
> 1) is this solution recommended or not ?
> 2) is there a shortcup to avoird the five "dots" ?

http://matplotlib.org/api/pyplot_api.html?highlight=locator_params#matplotlib.pyplot.locator_params

This is both a pyplot function and an Axes method.

Eric

>
> best,
> Pierre


--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How can I put a white area in the middle of colorbar showing the masked data?

2014-03-01 Thread Eric Firing
On 2014/03/01 9:57 AM, Chao YUE wrote:
> Dear all,
>
> In many cases in geoscience mapping we want to show the some missing values
> as some special color in the colorbar. like attached one.
>
> I know there is one method in matplotlib colormap called "set_bad", official
> docs says:
>
> Set color to be used for masked values.
>
> But I don't know how to make this work when I call the colorbar method.

It is not a matter of calling the colorbar method, but of setting up the 
colormap used on the color-mapped plot for which the colorbar is made.

The one wrinkle to this is that if you are using contourf, the masked 
regions are not filled at all, so they take on the color of the 
background.  To give them the color you assigned to the colormap with 
set_bad, you need to assign that same color to the background, e.g.

ax.set_axis_bgcolor("#bdb76b")

On re-reading your message, however, I think you are asking something 
else, but it is not clear to me from your example exactly what you are 
trying to do.

The colorbar is strictly for a range or sequence of colors, which can 
include triangle regions for the "over" and "under" values; there is no 
place on the colorbar for a "bad" or "missing" value.  Where would you 
put one?  I don't see any such region on the example colorbar you attached.

Eric



> Is there anyone who have the some successful experience?
>
> Thanks a lot in advance!
>
> Chao
> --
> ***
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> 
>
>
> --
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How can I put a white area in the middle of colorbar showing the masked data?

2014-03-01 Thread Eric Firing
On 2014/03/01 11:03 AM, ChaoYue wrote:
> The most correct way might be to design a new colormap with white color
> exactly in the middle, however this is very tedious, especially if I
> want to try
> different colormaps. so the alternative approach would be to set the values
> falling in (-1,1) as being masked, so they will be the same as the axes
> background color as you mentioned (in our case it's white). My question is,
> how can I put this background color (which shows maksed data) in the
> colorbar,
> by avoiding design a new colormap?

It's not the answer you want to hear, but I think the correct answer is 
that you should do this via the colormap, and not by masking the low 
values.  It doesn't have to be painful.  If, in contourf, you use a 
diverging colormap with white already in the middle 
(http://matplotlib.org/examples/color/colormaps_reference.html) and a 
norm with symmetric limits (vmin and vmax; you can let them be set 
automatically after you specify your symmetric set of contour boundaries 
appropriately) then it will be done for you.

e.g.,

z = 10 * np.random.randn(20, 30)
clevs = [-10, -5, -2, -1, 1, 2, 5, 10]
cs = plt.contourf(z, levels=clevs, cmap=plt.get_cmap('PRGn'),
   extend='both')
cbar = plt.colorbar(cs, spacing='uniform')

Eric

--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How can I put a white area in the middle of colorbar showing the masked data?

2014-03-02 Thread Eric Firing
On 2014/03/02 1:02 AM, ChaoYue wrote:
> Dear Eric,
>
> This solved part of my problem. thanks a lot.
> I think I will revisit this issue when I have time (not promised).
> do you think this could be some feature desirable?

I don't understand what feature you are referring to; evidently I don't 
understand what the problem is, so I don't know what part remains unsolved.

Eric


>
> Cheers,
>
> Chao
>
>
> On Sat, Mar 1, 2014 at 10:39 PM, Eric Firing [via matplotlib] <[hidden
> email] > wrote:
>
> On 2014/03/01 11:03 AM, ChaoYue wrote:
>  > The most correct way might be to design a new colormap with white
> color
>  > exactly in the middle, however this is very tedious, especially if I
>  > want to try
>  > different colormaps. so the alternative approach would be to set
> the values
>  > falling in (-1,1) as being masked, so they will be the same as
> the axes
>  > background color as you mentioned (in our case it's white). My
> question is,
>  > how can I put this background color (which shows maksed data) in the
>  > colorbar,
>  > by avoiding design a new colormap?
>
> It's not the answer you want to hear, but I think the correct answer is
> that you should do this via the colormap, and not by masking the low
> values.  It doesn't have to be painful.  If, in contourf, you use a
> diverging colormap with white already in the middle
> (http://matplotlib.org/examples/color/colormaps_reference.html) and a
> norm with symmetric limits (vmin and vmax; you can let them be set
> automatically after you specify your symmetric set of contour
> boundaries
> appropriately) then it will be done for you.
>
> e.g.,
>
> z = 10 * np.random.randn(20, 30)
> clevs = [-10, -5, -2, -1, 1, 2, 5, 10]
> cs = plt.contourf(z, levels=clevs, cmap=plt.get_cmap('PRGn'),
> extend='both')
> cbar = plt.colorbar(cs, spacing='uniform')
>
> Eric
>
> 
> --


--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] About the scientific ticker format on pylab plot

2014-03-03 Thread Eric Firing
On 2014/03/03 11:40 AM, Ying Liu wrote:
> Hi,
>
> I want to know how to set the scientific ticker format in pylab. I know
> that I can set it to the form of 1e21, but what I want is something like
> x10^21, as follows:
>
> Inline image 1 -> Inline image 2
>
>
> Can anybody tell me how to do this? I searched on this for a long time,
> but still I did not find the answer.

Execute this before plotting:

rcParams['axes.formatter.use_mathtext'] = True

or set it in your matplotlibrc file.

Eric

>
> Sorry to bother those who are not interested.
>
> Best regards
>
>


--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with relim and autoscale_view in 1.3.1

2014-03-04 Thread Eric Firing
On 2014/03/04 12:56 PM, Stuart Mentzer wrote:
> Hi,
>
> I'm seeing odd behavior with the relim() and autoscale_view() call
> sequence with matplotlib 1.3.1. In some cases I am ending up with axis
> ranges of [-0.05,0.05] instead of the actual data ranges. This happens
> with scatter plots and sometimes with contour plots.

Why are you trying to use relim() here?  It does not support 
collections, and scatter produces a collection.  It doesn't find any 
Artists that it knows about, so it assumes nothing has been added to the 
plot, and it yields a generic set of limits.

Eric

>
> The modified version of the scatter_demo2 below displays the problem. I
> think this used to work for scatter plots with earlier versions of
> matplotlib. Is this supposed to work or is there another way to do it
> correctly (other than doing our own limit setting)?
>
> Thanks,
> Stuart
>
> """
> Demo of scatter plot with varying marker colors and sizes.
> """
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.cbook as cbook
>
> # Load a numpy record array from yahoo csv data with fields date,
> # open, close, volume, adj_close from the mpl-data/example directory.
> # The record array stores python datetime.date as an object array in
> # the date column
> datafile = cbook.get_sample_data('goog.npy')
> price_data = np.load(datafile).view(np.recarray)
> price_data = price_data[-250:] # get the most recent 250 trading days
>
> delta1 = np.diff(price_data.adj_close)/price_data.adj_close[:-1]
>
> # Marker size in units of points^2
> volume = (15 * price_data.volume[:-2] / price_data.volume[0])**2
> close = 0.003 * price_data.close[:-2] / 0.003 * price_data.open[:-2]
>
> fig, ax = plt.subplots()
> ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5)
>
> # These cause ranges to be set incorrectly to [-0.055,0.055] !!
> ax.relim()
> ax.autoscale_view( tight = True )
>
> ax.set_xlabel(r'$\Delta_i$', fontsize=20)
> ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=20)
> ax.set_title('Volume and percent change')
>
> ax.grid(True)
>
> fig.tight_layout()
>
> plt.show()
>
>
> --
> Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
> With Perforce, you get hassle-free workflows. Merge that actually works.
> Faster operations. Version large binaries.  Built-in WAN optimization and the
> freedom to use Git, Perforce or both. Make the move to Perforce.
> http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow for .png- low resultion

2014-03-05 Thread Eric Firing
On 2014/03/05 11:37 AM, Asma Riyaz wrote:
>   Sorry I somehow forgot to paste the imshow call to plot the .png
> image(pasted the entire code again), I am trying the different
> interpolation parameters in the mean time as suggested by Pierre
>
> data=np.array(full_len)
>  cmap = mpl.cm.hot
>  if outlier==0:
> threshold=1
>  else:
> threshold=outlier-0.01
>
>  fig = plt.figure(figsize=(25,25))
>  plt.suptitle(file_handle.replace('.csv',''),fontsize=22)
>  cmap.set_over('green')
>  cmap.set_under('grey')
>  gs=gridspec.GridSpec(1, 2,height_ratios=[1,1,-2,2]
> ,width_ratios=[1,1,-2,2])
>  gs.tight_layout(fig,)
>  phyl_ax=plt.subplot(gs[0]) ##,frameon=False)##
>  ht_ax=plt.subplot(gs[1],sharey=phyl_ax)
>  ##gs.tight_layout(fig, rect=[1,1,2,2])
>  ht_ax.set_xlim(0,35)
>  ht_ax.set_ylim(0,35)
>  ##ht_ax.grid(color='white',linestyle='-',linewidth=1)
>  ##fig.subplots_adjust(hspace=0)
>  cb_ax,kw =mpl.colorbar.make_axes(ht_ax, shrink=0.65)
>
>  plt.setp(phyl_ax.get_xticklabels(),visible=False)
>  plt.setp(phyl_ax.get_yticklabels(),visible=False)
>  plt.setp(ht_ax.get_xticklabels(),visible=True)
>  plt.setp(ht_ax.get_yticklabels(),visible=True)
>  plt.setp(phyl_ax.get_xticklines(),visible=False)
>  plt.setp(phyl_ax.get_yticklines(),visible=False)
>  plt.setp(ht_ax.get_xticklines(),visible=True)
>  plt.setp(ht_ax.get_yticklines(),visible=True)
>
>
>  img = ht_ax.imshow(data, cmap=cmap,
> interpolation='none',vmax=threshold)
>  cb = mpl.colorbar.ColorbarBase(ax=cb_ax,cmap=cmap,
> extend='neither',**kw)
>  cb.cmap.set_over('green')
>  ##image_file =
> cbook.get_sample_data('/home/asmariyaz/Desktop/mytree.png',asfileobj=False)
>  ##image = plt.imread(image_file)
>  img= mpimg.imread('/home/asmariyaz/Desktop/mytree.png')
>  phyl_ax.imshow(img,interpolation='nearest')
>
> heatmap_file=fig.savefig('/home/asmariyaz/Desktop/heatmap/'+file_handle+'.pdf',bbox_inches='tight')

Try giving savefig a dpi kwarg to increase the resolution with which the 
image is saved in the pdf?  Turn off anti-aliasing when you make the png?

Eric



--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Color bar extents

2014-03-06 Thread Eric Firing
On 2014/03/06 4:18 AM, Asma Riyaz wrote:
> Hi,
>
> I am stuck at setting the color bar minimum and maximum values,
> according to what I found I need to set ticks to a numpy linspace array.
> Here is my code:
>
> *threshold=1.01
>
>  fig = plt.figure(figsize=(25,25))
>  plt.suptitle(file_handle.replace('.csv',''),fontsize=22)
>  cmap.set_over('green')
>  cmap.set_under('grey')
>  gs=gridspec.GridSpec(1, 2,height_ratios=[1,1,-2,2]
> ,width_ratios=[2,1,-2,2],hspace=0,wspace=0)
>
>  phyl_ax=plt.subplot(gs[0])
>  ht_ax=plt.subplot(gs[1])
>
>  ht_ax.set_xlim(34,0)
>  ht_ax.set_ylim(34,0)
>
>
>  cb_ax,kw =mpl.colorbar.make_axes(ht_ax, shrink=0.65)
>
>  plt.setp(phyl_ax.get_xticklabels(),visible=False)
>  plt.setp(phyl_ax.get_yticklabels(),visible=False)
>  plt.setp(ht_ax.get_xticklabels(),visible=True)
>  plt.setp(ht_ax.get_yticklabels(),visible=True)
>  plt.setp(phyl_ax.get_xticklines(),visible=False)
>  plt.setp(phyl_ax.get_yticklines(),visible=False)
>  plt.setp(ht_ax.get_xticklines(),visible=True)
>  plt.setp(ht_ax.get_yticklines(),visible=True)
>
>
>  img =
> ht_ax.imshow(data,cmap=cmap,interpolation='none',vmin=-1.0,vmax=threshold,aspect='auto')
>  v = np.linspace(-1.0, 1.0, 15, endpoint=True)
>  cb =
> mpl.colorbar.ColorbarBase(ax=cb_ax,cmap=cmap,ticks=v,extend='neither',**kw)
>  cb.cmap.set_over('green')
>  img= mpimg.imread('/home/asmariyaz/Desktop/mytree.png')
>  phyl_ax.imshow(img,interpolation='bilinear',aspect='auto')
> *
>

Why are you using ColorbarBase instead of using fig.colorbar?  By doing 
so, you are not getting the logic that ties the colorbar to the 
color-mapped object to which it applies.

Eric

> The problem that arises is that the color bar's extent always shows up
> from 0 to 1, though I set the ticks from -1 to 1?
> I also noticed that in a dataset where I have a negative value, the
> color bar still shows up as 0 to 1.
>
> Could anyone guide me? Appreciate your help!!
>
> Asma
>
>
>
>
>
>
>
>
> --
> Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
> With Perforce, you get hassle-free workflows. Merge that actually works.
> Faster operations. Version large binaries.  Built-in WAN optimization and the
> freedom to use Git, Perforce or both. Make the move to Perforce.
> http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Clip or skip lines going over border of canvas

2014-03-07 Thread Eric Firing
On 2014/03/06 10:43 PM, svebert wrote:
> Hi!
>
> I plot measurment data and connect them with lines (style eg. "-*r"). Points
> which are outside of the ylimits are still connected with points which are
> inside of the ylimits. Is there any way to tell matplot to only connect two
> points if both are inside the y/x-limits?
> Because now i get weird lines crossing the whole canvas if some points
> spread to much from the mean data.
>
> Removing points before plotting is not an option because then points are
> connected which are not in consecutive order. Matplotlib should just skip a
> connecting line when one of the two points lies without the canvas/limits.

It sounds like what you need to do is either use a masked array and mask 
out the points that are outside the limits, or use NaNs for that purpose.

Eric

>
> Is there any simple way/option to do tha?
>
> Thanks in advance,
> Sven
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Clip-or-skip-lines-going-over-border-of-canvas-tp43015.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
> With Perforce, you get hassle-free workflows. Merge that actually works.
> Faster operations. Version large binaries.  Built-in WAN optimization and the
> freedom to use Git, Perforce or both. Make the move to Perforce.
> http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Troubleshooting

2014-03-12 Thread Eric Firing
On 2014/03/12 2:41 PM, Caio Sanches wrote:
> Hey there!
> I have a mac 10.9 (Mavericks), and I needed matplotlib for a course I was 
> participating.
> I installed python 2.7.6, as requested, and downloaded the installer (dmg) 
> from the sourceforge page.
> I created a simple file, to plot a simple graph, but then it gave me an error 
> (attached as Output.txt).
> I don’t know what to do…
> Please help me.
> Thanks in advance
> -Caio
>

The file you attached does not show the error, or the code and data you 
used, so we have no idea what the problem might be.

If you are new to python, then I suggest that you install Anaconda 
https://store.continuum.io/cshop/anaconda/ rather than installing python 
packages like matplotlib one by one.

Second, it sounds like you need to do a bit of background reading, and 
perhaps find someone local to help you get started.

Eric


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


Re: [Matplotlib-users] Left-aligned and centered title

2014-03-17 Thread Eric Firing
On 2014/03/17 3:31 AM, Florian M. Wagner wrote:
> Dear users,
>
> I would like label my subplots with a horizontally left-aligned letter
> (wanted by the journal) and the normal, centered axes title, which
> should both be vertically in line. The following example does not work:
>
> from matplotlib import pyplot as plt
> import numpy as np
>
> fig, ax1 = plt.subplots()
> x = np.linspace(1,10)
> y = (sin(x))
> ax1.plot(x,y)
>
> def subplot_label(ax, letter, title):
>  title = ax.set_title(title)
>  pos = title.get_position()
>  va = title.get_va()
>  ax.text(0, pos[1], letter, transform=ax.transAxes,
> verticalalignment=va)
>
> subplot_label(ax1, 'a)', 'This text is not aligned with the label')
>
>
> Which property of the axes title am I missing?

Is the following what you need?

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

Eric

>
> Thank you for your help
>


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


Re: [Matplotlib-users] removing a plot from an axes

2014-04-18 Thread Eric Firing
On 2014/04/18 12:21 PM, Michael Mossey wrote:
> Sorry for what is a beginnerish question but I'm having  a hard time
> using the docs. I want to remove a previous plot from an axes. How do I
> do this?

If you want to clear the axes, call the "cla()" or "clear()" method.
If you want to remove an artist such as a line, call its "remove()" method.

>
> Incidentally, it makes the docs hard to use that there are so many
> methods on Axes which are spread a great distance over the page. It
> would be nice to have a concise listing of the methods of Axes.

I agree. What is needed is a listing of methods by category instead of 
all together as a single alphabetical list.  In the meantime, you might 
find browsing the User Guide to be of some help.  Also, the "Quick 
Search" box can help.

Eric

>
> Note that I'm not using pyplot, but I think the term for what I'm doing
> is using the API. I'm subclassing FigureCanvas in PyQt, creating a
> Figure, and creating an axes using Figure.add_subplot().
>
> Mike
>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] Spooling up on matplotlib .... run all the examples

2014-04-20 Thread Eric Firing
On 2014/04/17 11:07 AM, Elden Crom wrote:
>
> matplotlib is impressive in its capabilities, I didn't realize how much so
> until I download from the git, and made a little script to run all of the
> examples.
>

Thank you.

It's hidden away, but a script to do this type of thing exists.  For a 
long time it was effectively our testing mechanism--run all the examples 
and scan the results to see if they looked right.  It is 
examples/tests/backend_driver.py.

Eric

> I'm way too much of a newbie here to check anything in, but I thought
> someone may find this trinket useful.  As written, it should be in the
> 'matplotlib/examples' directory named 'runAll.py', if someone is so inclined
> to check it in.  Feel free to edit or eviscerate it or whatever.
>
> --
> #!/usr/bin/python
> ###
> ##
> ##  REVISION HISTORY
> ##DateNameSCR#Description
> ##    --
> 
> ##  2014-04-17  Elden CromN#A Initial Release
> ###
>
> import subprocess, os
>
> ###To make the demos work that needed sample data I had to
> ### 'cp /etc/matplotlibrc ~/.matplotlib/'  and edit the examples.directory
> ###  entry to not have the extra tick marks ie
> ### """examples.directory : /usr/share/matplotlib/sampledata"""
> ### but I think this was because of a version issue
>
> dirs = [root for root, dir, files in os.walk(".")]
> #dirs = ['./showcase', './widgets']  #to only run a directory or two
>
> excluded = ['./runAll.py','./tests/backend_driver.py']
> def myfilter(d,f):
>  fpth = os.path.join(d,f)
>  return (os.path.isfile(fpth) and
>  f.endswith('.py') and
>  not fpth in excluded)
> pyfiles =[]
> for d in dirs:
>  pyfiles.extend([ (d,f) for f in os.listdir(d) if myfilter(d,f) ])
>
> #there are over 400 examples in the git repository
> #[git clone git://github.com/matplotlib/matplotlib.git]/matplotlib/examples
> #so you might not want to see them all in one setting!
> #pyfiles=pyfiles[100+100:]
>
> for i,(d,f) in enumerate(pyfiles):
>  print "Executing 'python %s'--(%d of
> %d)--"%(os.path.join(d,f),i,len(pyfiles))
>  subprocess.Popen(["python", f],cwd=d).wait()
>
>
>
>
>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] checking if an artist is in the list of artists for an axes

2014-04-22 Thread Eric Firing
On 2014/04/21 8:30 PM, Michael Mossey wrote:
> How do I check if an artist is in the list of artists attached to an axes?

if a in ax.get_children():
 ...

Eric
>
> Mike
>
>
>
> --
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] turning off autoscale

2014-04-23 Thread Eric Firing
On 2014/04/23 11:19 AM, Michael Mossey wrote:
> I'm sorry, these are questions that could be found in the Axes
> documentation, but I really don't feel like scrolling through 100 pages
> that are irrelevant hoping I can find the relevant functions, which I
> don't even know what they are called. Is there ever going to be a
> concise listing of functions? Also there seem to be a lot of

PRs for doc improvements are welcome!

> undocumented functions related to bounding boxes and copying from the
> background--I had to find Stack Overflow examples to learn about those.

Doesn't the search box in the html docs help?  Or just plain browser 
searching when you are looking at the Axes API docs?

I also find that ipython is very helpful, with tab completion and the 
question mark for getting the doc string.  E.g., make an axes object and 
then use tab completion to see the methods that start with auto, and 
follow with a question mark to see the docstring.  Or a double question 
mark to see the code.

>
> What I want to do is
>
> (1) plot a couple of lines with y autoscaling and x autoscaling on
> (2) turn off y autoscaling so the y limits do not change further if the
> x limits are changed
> (3) change the x limits
>
> What axes functions are needed?

try:

ax.autoscale(enable=False, axis='y')

or

ax.set_autoscaley_on(False)

Ugly name for the method, but we're stuck with it.

These differ in that the first one turns y scaling off and then performs 
the autoscaling, while the second only turns y scaling off for any 
subsequent execution of the autoscale_view() method.

Eric

>
> Note that I'm not using pyplot, rather the API so I'm looking for
> methods of Axes.
>
> Mike
>
>
> --
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Entropy calculation incorrect?

2014-04-25 Thread Eric Firing
Nathan,

Thanks for bringing this up.  It looks like the short-term fix is to 
make the documentation match the code.  Longer term, it seems to me like 
this is the sort of thing that should be deprecated; it doesn't belong 
in matplotlib any more.

Would you open an issue on Github, please?  Even better: submit a pull 
request that fixes the documentation.

Eric

On 2014/04/25 1:26 AM, Nathan Lindop wrote:
> Hello,
>
> I have been using the matplotlib.mlab.entropy function and have noticed
> that it may be incorrect. I have posted a question on stackoverflow here:
> http://stackoverflow.com/questions/23291576/matplotlib-mlab-entropy-calculation-incorrect
>
> I thought I would should it on the mailing list too. Does anyone have
> any ideas?
>
> Thanks,
> Nathan
>
>
> --
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Composing image from hex tiles using RegularPolyCollection

2014-04-25 Thread Eric Firing
On 2014/04/24 11:40 PM, Tom Grydeland wrote:
> Hi all,
>
> I will explain what I’m trying to achieve first, then the approaches I’ve 
> attempted so far, with results.
>
> I have data on a 2D grid which I want to present as an image — a la 
> pyplot.imshow() — except that the grid is hexagonal, not rectangular.  The 
> grid can be represented in multiple ways, I use a regular 2D array with the 
> convention that the lower left hex is (0,0), x increases to the right 
> (crossing vertical hex boundaries) and y increases upwards slanting to the 
> right.
>

Tom,

Have you considered adapting the code from the Axes.hexbin() method?

Ideally, the hexbin method might be split into two parts, one for the 
calculation and another for the plotting.

Eric

> Ideally, I’d also be able to have a colorbar.
>
> I’m giving my routines three input vectors: x, y and c.  X and y are 
> initially integers, then transformed to centerpoint coordinates using
>   x, y = x+.5*y, y*np.cos(np.pi/6)
> while c is used to look up values in a colormap.
>
> I first tried to adapt ‘scatter_demo2.py’ to my needs.  Unfortunately, the 
> pyplot.scatter routine fails when given ‘c’ or ’s’ keywords, as has been 
> reported elsewhere by somebody else:
> 
> http://stackoverflow.com/questions/20524888/attributeerror-numpy-ndarray-object-has-no-attribute-get-matrix
>
> I’ve dug around in the code for a bit without finding out how this arises.  
> It seems to me it has to do with how transforms are being handed around and 
> at what point their representation is changed from objects to pure matrices.  
> This backend appears to expect to see objects only, but is handed matrices 
> instead.  I’ve hacked my way around that one in backends/backend_macosx.py by 
> changing lines around 79-80 from
> master_transform = master_transform.get_matrix()
> all_transforms = [t.get_matrix() for t in all_transforms]
> to
> try:
> master_transform = master_transform.get_matrix()
> except AttributeError: pass
> try:
> all_transforms = [t.get_matrix() for t in all_transforms]
> except AttributeError: pass
> (which is a dirty hack, but I don’t know how to do it right)
>
> Now I can run the scatter_demo2 script, and I can obviously have it produce 
> hexes at uniform size, but the size of the hexagons are set independently of 
> the axes.  Good for symbols used to mark arbitrary coordinates, not so good 
> when I try to cover the plane without gaps.
>
> Next, I’ve tried creating the patches one by one, essentially this:
>
> r = 1./np.sqrt(3)
> for xy, cc in zip(zip(x, y), c):
> hexp = mpl.patches.RegularPolygon(xy, 6, radius=r, facecolor=cc, 
> edgecolor=’none')
> ax.add_patch(hexp)
> ax.autoscale_view()
> ax.figure.canvas.draw()
>
> This works as I want it to, but becomes unbearably slow when the number of 
> hexes grows beyond a few thousand.
>
> Given that RegularPolygon can do the trick, it seems likely that 
> RegularPolyCollection should also be able to?
>
> This is what I tried:
>
> ax = gca()
> collection = RegularPolyCollection(
> 6, # a pentagon
> rotation=(np.pi/7,),
> sizes=(.5/np.sqrt(3),),
> facecolors = cc,
> edgecolors = None,
> linewidths = (1,),
> offsets = zip(xx,yy),
> transOffset = ax.transData,
> )
> #collection.set_transform(ax.transData)
> ax.add_collection(collection, autolim=True)
>
> ax.autoscale_view()
> ax.figure.canvas.draw()
>
> This produces dots of minute sizes at the desired coordinates.  I can tweak 
> the size to make them bigger, but they don’t scale with the axes, as for the 
> scatter_demo script used initially.  Digging in the docs, I found a reference 
> to the set_transform() method of Artists, so I tried setting that to 
> ax.transData (the line commented out in the above snippet), and voila! I have 
> hexagons covering the plane again.  Strangely enough, they’re not in the 
> right place anymore (and the locations change when zooming in or out), the 
> sizes aren’t _quite_ right, the autoscaling of axes appear to believe the 
> patches are where I wanted them to be, not where they appear on the plot, 
> results are very different if saving to a figure instead of drawing to a 
> figure window, etc.
>
> Is there a way I can make RegularPolyCollection patches transform with axes 
> coordinates in the same way that RegularPolygon patches do?
>
> Am I barking up the wrong tree, is there another, blindingly obvious, way I 
> should be doing this?
>
> The observant reader will also notice the strange rotation keyword given to 
> RegularPolyCollection.  This keyword is ignored in the macosx backend, and I 
> have been unable to find out why.
>
> Thank you for all tips and pointers
>
> --Tom Grydeland
>
>
> --
> Start Your

Re: [Matplotlib-users] basic pgf test fails

2014-05-07 Thread Eric Firing
On 2014/05/07 2:34 AM, Neal Becker wrote:
> Neal Becker wrote:
>
>> I tried the simple example, but all examples I try choke on savefig
>> ('blah.pdf') This is fedora20 linux, with pretty modern, complete texlive.
>>
>> I tried rm'ing tex-cache
>>
>>  example.py
>> # -*- coding: utf-8 -*-
>>
>> import matplotlib as mpl
>> mpl.use("pgf")
>> pgf_with_rc_fonts = {
>>  "font.family": "serif",
>>  "font.serif": [],   # use latex default serif font
>>  "font.sans-serif": ["DejaVu Sans"], # use a specific sans-serif font
>> }
>> mpl.rcParams.update(pgf_with_rc_fonts)
>>
>> import matplotlib.pyplot as plt
>> plt.figure(figsize=(4.5,2.5))
>> plt.plot(range(5))
>> plt.text(0.5, 3., "serif")
>> plt.text(0.5, 2., "monospace", family="monospace")
>> plt.text(2.5, 2., "sans-serif", family="sans-serif")
>> plt.text(2.5, 1., "comic sans", family="Comic Sans MS")
>> plt.xlabel(u"µ is not $\\mu$")
>> plt.tight_layout(.5)
>> --
>>
>> python testpgf.py
>> /usr/lib64/python2.7/site-packages/matplotlib/__init__.py:758: UserWarning:
>> Found matplotlib configuration in ~/.matplotlib/. To conform with the XDG 
>> base
>> directory standard, this configuration location has been deprecated on Linux,
>> and the new location is now '/home/nbecker/.config'/matplotlib/. Please move
>> your configuration there to ensure that matplotlib will continue to find it 
>> in
>> the future.
>>_get_xdg_config_dir())
>> Traceback (most recent call last):
>>File "testpgf.py", line 20, in 
>>  plt.tight_layout(.5)
>>File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 1255,
>>in
>> tight_layout
>>  fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
>>File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1600,
>>in
>> tight_layout
>>  renderer = get_renderer(self)
>>File "/usr/lib64/python2.7/site-packages/matplotlib/tight_layout.py", line
>> 222, in get_renderer
>>  renderer = canvas.get_renderer()
>>File
>>"/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
>> line 925, in get_renderer
>>  return RendererPgf(self.figure, None, dummy=True)
>>File
>>"/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
>> line 409, in __init__
>>  self.latexManager = LatexManagerFactory.get_latex_manager()
>>File
>>"/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
>> line 223, in get_latex_manager
>>  new_inst = LatexManager()
>>File
>>"/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
>> line 305, in __init__
>>  cwd=self.tmpdir)
>>File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
>>  errread, errwrite)
>>File "/usr/lib64/python2.7/subprocess.py", line 1308, in _execute_child
>>  raise child_exception
>> OSError: [Errno 2] No such file or directory
>>
> Figured it out.  problem is xelatex was not installed.  Too bad the traceback
> can't be more clear on this.

This sounds like something that can be fixed quite easily in mpl, and 
that if not fixed is likely to trip up other people. Would you turn this 
into a github issue, please?  Or, a PR?

Thank you.

Eric


>
>
>
> --
> Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
> • 3 signs your SCM is hindering your productivity
> • Requirements for releasing software faster
> • Expert tips and advice for migrating your SCM now
> http://p.sf.net/sfu/perforce
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Set sharex and sharey on the axes object

2014-05-07 Thread Eric Firing
On 2014/05/07 2:12 PM, Yuxiang Wang wrote:
> Dear all,
>
> I was wondering that, is there a method like axes.set_sharex(ax0) so I
> can directly set the sharex and sharey properties of an axes object?
> It seems that the only way to do this is at time of creation via
> fig.add_subplots(1, 2, 2, sharex=ax0). If I have already created the
> axes using the plt.subplots() method, this wouldn't work.
>
> Could anyone please help make sure that I am understanding this
> question correctly?
>

This is correct.  If you use plt.subplots with sharex and/or sharey, the 
sharing applies to all subplots.

Eric

> Thank you!
>
> Shawn


--
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Re-combine different axes to make new figure in matplotlib

2014-05-12 Thread Eric Firing
On 2014/05/11 7:56 PM, Yuxiang Wang wrote:
> Dear all,
>
> I am curious that whether this is possible in matplotlib:
>
> I first create some figures, with subplots.
>
> import matplotlib.pyplot as plt
> fig1, axs1 = plt.subplots(2, 2)
> fig2, axs2 = plt.subplots(2, 2)
>
> And then, could I recombine them, so fig3 is composed of the first row
> in fig1 (i.e., axs1[0, 0] and axs1[0, 1]) and second row in fig2
> (i.e., axs2[1, 0] and axs2[1, 1])?
>
> Currently, all I could do is to re-plot them. I am curious about
> whether there is a way that I can just move axes around and re-combine
> them to make new figures. Thanks!

No, there is no facility for doing this.  The Axes class is always 
initialized with a Figure instance.  The Axes and Figure are quite 
tightly tied together via transforms.

Eric

>
> -Shawn
>
>


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Undefined color model and inconsistencies between backends

2014-05-16 Thread Eric Firing
On 2014/05/16 4:41 PM, Michael Goerz wrote:
> Hi,
>
> While playing around for an afternoon with colors in matplotlib, I came
> across some inconsistencies. I was trying to define colors in sRGB (my
> understanding is that sRGB as a standardized color space is
> device-independent). Giving RGB values to matplotlib, I checked the
> output with a color picker -- Color Maker from the Mac App Store, set
> to the sRGB mode, but the built-in DigitalColor Meter gives the same
> result. It turns out that the colors I see in the output are not what I
> specified. This makes playing around with colors, a bit difficult:
> http://nbviewer.ipython.org/gist/goerz/9aab94f5322d5a457625
> As far as I can tell, Matplotlib does not specify in
> which color model in interprets RGB values (this should ideally be
> stated in the documentation). Also, the output in different backends
> (IPython notebook, and interactive GUI) gave different results. As a
> minimal example, consider the following:

Matplotlib doesn't interpret RGB values; that is left to the display 
device.  Matplotlib simply writes the RGB values in a file, unmodified, 
or sends them via a GUI backend to a display, also unmodified *by mpl*. 
  What you put in, is what it puts out.

Thanks for pointing out the DigitalColor Meter--I hadn't noticed it.

What I see with your example is that the MacOSX backend *display* is 
interpreting RGB as sRGB, and the qt4agg backend *display* is 
interpreting RGB as native values (based on matching with DigitalColor 
Meter).

I haven't tried this with inline plots in the notebook, but mpl is 
merely feeding RGB values to the browser, just as would occur when 
displaying a png, and it is up to the browser to decide how to convert 
them into pixel intensity.

I don't see that there is a bug here.

Eric

>
>  import pylab
>  import numpy as np
>  import matplotlib
>  #%matplotlib inline
>  # draw line with sRGB color 228, 26, 28
>  pylab.plot(np.linspace(0,10, 10), np.linspace(0,20,10), linewidth=10,
> color=(0.894, 0.102, 0.110))
>  pylab.show()
>  # Colorpicker shows 210, 46, 13 in GUI view
>  # Colorpicker shows 229, 39, 27 in iPython Notebook
>
> In the IPython notebook, direct PIL graphics do seem to give the right
> colors cf. In [5] in the linked IPython notebook (even though PIL also
> does not explicitly specify its color model). Just matplotlib seems
> off. Of course, I'm doing some slightly crazy stuff in the Notebook,
> displaying every matplotlib output through PIL, but I cecked that
> `%matplotlib inline` actually produces the same colors.
>
> Should I file this on github as a bug report?
>
> Best,
> Michael
>
> P.S.: please CC for direct replies
>
> --
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] closing of matplotlib.pyplot closes parent window also

2014-05-23 Thread Eric Firing
On 2014/05/22 7:21 PM, Rachana Katkam wrote:
> Hi,
>   I am facing little trouble in understanding the pyplot concept.

Pyplot is designed mainly for interactive work, and for situations where 
no explicit calls to a gui library are needed.  When you do need to work 
directly with a gui library, don't use pyplot; let your explicit gui 
calls control the windows and the mainloop, and use the matplotlib 
object-oriented interface for the actual plotting--in a window supplied 
by the gui.

In the matplotlib/examples directory, check out 
user_interfaces/embedding_in_gtk2.py for an example of using mpl in a 
gui app; note that it does not import pyplot.  It's a very minimal 
example, but it does show how one can put a plot in a figure, which is 
in a canvas, which is in a window.  Everything beyond the figure level 
is via the gtk gui directly.

Eric


>
> The following link describes my problem, please have a look at it:
> http://stackoverflow.com/q/23804957/3218127
>
> Regards,
> Rachana K


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pick markers only but not the connecting line

2014-06-07 Thread Eric Firing
On 2014/06/07, 4:12 PM, C M wrote:
> I had been using a custom function (written originally by Jae-Joon and
> modified a little by me...quite a long time back now) that was working
> to allow point picking of markers, but *not* the line connecting them.
> However, I've now discovered with the help of this list that the
> function I am using has the disadvantage that if there are more than 100
> data points, I can't get the correct index for the picked marker (turned
> out not to be a mpl bug:
> https://github.com/matplotlib/matplotlib/issues/3124).
>
> So I can just use the default pick event, but then the user can pick
> anywhere on the connecting line, which is meaningless in this use--so I
> don't want them to be able to pick on the connecting line.

Why not just execute plot twice, once with the markers, with picking 
activated, and a second time with the line, with picking inactive (the 
default).

Eric

>
> My goal is to have a custom function that will serve *both* purposes:
> allow picking the markers only, not the line, of a set of data of any
> length while returning the correct index of that marker/data point.  But
> the code in the custom function is mostly above my head, was written for
> mpl 0.99 or so, and I don't know how to modify it to get both purposes
> achieved.
>
> I attach the current sample again, with the problematic custom picker
> function, "contains_points()".  Thanks for any suggestions or help.
>
> Che
>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] pick markers only but not the connecting line

2014-06-07 Thread Eric Firing
On 2014/06/07, 5:03 PM, C M wrote:
>
>
>
> On Sat, Jun 7, 2014 at 10:18 PM, Eric Firing  <mailto:efir...@hawaii.edu>> wrote:
>
> On 2014/06/07, 4:12 PM, C M wrote:
>  > I had been using a custom function (written originally by
> Jae-Joon and
>  > modified a little by me...quite a long time back now) that was
> working
>  > to allow point picking of markers, but *not* the line connecting
> them.
>  > However, I've now discovered with the help of this list that the
>  > function I am using has the disadvantage that if there are more
> than 100
>  > data points, I can't get the correct index for the picked marker
> (turned
>  > out not to be a mpl bug:
>  > https://github.com/matplotlib/matplotlib/issues/3124).
>  >
>  > So I can just use the default pick event, but then the user can pick
>  > anywhere on the connecting line, which is meaningless in this
> use--so I
>  > don't want them to be able to pick on the connecting line.
>
> Why not just execute plot twice, once with the markers, with picking
> activated, and a second time with the line, with picking inactive (the
> default).
>
> Eric
>
>
> That is so simple, and I hadn't thought of it at all.  Thank you!  My
> only concerns would be for slowness of plotting if there are a lot of
> points and just code simplicity, and so if there could be some other way
> with a custom function for the picker that would do this, I would
> probably prefer that. But maybe neither of these are particularly
> important concerns.

I think you will find plotting two lines instead of one is not at all 
prohibitive with respect to speed; especially when you are zooming, so 
that the number of points being plotted is not so large.

As for simplicity, two calls to a standard function with almost the same 
arguments beats an arcane special-purpose function!

If you want to make your own picker, though, it looks like you could use 
a slight modification of Line2D.contains(); it would be just a matter of 
copying it and replacing this section

 # Check for collision
 if self._linestyle in ['None', None]:
 # If no line, return the nearby point(s)
 d = (xt - mouseevent.x) ** 2 + (yt - mouseevent.y) ** 2
 ind, = np.nonzero(np.less_equal(d, pixels ** 2))
 else:
 # If line, return the nearby segment(s)
 ind = segment_hits(mouseevent.x, mouseevent.y, xt, yt, 
pixels)


with the code in the first option--that is, without checking the 
_linestyle.  You would also need to remove the first two lines after the 
docstring.

Eric

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


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


Re: [Matplotlib-users] Matplotlib brewer2mpl issue with plotting

2014-06-12 Thread Eric Firing
On 2014/06/12, 1:01 AM, Rachana Katkam wrote:
> Hi all,
>
> I am stuck with plotting that uses brewer2mpl.
> The following link describes my problem, please have a look at it:
>
> http://stackoverflow.com/questions/24181183/matplotlib-brewr2mpl-plotting-issue

The traceback doesn't match the code I find in mpl 1.3.1; I think you 
have hit a bug that has been fixed.  I recommend upgrading.  There have 
been a lot of improvements since 1.0.1.

As a workaround, you could try changing your call to "plt.grid(...)" to 
start with the positional argument True, so it would be

plt.grid(True, axis='y', color='white', linestyle='-', lw=1)

Eric

>
> Regards,
> Rachana K
>
>
>
> --
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Upgrading matplotlib

2014-06-12 Thread Eric Firing
On 2014/06/12, 4:14 AM, Rachana Katkam wrote:
> Hi all,
> I have an issue in upgrading my matplotlib 1.0.1 to 1.3.1
> I am using Fedora, but the command:
> Yum update python-matplotlib is not working.
> My python version is 2.7, is that an issue?
> Is there any way for upgrading matplotlib?

Updating via a linux distro generally won't bring you a new version.

Two options:

1) Install it yourself independently, typically in /usr/local/, 
compiling from source.  This will involve making sure you have some 
build dependencies.  Simply using "pip install matplotlib", or something 
very much like that, might work.

2) Get an entire independent python installation such as Anaconda from 
continuum.io.  This provides an easy way of keeping everything up to 
date.  This is what I recommend unless you really want to learn how to 
build and install software yourself, independently of installers like yum.

Eric

>
> Regards,
> Rachana K
>
>
> --
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] a possible bug report

2014-06-12 Thread Eric Firing
On 2014/06/12, 6:07 AM, M.Rule wrote:
> Hi all,
>
> I haven't been able to find a more official place to report potential
> Matplotlib bugs, so I'm going to describe the issue I'm seeing here.
> Sorry if this is the wrong forum.

This is *exactly* the right place to make a report like this.  It is 
better to start with a message to a wide audience (at least, we hope it 
is a wide audience) such as this list, or maybe stack overflow, to see 
if someone else recognizes the problem.  In many cases, it is not a 
matplotlib bug.  If the response to an email like this does not lead to 
a solution, and the consensus is that it looks like you have hit a real 
bug, *then* file an issue on github.

>
> On my system, it takes matplotlib a very very long time to close plots.
> Sometimes, up to 20 minutes to close a simple figure. Creating new
> figures remains fast. The problem seems to occur only when I've loaded a
> large amount of data in to python ( on the order of 1GB ). I am using
> the current version of Ubuntu and running "ipython --pylab". To
> reproduce on my system, it is sufficient to load a large amount of data,
> create a plot.. any plot, and then try to close it using the little "x"
> at the top right corner of the window. The whole session will freeze for
> an extended period of time. The plot does not have to be complex: a
> hundred datapoints, a thousand, it makes no difference. Since the
> problem only occurs when a large amount of data has been loaded, my
> guess is that there is a problem with how Matplotlib/Pylab/Python is
> trying to free the memory associated with the figure?

This sounds like the problem that prompted another user to propose 
https://github.com/matplotlib/matplotlib/pull/3045, except that your 
case sounds *much* more severe.

Can you reproduce the data loading and plot generation in a script that 
does not have to be run via ipython? And if so, is it still slow?

Is the large amount of data in the form of a very large number of python 
objects?  Is there something odd about the data structure--extreme 
complexity that would make garbage collection take an absurd amount of time?

Since this does sound like the problem addressed by the pull request 
("PR") noted above, please add your report (and any answers to my 
questions) as a comment on that PR.

Eric
>
> So... I just though I'd put this out there in case anyone else sees the
> same issue, or in case a developer who knows why this might be happening
> reads this. The workaround for me is... to simply wait for the figures
> to close, however long that may take, or restart the whole session.
>
> Best,
> michael.
>
>
> --
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Adding a colorbar --- how?

2014-06-15 Thread Eric Firing
On 2014/06/15, 12:17 PM, Virgil Stokes wrote:
> There are some rather nice and useful matplotlib examples for colormaps
> that are shown at:
>
> http://nbviewer.ipython.org/github/dpsanders/matplotlib-examples/blob/master/colorline.ipynb
>
> In*Example 1.  Sine wave colored by time (uses the defaults for
> colorline)*, how can one add a colorbar?

lc = colorline(x, y)
cbar = fig.colorbar(lc)

Eric



>
> --V
>
>
> --
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colors

2014-06-17 Thread Eric Firing
On 2014/06/17, 8:59 AM, Bruno Pace wrote:
> Hi all,
>
> I'm trying to use imshow to plot some values which fall on the interval
> [0,1]. I need to
> use a logscale to emphasize the scales of the data. The solution I found
> checking some discussions was like this
>
> plt.imshow(X, interpolation='none', norm=matplotlib.colors.LogNorm())
>
> However, I notice that the way these colors are assigned are not always
> the same (although my data always contains the minimum value 0.0 and
>   the maximum 1.0). I need to have a coherent color scale to indicate
> the real values. Is it easier to do the color code myself? What is the
> proper way of tackling this problem??

Use the vmin and vmax kwargs to LogNorm, remembering that vmin must be 
greater than zero for a log scale.

Eric

>
> It's pretty much the same problem described here, but with a logscale...
>
> http://stackoverflow.com/questions/7875688/how-can-i-create-a-standard-colorbar-for-a-series-of-plots-in-python
>
>
> Thank you very much!
>
> Bruno
>
>
> --
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colors

2014-06-19 Thread Eric Firing
On 2014/06/18, 5:23 AM, Bruno Pace wrote:
> Ok, so using the norm=SymLogNorm I cannot distinguish the values that
> are exactly 0.0 from the really small ones, right? Would it be possible

Correct, the scale is linear for small values.

> to make use of the set_bad method without having to use masked arrays,
> just combining the SymLogNorm and the set_bad?

No, the mask is what identifies a point as bad.  If you want to 
distinguish zero from non-zero, no matter how small, then this is the 
way to do it.

zm = np.ma.masked_equal(z, 0, copy=False)

Now you have a masked array where the points that are exactly zero are 
masked.

The bad color won't show up on the colorbar, however.  There is no 
suitable place for it.  It can show only the range from vmin to vmax, 
and a "set_over" color for values greater than vmax, and a "set_under" 
color for values less than vmin.

Eric

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to make diagram x_label by time and x_lable can move automatic

2014-06-21 Thread Eric Firing
On 2014/06/21, 3:39 PM, 不坏阿峰 wrote:
> is there someone can help me ?

Posting a *simple*, self-contained example as a starting point would 
make it more likely that someone would understand your question.  Leave 
out everything that is irrelevant--I suspect all the gui and threading 
code is in that category.

Also, although it is not directly related to your question, please note 
that you are using a horrible mixture of backend invocations, and even 
if it works now, it will do you no good in the long run.

See the embedding examples: no matplotlib.use, no pylab, one and only 
one gui toolkit.

I also suspect the answer to your question is at least partly in one of 
the examples of plotting with dates; dates and times are handled 
together.  Here is one such example:

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

Eric

> many thanks
>
>
> 2014-06-19 19:36 GMT+07:00 不坏阿峰  >:
>
> Dear all
>
> could some expert can help me.
> I have modify from one demo. but i do not how to change the x_lable
> to time like H:M:S, and can move it.  i have try some way, but failed.
>
> hope some expert can do me a favor.
> thanks a lot
>
> ##
> # coding=utf-8
> import os
> import pprint
> import random, time
> import sys
> from PyQt4 import QtGui, QtCore
> from threading import *
> import time
> import datetime
>
> import matplotlib
> matplotlib.use('WXAgg')
> from matplotlib.figure import Figure
> from matplotlib.backends.backend_qt4agg import \
>  FigureCanvasQTAgg as FigCanvas, \
>  NavigationToolbar2QT as NavigationToolbar
> import numpy as np
> import pylab
> class DataGen(object):
>  """ A silly class that generates pseudo-random data for
>  display in the plot.
>  """
>  def __init__(self, init=50):
>  self.data = self.init = init
>  def next(self):
>  self._recalc_data()
>  return self.data
>  def _recalc_data(self):
>  delta = random.uniform(-0.5, 0.5)
>  r = random.random()
>  if r > 0.9:
>  self.data += delta * 15
>  elif r > 0.8:
>  # attraction to the initial value
>  delta += (0.5 if self.init > self.data else -0.5)
>  self.data += delta
>  else:
>  self.data += delta
>
> class myThing():
>  class myThread(Thread):
>  def __init__(self):
>  Thread.__init__(self)
>  self.running = True
>  self.vec = [0]
>  self.dg = DataGen()
>
>  print "Initializing myThread..."
>
>  def run(self):
>  print "Running myThread..."
>  while self.running:
>  time.sleep(1)
>  self.vec.append(self.dg.next())
>  print "Splat"
>  def getVec(self):
>  return self.vec
>  def stop(self):
>  self.running = False
>  def __init__(self):
>  self.theThread = self.myThread()
>  self.threadRunning = True
>  print "initializing myThing..."
>  self.theThread.start()
>  def __del__(self):
>  self.theThread.stop()
>  def getVec(self):
>  #print self.theThread.vec[:]
>  return self.theThread.vec[:]
> class ApplicationWindow(QtGui.QMainWindow):
>  """ The main window of the application
>  """
>  def __init__(self):
>  QtGui.QMainWindow.__init__(self)
>  self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
>  self.setWindowTitle('Demo: dynamic matplotlib graph')
>  self.thing1 = myThing()
>  self.thing2 = myThing()
>  self.starttime =  int(time.time())
>
>
>  self.create_menu()
>  #self.create_status_bar()
>  self.create_main_panel()
>  self.redraw_timer = QtCore.QTimer(self)
>  QtCore.QObject.connect(self.redraw_timer,
> QtCore.SIGNAL("timeout()"), self.on_redraw_timer)
>  self.redraw_timer.start(4000)
>  def create_menu(self):
>  menu_file = QtGui.QMenu("&File", self)
>  #menu_file.addAction(u'&Save plot', self.on_save_plot,
>  # QtCore.Qt.CTRL + QtCore.Qt.Key_S)
>  menu_file.addSeparator()
>  menu_file.addAction(u'E&xit', self.on_exit,
>   QtCore.Qt.CTRL + QtCore.Qt.Key_X)
>  self.menuBar().addMenu(menu_file)
>  def create_main_panel(self):
>  self.panel = QtGui.QFrame(self)
>  self.setCentralWidget(self.panel)
>  self.init_plot()
>

Re: [Matplotlib-users] refresh a matplotlib plot when reruning a script

2014-06-28 Thread Eric Firing
On 2014/06/27, 9:59 AM, zunbeltz wrote:
> I have a script that fetchs data from a database and plot using
> something similar to
>
> fig, (ax1, ax3) = plt.subplots(2, 1, sharex=False, sharey=False, num=fignum)
> ax1.errorbar(...)
> title(...)
> ax2 = ax1.twiny()
> ax4 = ax2.twiny()
> ...
> plt.legent()
> plt.draw()
>
> Then, I call this script with plt.ion() and I use plt.show(block=True);
> so the plot stays opened.
>
> Now, I want to rerun the script every second to get the updated data
> from the database. Is it posible to have the plot no blocking the script
> and being refresh?

You might find that plt.pause(1) is helpful.
See pylab_examples/animation_demo.py.

Also, it sounds like running via ipython, if possible, would make things 
easier for you; it takes care of all sorts of difficulties with 
interactivity.  And it's wonderfully helpful in other ways as well.

>
> I try to use block=False but this makes that the plot is not shown. I
> want to change my original script as little as possible. One posible
> idea I have is to pickle the plot (in the original script); and use
> another script that opens the pickled file every second.

That sounds overly complex and roundabout.  I'm sure that one or more of 
the suggestions above can lead to a simple solution.

Eric

>
> TIA
>
> Zunbeltz
> (posted unsuccessfully at stackoverflow)
>
>
> --
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ImportError: No module named 'mpl_toolkits'

2014-07-13 Thread Eric Firing
On 2014/07/13, 12:05 AM, Tommy Carstensen wrote:
> To matplotlib-users,
>
> When I do this on Linux:
> from mpl_toolkits.basemap import Basemap
>
> Then I get this error:
> ImportError: No module named 'mpl_toolkits'

Sounds like it might be a problem with the particular versions of 
matplotlib and basemap; there was a change in the way we handle 
namespace packages like mpl_toolkits.

>
> I also ran apt-get, but I still get the error:
> sudo apt-get install python-mpltoolkits.basemap
>
> What am I doing wrong? I also tried to get it to work on Mac with no luck.

Lots of possibilities, so without looking to see exactly what is on each 
system (Linux and Mac), it is impossible to say what the problem is.

For both systems, one easy solution is to use Anaconda.  Basemap is not 
included in the basic installation, but can be added via "conda install 
basemap".  Recommended.

Eric

>
> Thanks,
> Tommy
>
> --
> ___
> 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] Basic matshow question

2014-07-29 Thread Eric Firing
On 2014/07/29, 7:04 PM, JBB wrote:
> Hello,
>
> I am relatively new to Python, numpy, matplotlib, etc., with a
> reasonable amount of Matlab experience.
>
> I am trying to do some simple array visualizations before moving on to
> specific work.
>
> e.g. I have a 5x5x10 array and I'd like to see each 5x5 piece as a
> "frame" with a short pause in between.  I realize there are animation
> methods and such but I think the  code below ought to work and don't
> understand what I'm getting.
>
> Expect: A figure window with the first 5x5 piece of the array, a short
> pause, a new figure window overwriting the old one with the second 5x5
> piece, and so on. Equivalent code in Matlab does this.
>
> Result:  Figure window opens, nothing gets drawn in it, there's a pause,
> the window closes, and another window opens in the same location with
> nothing in it, and so on.
>
> If I refresh the kernel, create the 3D array, and manually show one
> slice, it works.  As soon as I run the loop, all I get from then on is
> blank windows whether I do it within a loop or type the matshow, show
> commands.
>
> This happens in iPython with and without the notebook interface.
>
> I'm trying to understand Matplotlib in some detail and am watching the
> SciPy2014 videos along with RTFM.
> https://www.youtube.com/watch?v=A2adyFMsut0 et.seq.
>
> So far, I've come up empty in figuring out what I'm doing wrong.
>
> I have Python 2.7.8/Anaconda 2.0.1
>
> Thanks,
>
> JBB
> = Test code
>
> import numpy as np
> from matplotlib.pylab import *
> import time as time
>
> # Create a 3D array of "frames"
> A = np.random.rand(5,5,10)
>
> #Turn on interactive mode
> ion()
> # Turn off interactive mode
> # ioff()
>
> # Attempt to show each frame with a short delay between frames
> for k in range(10):
>   matshow(A[:,:,k])
>   show()
>   time.sleep(1)
>   close()
>

First, at least initially for this sort of thing, run in "ipython 
--pylab", and don't use any "ion()" or "ioff()".

Second, replace the "show(); time.sleep(1)" with "pause(1)".

I think that will do it.

Eric

>
> --
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basic matshow question

2014-07-30 Thread Eric Firing
On 2014/07/30, 7:26 AM, Benjamin Root wrote:
> There is no --pylab for that.

I don't know what development version you are using, but for 2.1.0, it 
is still there--and it does what needs to be done.

--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Region within contour --> 2D array

2014-08-28 Thread Eric Firing
On 2014/08/28, 3:02 AM, Matthew Czesarski wrote:
> Hi Matplotlib Users!
>
>
>
> I have some 2-d arrays, which i am displaying  with implot, and deriving
> contours for with contour.  Easy -  I'm just pulling them out of
> collections[0].get_paths() .
>
> However what's not easy is that I would like to recover a 1-0 or
> True-False array of the array values (pixels) that fall within the
> contours. Some line crossing algorithm/floodfill could do it, but I
> guess that matplotlib's fill() or contourf() must do this under the hood
> anyway. I've looked into the output both functions, but I don't see
> anything obvious..
>
> Does anybody know if there's an a way to pull out a such an array from
> matplotlib?   Any pointers are appreciated!

Make an array of (x, y) pairs from the X and Y you use in your call to 
contour, and then feed that array to the contains_points() method of 
your contour Path.  This will give you the desired Boolean array for any 
given Path; depending on what you want, you might need to combine arrays 
for more than one Path.

To get closed paths, I think you will want to use contourf, not contour.

Eric



>
> Cheers,
> Matt
>
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Build error; Matplotlib 1.4.0 on Ubuntu 12.04, Python 3.2

2014-08-31 Thread Eric Firing
On 2014/08/31, 6:48 PM, John Ladasky wrote:
> Hi folks,
>
> I am trying to install Matplotlib 1.4.0 on an older laptop, running
> Ubuntu 12.04.  I am committed to Python 3.  In the standard Ubuntu
> repositories, python3-matplotlib (of any version) is unavailable until
> Ubuntu 13.04.
>
> My first instinct would be to upgrade to a more current Ubuntu
> revision.  However, when I tried to upgrade Ubuntu, I received a warning
> that the Unity3D GUI was probably too heavy-weight for my machine.

My recommendation is to switch to Xubuntu 14.04 if/when you can manage 
the disruption of doing a clean installation.


> Traceback (most recent call last):
>File "setup.py", line 154, in 
>  result = package.check()
>File "/home/john/Desktop/matplotlib-1.4.0/setupext.py", line 940, in
> check
>  if 'No such file or directory\ngrep:' in version:
> TypeError: argument of type 'NoneType' is not iterable
>

This is a bug in 1.4.0 that has been fixed in 1.4.x.

Eric

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plt.ion() doesn't enable interactive mode when ran as script on mac osx 10.8.5

2014-09-21 Thread Eric Firing
On 2014/09/21, 6:07 AM, Petar Bakalov wrote:
> Using python 2.7.5 and matplotlib 1.4.0 on mac OSX 10.8.5.
>
> The output of the following snippet:
>
> |import  matplotlib.pyplotas  plt
> plt.ion()
> print  "Is interactive:?",  plt.isinteractive()
> |
>
> when ran from shell ($ python snippet.py) is:
>
> Is interactive? : 0
>
> i.e. interactive mode does not work.
>
> I think that this is not the expected behaviour. How can this be fixed?

This is under discussion here: 
https://github.com/matplotlib/matplotlib/issues/3505

Eric


>
> The same code produces
>
> Is interactive? : 1
>
> (i.e. works fine) when ran in an interactive python terminal on the same
> machine.
>
> I installed python using brew and matplotlib using pip.
>
> Best regards,
> Petar
>
> 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013;
> root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
>
>
> --
> Slashdot TV.  Video for Nerds.  Stuff that Matters.
> http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Antialiasing colorbars

2014-09-30 Thread Eric Firing
On 2014/09/30, 2:41 AM, Jesper Larsen wrote:
> Hi matplotlib users,
>
> Is it possible to disable antialiasing for a colorbar? If not directly
> is it the possible to "postprocess" the axes instance to se antialiasing
> for relevant elements?

The colorbar returns a Colorbar object, the "solids" attribute of which 
is a Quadmesh; so you should be able to execute

cbar.solids.set_antialiased(False)

to turn off antialiasing.  With a bit of testing, however, I am not 
seeing any difference, so I'm not sure what is going on, and I don't 
have time now to investigate.

Eric

>
> The reason I am asking is because I would like to produce a paletted png
> (using PIL) of the colorbar without the risk of removing any important
> colors in the process (in essence the output from matplotlib needs to
> have less than 256 colors for this to work).
>
> Best regards,
> Jesper
>
>
> --
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] twinx cla problem

2014-10-10 Thread Eric Firing
On 2014/10/10, 4:45 AM, Duke, Charles wrote:
> With matplotlib 1.4.0 the cla() method for the twinx axes also clears
> the primary axes.  With matplotlib 1.3.1 the method only clears the
> twinx axes as expected.  I have a much longer program where the twinx
> axes must be cleared while retaining the primary axis plot.  I would
> prefer not to replot the entire graph each time the twinx axes change.
>   You can see this by adding the cla method to the matplotlib web site
> example, two_scales.py, shown below.
>
> I have matplotlib installed via the anaconda package. Matplotlib 1.4.0
> is from anaconda 2.1.0.  Matplotlib 1.3.1 is from 1.9 versions of the
> anaconda package.
>
> Linux version:
>
> Linux gamow 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux
>
> Same cla() result on osX 10.9.4.
>
> Same result for backends Qt4Agg and TkAgg;  the cla() method cleared
> both axes.
>
> I also tried various other options such as setting ax2.hold(False) prior
> to replotting  ax2.  However, once again ax1 was cleared.  The ax2 clear
> commands seem to apply to the ax1 axis as well???  These options worked
> as expected  for the earlier matplotlib version, clearing only the ax2 axis.
>
> Here’s the code:  if you execute the code, you should see a blank figure
> with the cla() included and the usual two graphs without the cla() method.
>
> 
>
> import numpy as np
>
> import matplotlib.pyplot as plt
>
> fig, ax1 = plt.subplots()
>
> t = np.arange(0.01, 10.0, 0.01)
>
> s1 = np.exp(t)
>
> ax1.plot(t, s1, 'b-')
>
> ax1.set_xlabel('time (s)')
>
> # Make the y-axis label and tick labels match the line color.
>
> ax1.set_ylabel('exp', color='b')
>
> for tl in ax1.get_yticklabels():
>
>  tl.set_color('b')
>
> ax2 = ax1.twinx()
>
> s2 = np.sin(2*np.pi*t)
>
> ax2.plot(t, s2, 'r.')
>
> ax2.set_ylabel('sin', color='r')
>
> for tl in ax2.get_yticklabels():
>
>  tl.set_color('r')
>
> # single line addition to the two_scales.py example
>
> # clears both ax2 and ax1 under matplotlib 1.4.0, clears only ax2 under
> matplotlib 1.3.1
>
> # obviously, same result with ax2.clear() method
>
> ax2.cla()
>
> plt.show()
>
> I would appreciate any help;  this looks like a bug in the latest
> version of matplotlib.


Charlie,

I agree--it does look like a regression in 1.4.  Would you post it as a 
github issue, please?

Thank you.

Eric

>
> I could not find any reference to this problem in earlier posts.
>
> Thanks,
>
> Charlie
>
>
>
> --
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] Problem extending a custom colormap

2014-11-03 Thread Eric Firing
On 2014/11/03, 2:19 PM, Damien Irving wrote:
> I often like to define my own colormaps using hex strings, e.g.
> hex_list = ['#FFF295', '#FFD555', '#FF850B', '#D55000', '#D5',
> '#550040','#600080', '#80', '#D5', '#0B85FF', '#55AAFF', '#95CAFF']
>
> However, when I pass them to contourf and try to extend the colorbar...
> plt.contourf(x, y, data, colors=hex_list, extend='both')
>
> ... it always ends up that the color of the final segment on the
> extended ends of the colorbar is the same color as the extension segment
> (i.e. the bit in the little arrow). This happens even when hex_list is
> much longer than the actual number of segments required.

You need to use the "levels" kwarg to specify the contour interval 
boundaries, and then your list of colors needs to have a length equal to 
len(levels) + 1.  In other words, the number of colors listed in the 
colors kwarg needs to be *exactly* the number needed to fill between the 
  specified levels, plus one for each requested "extend" direction, if any.

plt.contourf(x, y, data, levels=[0, 1, 2],
  colors=['red', 'blue, 'brown', 'black'],
  extend='both')

That should give you blue and brown for 0-1 and 1-2; with red for 
data<0, and black for data>2.

Eric

>
> Has anyone else had this problem?
>
>
>
> --
>
>
>
> ___
> 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] Development issue: Assign labels to colorbar extensions

2014-11-16 Thread Eric Firing
On 2014/11/16, 10:21 AM, j1 wrote:
> I have posted this in the user sub forum as well because i'm not sure that it
> is a user issue or development issue.
> Information about my problem and my code are here
>
> http://matplotlib.1069221.n5.nabble.com/Assign-labels-to-colorbar-extensions-user-or-development-issue-td44392.html
> 
>
> Is it possible to assign tick labels/values to extensions?

You would have to do it manually; you can put marks and text anywhere 
you want in a matplotlib figure, but there is no mechanism for adding 
ticks to the extensions.  That's simply not what they are for.  They are 
intended only to indicate a single color to which values outside the 
vmin-to-vmax range of the norm are assigned.

>
> If so, how can I do it

It looks like you might be able to achieve what you want *without* using 
extensions, by using a custom colormap and/or norm.  You would extend 
the actual contour levels to include the full range you want "ticked and 
labeled", but you would use the colormap and/or norm to ensure those 
beyond a given range are mapped to the appropriate end color(s).

Eric



--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Single color transparent colormap

2014-11-20 Thread Eric Firing
On 2014/11/19, 1:03 PM, Benjamin Root wrote:
> What you are seeing is the fact that the adjacent cells share the same
> coordinates, so neighboring cells overlap by one pixel. This is only
> visible when alpha != 1. This is a tricky issue to solve, but I could
> have sworn we made some progress on that front by setting "snap" to
> False somewhere. There have been past discussions about it, for sure...

I don't think we ever made any progress; it seems like a problem with 
the renderer itself, agg in this case, and one that differs from one 
renderer to another (e.g., if the plot is saved as pdf and then rendered 
by different libraries).  Try turning off antialiasing.

Eric

>
> Ben Root
>
> On Wed, Nov 19, 2014 at 12:57 PM, Loïc Estève  > wrote:
>
> Thanks for the suggestions, I have tried the easiest one for now,
> namely pcolormesh, see attached plot. The alpha colormap look great
> but I can't seem to figure out how to prevent the edges of the cells
> from being visible. I tried using edgecolors='none' to no avail. I
> guess retrospectively that is similar to the lines we see in the
> colormap on the right.
>
> The snippet I am using:
>
> import numpy as np
>
> import matplotlib.pyplot as plt
> from matplotlib.colors import LinearSegmentedColormap
>
> import matplotlib
>
> matplotlib.rcParams['figure.__facecolor'] = 'white'
>
> cm_dict = {'red':  ((0.0, 1.0, 1.0),
>  (1.0, 1.0, 1.0)),
> 'green': ((0.0, 0.0, 0.0),
>   (1.0, 0.0, 0.0)),
> 'blue':  ((0.0, 0.0, 0.0),
>   (1.0, 0.0, 0.0)),
> 'alpha': ((0.0, 0.0, 0.0),
>   (1.0, 1.0, 1.0))
>}
>
> my_cm = LinearSegmentedColormap('my___cm', cm_dict)
>
> vals = np.tile(np.linspace(-1, 1, 30), (20, 1))
>
> fig = plt.figure()
> ax = plt.pcolormesh(vals, cmap=my_cm)
> plt.colorbar()
> plt.show()
>
> Cheers,
> Loïc
>
>
>
>
> --
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] How to plot other than rectangular grid?

2014-11-21 Thread Eric Firing
On 2014/11/20, 7:11 PM, Maria Liukis wrote:
> Hello,
>
> I have a problem plotting data which is defined on a grid other than
> rectangular mesh, and would greatly appreciate any advise. My data is
> defined for 0.1degree grid for the state of California, and I don’t
> want to interpolate my data outside of the defined grid when plotting
> it. I used pcolormesh() function for rectangular area maps, but it
> only accepts rectangular grid and I was wondering if there is a
> simple solution to my problem.

Masha,

When you say your data "is defined for a 0.1 degree grid", that makes it 
sound like it is on a quadrilateral grid, so there should be no problem 
with using pcolormesh.  Is it on 0.1 degree lon by 0.1 degree lat 
points, but only for points within California?  Then you can make a 
masked array with this grid for a rectangle in which the points outside 
California are masked, and the ones inside are set to your data values. 
  Your X and Y inputs to pcolormesh should be 2-D arrays with the 
boundary values rather than the centers.  It sounds like you would want 
to do all this via mpl_toolkits.basemap.Basemap so that you will end up 
with a properly proportioned and labeled map.

Maybe I am misinterpreting your description of your data, however.

Eric

>
> The only solution I could find was to use
> scipy.interpolate,griddata() to “map” my grid to a bounding
> rectangular grid (bounding rectangle around CA state), but that would
> also interpolate my data to grid cells outside of CA state, which I
> don’t want to do.
>
> Many thanks for any hints! Masha -- liu...@usc.edu
>
>
>

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


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


Re: [Matplotlib-users] multiple plots on single axis

2014-11-27 Thread Eric Firing
On 2014/11/27, 4:55 AM, Bala subramanian wrote:
> Friends,
>
> I want to make multiple graphs on a single axes. As an example, i am
> pasting below an article where it has been shown.
>
> http://www.ncbi.nlm.nih.gov/pubmed/23403925
>
> My plot of interest is *Figure7B*, where multiple distribution are
> depicted in single plot. I want to make a similar one. Kindly give me
> some insights on how i can make it with mpl, if anyone have achieved
> making it with mpl.

Fig 7b is just a set of curves with sequential offsets in x, right?  A 
LineCollection can be nice for this.  See the last panel in 
http://matplotlib.org/examples/api/collections_demo.html.

Eric

>
> Thanks in advance,
> Bala
>
>
> --
> C. Balasubramanian
>


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


Re: [Matplotlib-users] how to prevent colorbar from taking space from axes

2014-12-12 Thread Eric Firing
On 2014/12/12, 5:11 AM, Slavin, Jonathan wrote:
> Hi Ben,
>
> Thanks for those tips.  I ended up giving a list of axes to the ax
> argument of colorbar as you suggested.  That took care of the
> misalignment of the top plots and bottom plots but then the colorbar
> extended the full vertical height of both rows of axes.  Fiddling with
> the shrink and anchor parameter values then got me what I wanted.  I'm
> sure that axis_grid1 could work as well, but my situation is
> sufficiently complicated that I don't want to spend the time fiddling
> with it at this point.

For the record, another way to handle this situation is to use subplot 
parameters to leave adequate room on the right, then use the 
Axes.add_axes() method to make an Axes for the colorbar, and provide it 
as a cax kwarg.

Eric

>
> Regards,
> Jon
>
> On Thu, Dec 11, 2014 at 2:30 PM, Benjamin Root  > wrote:
>
> If you have matplotlib v1.3 (maybe 1.2, I can't remember), you can
> pass a list of axes to the "ax" argument of colorbar, and it should
> steal space equally from all the specified axes.
>
> I am also particularly fond of using the mpl_toolkit axis_grid1,
> which provides you a nice way to preallocate space for colorbars in
> different ways:
> 
> http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html?highlight=axes_grid1#axes-grid1
>
> I hope that helps!
> Ben Root
>
>
> On Thu, Dec 11, 2014 at 1:49 PM, Slavin, Jonathan
> mailto:jsla...@cfa.harvard.edu>> wrote:
>
> Hi,
>
> I'm trying to make a plot with four panes (2x2).  The two on top
> are images, created with pcolormesh, while the ones on the
> bottom are line plots.  I'd like to the axes to line up -- which
> they do -- but when I add a colorbar to the top right, it steals
> space from the image plot.  I only need one colorbar since the
> two images are forced to have the same scaling.  Can anyone tell
> me how to insert the colorbar on the top right without it taking
> space from the top right image -- or force the space to be taken
> from the horizontal space of all the plots so the shapes are
> uniform?  I've tried several approaches including using
> make_axes_locatable from mpl_toolkits.axes_grid1 with no
> success.  I must admit that I don't really understand what
> make_axes_locatable does, so it may be entirely the wrong thing
> to use.  On the other hand, not using it, i.e. just using
> plt.colorbar or fig.colorbar seems to do essentially the same
> thing, steal space from the axes.  The basics of the plot are
> like this:
>
> x = np.arange(20.)
> xc = (x[:-1] + x[1:])/2.
> y = np.arange(15.)
> xx,yy = np.meshgrid(x,y)
> z1 = np.random.randn(14,19)
> z2 = np.random.randn(14,19)
>
> fig,ax = plt.subplots(2,2)
> pc = ax[0,0].pcolormesh(x,y,z1)
> ax[1,0].plot(xc,z1[0,:])
> ax[0,1].pcolormesh(x,y,z2)
> ax[1,1].plot(xc,z2[0,:])
> cb = plt.colorbar(pc, ax=ax[0,1])
> plt.show()
>
> Any help would be appreciated.
>
> Regards,
> Jon
> --
> 
> Jonathan D. Slavin Harvard-Smithsonian CfA
> jsla...@cfa.harvard.edu 
> 60 Garden Street, MS 83
> phone: (617) 496-7981 
> Cambridge, MA 02138-1516
> fax: (617) 496-7577 USA
> 
>
>
> 
> --
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and
> Dashboards
> with Interactivity, Sharing, Native Excel Exports, App
> Integration & more
> Get technology previously reserved for billion-dollar
> corporations, FREE
> 
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> 
> Jonathan D. Slavin Harvard-Smithsonian CfA
> jsla...@cfa.harvard.edu    60 Garden
> Street, MS 83
> phone: (617) 496-7981   Cambridge, MA 02138-1516
> fax: (617) 496-7577USA
> 
>
>
>
> --
> Download BIRT iHub F-Type - 

Re: [Matplotlib-users] matplotlib power spectral density (PSD) value discrepancy

2014-12-17 Thread Eric Firing
On 2014/12/17, 5:37 AM, Thomas Caswell wrote:
> What version of mpl are you using? These functions got a lot of work
> between 1.3 and 1.4.

Tom,

Sorry, I answered only in his parallel github issue. 
https://github.com/matplotlib/matplotlib/issues/3927.  I'm closing it 
now.  The upshot is that psd returns the power but plots it in db.

Eric

>
> I also suspects that there is a normalization issue going on with power
> vs power density.
>
> Tom
>
> On Tue, Dec 16, 2014, 22:28 xkryptor  > wrote:
>
> Hi all,
>
>   I tried calculating the power spectral density using matplotlib
> mlab function psd (). I plotted using two methods:
>
>   1. At first I plot it directly using plt.psd (red line in plot)
>   2. Then I output the values from psd() to variables and plotting the
>  variables (blue line in plot)
>
> The code I used:
>
> power, freqs = plt.psd(P * 10, len(P), Fs = 1 / dt, scale_by_freq=0)
> plt.psd(P * 10, len(P), 1 / dt, scale_by_freq=0)
> plt.plot(freqs, power)
>
> But the plots are different, I expected it to be coincident. From
> where does the discrepancy arise?
>
> Inline image 1
> 
> --__--__--
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration &
> more
> Get technology previously reserved for billion-dollar corporations, FREE
> 
> http://pubads.g.doubleclick.__net/gampad/clk?id=164703151&__iu=/4140/ostg.clktrk
> 
> _
> Matplotlib-users mailing list
> Matplotlib-users@lists.__sourceforge.net
> 
> https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users
> 
>
>
>
> --
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] Plotting maps with matplotlib-basemap very slow

2015-01-24 Thread Eric Firing
On 2015/01/24 6:11 AM, Sappy85 wrote:
> I would like to draw very, very simple maps of only europe in matplotlib /
> basemap, which takes very much time (around 10 seconds!). This is just
> unreal!? Setting of resolution is only "l" (low).
> I need to plot hundreds of those maps every few hours. This would be
> impossible!!? :(
>
> Here is the very simple code:
>
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
>
> m = Basemap(projection='stere',lon_0=5,lat_0=90.0,rsphere=6371200.,\
>
> llcrnrlon=-25.0,urcrnrlon=72.0,llcrnrlat=26.0,urcrnrlat=65.0,resolution='l')
>

You can save a lot of time by pickling the Basemap instance at this 
point, saving it to a cache.  Then the next time, just pickle.load it 
from the cache.

Eric

> m.drawcoastlines(linewidth=0.2)
> m.drawcountries(linewidth=0.2)
> plt.savefig('/var/www/map.png')
>
>
> Hope you can help! :(
>
> Regards
>
>
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Plotting-maps-with-matplotlib-basemap-very-slow-tp44755.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug in matplotlib 1.4.2

2015-02-09 Thread Eric Firing
On 2015/02/09 8:19 AM, Thomas Caswell wrote:
> Can you test with 1.4.3rc1?  I believe this has been fixed.

I don't think so.  I can reproduce it on master.  Regardless of the "ms" 
kwarg, I see only a pixel.

Eric

>
> On Mon Feb 09 2015 at 1:07:28 PM Alex Böhnert  > wrote:
>
> Dear all,
>
> when plotting scattered data with the "," marker, the data points do
> not show up either on screen (Qt4Agg backend) or in saved bitmap
> images (tested with png); they do show up if the plot is exported as
> pdf.
>
> Example code (run in "ipython --pylab" for simplicity):
>
> import numpy as np
> a = np.random.standard_normal(500)
> b = np.random.standard_normal(500)
> plot(a,b,',')
> savefig("testplot.png")
> savefig("testplot.pdf")
>
> Expected result: Scatter plot of random data points, both on screen
> and in saved files.
>
> Actual result: Empty-looking plot both on screen and in png, but
> plot as expected in pdf.
>
> System info: Arch linux, Kernel 3.17.6 (and 3.18.6), matplotlib
> version 1.4.2, Python 3.4.2, IPython 2.3.1., numpy version 1.9.1,
> Qt4Agg backend.
>
> Related: I posted this to the arch-bugtracker
> (https://bugs.archlinux.org/task/43392) and asked on stack overflow
> whether anyone else saw this
> 
> (http://stackoverflow.com/questions/28112916/python-matplotlib-does-not-display-data-points-bug-or-something-else).
> Apparently, the same thing happens in Ubuntu, too.
>
> Hope this is the right place to report this.
>
> Cheers,
> Alex
>
> P.S.: I sent the same mail to the list a few weeks ago without
> registering, but it was never posted, nor replied to. It might be a
> good idea not to suggest at
> http://matplotlib.org/faq/troubleshooting_faq.html#getting-help that
> just sending a mail to the list will achieve anything...
> 
> --__--__--
> 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
>


--
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] Bug in matplotlib 1.4.2

2015-02-09 Thread Eric Firing
On 2015/02/09 8:19 AM, Thomas Caswell wrote:
> Can you test with 1.4.3rc1?  I believe this has been fixed.

Oops!  Of course--I never use ',', and I was forgetting that it *is* 
just one pixel.

Eric

>
> On Mon Feb 09 2015 at 1:07:28 PM Alex Böhnert  > wrote:
>
> Dear all,
>
> when plotting scattered data with the "," marker, the data points do
> not show up either on screen (Qt4Agg backend) or in saved bitmap
> images (tested with png); they do show up if the plot is exported as
> pdf.
>
> Example code (run in "ipython --pylab" for simplicity):
>
> import numpy as np
> a = np.random.standard_normal(500)
> b = np.random.standard_normal(500)
> plot(a,b,',')
> savefig("testplot.png")
> savefig("testplot.pdf")
>
> Expected result: Scatter plot of random data points, both on screen
> and in saved files.
>
> Actual result: Empty-looking plot both on screen and in png, but
> plot as expected in pdf.
>
> System info: Arch linux, Kernel 3.17.6 (and 3.18.6), matplotlib
> version 1.4.2, Python 3.4.2, IPython 2.3.1., numpy version 1.9.1,
> Qt4Agg backend.
>
> Related: I posted this to the arch-bugtracker
> (https://bugs.archlinux.org/task/43392) and asked on stack overflow
> whether anyone else saw this
> 
> (http://stackoverflow.com/questions/28112916/python-matplotlib-does-not-display-data-points-bug-or-something-else).
> Apparently, the same thing happens in Ubuntu, too.
>
> Hope this is the right place to report this.
>
> Cheers,
> Alex
>
> P.S.: I sent the same mail to the list a few weeks ago without
> registering, but it was never posted, nor replied to. It might be a
> good idea not to suggest at
> http://matplotlib.org/faq/troubleshooting_faq.html#getting-help that
> just sending a mail to the list will achieve anything...
> 
> --__--__--
> 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
>


--
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] MultipleLocator and MaxNLocator

2015-02-13 Thread Eric Firing
On 2015/02/13 3:29 PM, Tommy Carstensen wrote:
> Is it possible to combine MultipleLocator and MaxNLocator? One seems
> to erase the effect of the other.

They are for different situations.  MultipleLocator is for when you know 
what you want your tick interval to be; MaxNLocator is for when you 
don't know that, but you do know roughly how many ticks you want, and 
what sort of numerical intervals are acceptable.

Eric


--
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] MultipleLocator and MaxNLocator

2015-02-14 Thread Eric Firing
On 2015/02/14 5:47 AM, Tommy Carstensen wrote:
> Thanks for you answer Eric. I had to get some sleep before trying out
> things. I currently have the code below, but it does not remove the
> zero value tick. It removes the tick at 5 and 10 however.

What is the effect you are trying to achieve?  How would you describe 
the desired tick placement algorithm?

Eric

>
> import matplotlib.pyplot as plt
> from matplotlib.ticker import MultipleLocator
> fig = plt.figure()
> ax1 = fig.add_subplot(111)
> ax1.xaxis.set_major_locator(MultipleLocator(5))
> xticks = ax1.xaxis.get_major_ticks()
> #xticks[0].label1.set_visible(False)
> #xticks[-1].label1.set_visible(False)
> ax1.set_xticks(ax1.get_xticks()[1:-1])
> ax1.plot(list(range(11)))
> plt.show()
>
> On Sat, Feb 14, 2015 at 2:01 AM, Eric Firing  wrote:
>> On 2015/02/13 3:29 PM, Tommy Carstensen wrote:
>>> Is it possible to combine MultipleLocator and MaxNLocator? One seems
>>> to erase the effect of the other.
>>
>> They are for different situations.  MultipleLocator is for when you know
>> what you want your tick interval to be; MaxNLocator is for when you
>> don't know that, but you do know roughly how many ticks you want, and
>> what sort of numerical intervals are acceptable.
>>
>> Eric
>>
>>
>> --
>> 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] MultipleLocator and MaxNLocator

2015-02-14 Thread Eric Firing
On 2015/02/14 7:33 AM, Tommy Carstensen wrote:
> Thanks again Ryan. That's exactly what I want to achieve; i.e. remove
> the tick at 0 and only keep 5 and 10. Your solution works, but it's a
> bit of hack to use magic constants. I could however get those values
> from the xlim.
>
> Eric, I would describe the desired tick placement algorithm as
> removing the first tick on the axis. It can be achieved like this:
> ax1.xaxis.set_major_locator(MaxNLocator(prune='lower'))

Aha! The problem is that the MaxNLocator is the only one with the prune 
kwarg.  It could be added to the MultipleLocator.  For now, though, you 
can make your own specialized Locator, hardwired to omit the first tick, 
like this:

from matplotlib.ticker import MultipleLocator

class TrimmedMultipleLocator(MultipleLocator):
 def tick_values(self, vmin, vmax):
 return MultipleLocator.tick_values(self, vmin, vmax)[1:]

then just use

ax1.xaxis.set_major_locator(TrimmedMultipleLocator(5))

I haven't tested it--but give it a try.  What it is doing is making a 
subclass of MultipleLocator, and altering only the one little bit of its 
behavior that you want to modify.  Everything else is automatically 
inherited from the base class, MultipleLocator.

Eric


>
> But that then overrides this:
> ax1.xaxis.set_major_locator(MultipleLocator(5))
>
> On Sat, Feb 14, 2015 at 5:27 PM, Ryan Nelson  wrote:
>> Tommy, (Sorry for the doubleup. I just realized I forgot to hit reply-all.)
>>
>> Do you want to remove the tick at 0 and only have 5,10, etc.? Could you just
>> do something like this instead:
>>
>> import matplotlib.pyplot as plt
>> from matplotlib.ticker import MultipleLocator
>> fig = plt.figure()
>> ax1 = fig.add_subplot(111)
>> ax1.set_xticks(range(5,11,5))
>> ax1.plot(range(11))
>> plt.show()
>>
>> Ryan
>>
>>
>> On Sat, Feb 14, 2015 at 10:47 AM, Tommy Carstensen
>>  wrote:
>>>
>>> Thanks for you answer Eric. I had to get some sleep before trying out
>>> things. I currently have the code below, but it does not remove the
>>> zero value tick. It removes the tick at 5 and 10 however.
>>>
>>> import matplotlib.pyplot as plt
>>> from matplotlib.ticker import MultipleLocator
>>> fig = plt.figure()
>>> ax1 = fig.add_subplot(111)
>>> ax1.xaxis.set_major_locator(MultipleLocator(5))
>>> xticks = ax1.xaxis.get_major_ticks()
>>> #xticks[0].label1.set_visible(False)
>>> #xticks[-1].label1.set_visible(False)
>>> ax1.set_xticks(ax1.get_xticks()[1:-1])
>>> ax1.plot(list(range(11)))
>>> plt.show()
>>>
>>> On Sat, Feb 14, 2015 at 2:01 AM, Eric Firing  wrote:
>>>> On 2015/02/13 3:29 PM, Tommy Carstensen wrote:
>>>>> Is it possible to combine MultipleLocator and MaxNLocator? One seems
>>>>> to erase the effect of the other.
>>>>
>>>> They are for different situations.  MultipleLocator is for when you know
>>>> what you want your tick interval to be; MaxNLocator is for when you
>>>> don't know that, but you do know roughly how many ticks you want, and
>>>> what sort of numerical intervals are acceptable.
>>>>
>>>> Eric
>>>>
>>>>
>>>>
>>>> --
>>>> 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/
>>> ___

Re: [Matplotlib-users] MultipleLocator and MaxNLocator

2015-02-14 Thread Eric Firing

On 2015/02/14 8:45 AM, Tommy Carstensen wrote:

Erik, that doesn't seem to work either. I tried this:

import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
class TrimmedMultipleLocator(MultipleLocator):
  def tick_values(self, vmin, vmax):
  return MultipleLocator.tick_values(self, vmin, vmax)[2:]
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.xaxis.set_major_locator(TrimmedMultipleLocator(5))
#xticks[0].label1.set_visible(False)
#xticks[-1].label1.set_visible(False)
#ax1.set_xticks(ax1.xaxis.get_major_ticks()[1:-1])
ax1.plot(list(range(21)))
plt.show()


Are you sure?  I tried it, and it works for me.  See attached script and 
output.


Eric



test_loc.pdf
Description: Adobe PDF document
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator

class TrimmedMultipleLocator(MultipleLocator):
 def tick_values(self, vmin, vmax):
 return MultipleLocator.tick_values(self, vmin, vmax)[2:]

fig, ax1 = plt.subplots()
ax1.xaxis.set_major_locator(TrimmedMultipleLocator(5))
ax1.plot(list(range(21)))

fig.savefig('test_loc.pdf')
--
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] MultipleLocator and MaxNLocator

2015-02-14 Thread Eric Firing
On 2015/02/14 9:15 AM, Tommy Carstensen wrote:
> Eric, it works if I do:
>   return MultipleLocator.tick_values(self, vmin, vmax)[2:]
>
> But not if I do as first suggested by you:
>   return MultipleLocator.tick_values(self, vmin, vmax)[1:]
>

Are you using my test script but getting a different result?  If not, 
what is the difference in your test script?

> I don't understand this behaviour. It should be [1:]. I'll just set
> the ticks manually. Seems to be the easiest thing. It would be
> awesome, if MPL had the same behaviour as gnuplot, which allows me to
> simply do:
> set xtics , 

def xtics(ax, start, incr):
 stop = ax.dataLim.x1 + 0.01 * incr
 ax.xaxis.set_ticks(np.arange(start, stop, incr))


Now invoke that function *after* all your plot calls, so that the 
dataLim bounding box includes all the data in your plot.

Eric

--
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] Trouble getting colormap set_under and set_over to work with PolyCollection

2015-02-17 Thread Eric Firing
On 2015/02/17 12:24 PM, Luke Lee wrote:
> It's been suggested to on the above tracker to use imshow.  However, that
> doesn't address the issue I'm having using PolyCollection.

I don't think this has anything to do with PolyCollection versus Image, 
and I was not suggesting that you use imshow.  What I am suggesting is 
that you take my example and make the minimal changes required to 
convert it back to using your PolyCollection; or go the other way. I 
think the key point is the call to the colorbar method.

Eric

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


Re: [Matplotlib-users] quiverkey() doesn't plot the reference vector?

2015-02-18 Thread Eric Firing
On 2015/02/18 9:52 AM, njs wrote:
> Hi All,
>
> I'm having issues with quiver, and quiverkey() although, I have never
> experienced these issues in the past.  I attached an image to this post that
> demonstrates that quiver_key() used to work for me, this image was generated
> on 17-Jul-2014.  However, if I run this exact same code (see below for the
> code), the quiver key reference on the top right does not get plotted, but
> the text will.  I haven't changed anything, but I think there have been some
> package updates between then and now.  For what it's worth, I've tried many
> different ways to generate the quiverkey() and haven't had any luck.  Has
> anyone else experienced similar issues?

That's alarming!  I can reproduce the problem even with the standard mpl 
example--the arrow is missing in 5 out of the 6 plots.  I will file a 
github issue.  Thanks for the report.

Eric

>
> Thanks for any insights!
>
> Working quiverkey():
> 
>
> quiverkey() doesn't work anymore...:
> 
>
> Code:
>
>  fig = plt.figure(figsize=(12,12))
>  map = Basemap(projection = 'cyl', llcrnrlat = -30, urcrnrlat = 90, \
>  llcrnrlon = 0, urcrnrlon = 360, resolution = 'c')
>  [x,y] = N.meshgrid(lons,lats)
>  [x,y] = map(x,y)
>  [xulr,yulr] = N.meshgrid(lons1,lats1)
>  [xulr,yulr] = map(xulr,yulr)
>  clevs = N.arange(-50,51,5)
>  cs = map.contourf(x,y,hgt500aComp[lag,:,:],cmap='RdBu_r',
>  levels = clevs)
>  cs1 = map.contour(x,y,hgt500Comp[lag,:,:],N.arange(1110,1230,6), \
>  colors='purple',linewidth=100,linestyle = 'dashed')
>  cs1 = map.contour(x,y,hgt500aComp[lag,:,:],levels = clevs,
>  colors = 'black')
>
> colors=[(244,2,255),(36,26,232),(255,255,255),(8,232,61),(224,255,0)]
>  cmap = mF.make_cmap(colors, position=None, bit=True)
>  clevs = N.arange(-30,30.025,.025)
>  cs2 = map.contourf(xulr,yulr,olrComp[lag,:,:],cmap=cmap,
>  levels = clevs)
>  Q = map.quiver(x[::2,::2],y[::2,::2],u850Comp[lag,::2,::2],
>  v850Comp[lag,::2,::2],width = 0.002,scale = 50)
>  map.drawcoastlines(linewidth = 1)
>  map.drawcountries(linewidth = 0.5)
>  map.fillcontinents(zorder = 0)
>  map.drawmeridians(N.arange(0,360,30))
>  map.drawparallels(N.arange(-90,90,30))
>  title = plt.title('Lag: {0} | Transition Cases | n =
> {1}'.format(lag-30,len(cases)))
>  title.set_fontweight('bold')
>  axt = fig.add_axes([.15,.35,.3,.01])
>  cbar = plt.colorbar(cs,cax = axt,orientation = 'horizontal')
>  cbar.set_label('500-hPa Anomaly (m)')
>  cbar.set_ticks(N.arange(-50,51,25))
>  cs1.clabel(fmt = '%d')
>  axt = fig.add_axes([.58,.35,.3,.01])
>  cbar2 = plt.colorbar(cs2,cax = axt,orientation = 'horizontal')
>  cbar2.set_label(r'OLR Anomaly ($W m^{-2}$)')
>  cbar2.set_ticks(N.arange(-30,31,10))
>  qk = plt.quiverkey(Q,0.95,1.05,1.0,r'1 $m s^{-1}$',labelpos='E')
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/quiverkey-doesn-t-plot-the-reference-vector-tp44968.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] quiverkey() doesn't plot the reference vector?

2015-02-18 Thread Eric Firing
On 2015/02/18 2:00 PM, Thomas Caswell wrote:
> Is this just on master or with 1.4.x?

It's on 1.4.1 and 1.4.2, but not on 1.4.3 or master or 1.4.0.  Therefore 
I won't enter it as an issue.

I don't know what went wrong with this in those two bugfix releases.

Eric

>
> On Wed Feb 18 2015 at 6:00:26 PM Eric Firing  <mailto:efir...@hawaii.edu>> wrote:
>
> On 2015/02/18 9:52 AM, njs wrote:
>  > Hi All,
>  >
>  > I'm having issues with quiver, and quiverkey() although, I have never
>  > experienced these issues in the past.  I attached an image to
> this post that
>  > demonstrates that quiver_key() used to work for me, this image
> was generated
>  > on 17-Jul-2014.  However, if I run this exact same code (see
> below for the
>  > code), the quiver key reference on the top right does not get
> plotted, but
>  > the text will.  I haven't changed anything, but I think there
> have been some
>  > package updates between then and now.  For what it's worth, I've
> tried many
>  > different ways to generate the quiverkey() and haven't had any
> luck.  Has
>  > anyone else experienced similar issues?
>
> That's alarming!  I can reproduce the problem even with the standard mpl
> example--the arrow is missing in 5 out of the 6 plots.  I will file a
> github issue.  Thanks for the report.
>
> Eric
>
>  >
>  > Thanks for any insights!
>  >
>  > Working quiverkey():
>  > <http://matplotlib.1069221.n5.__nabble.com/file/n44968/qkey.__png
> <http://matplotlib.1069221.n5.nabble.com/file/n44968/qkey.png>>
>  >
>  > quiverkey() doesn't work anymore...:
>  >
> <http://matplotlib.1069221.n5.__nabble.com/file/n44968/qkey_1.__png
> <http://matplotlib.1069221.n5.nabble.com/file/n44968/qkey_1.png>>
>  >
>  > Code:
>  >
>  >  fig = plt.figure(figsize=(12,12))
>  >  map = Basemap(projection = 'cyl', llcrnrlat = -30,
> urcrnrlat = 90, \
>  >  llcrnrlon = 0, urcrnrlon = 360, resolution =
> 'c')
>  >  [x,y] = N.meshgrid(lons,lats)
>  >  [x,y] = map(x,y)
>  >  [xulr,yulr] = N.meshgrid(lons1,lats1)
>  >  [xulr,yulr] = map(xulr,yulr)
>  >  clevs = N.arange(-50,51,5)
>  >  cs = map.contourf(x,y,hgt500aComp[__lag,:,:],cmap='RdBu_r',
>  >  levels = clevs)
>  >  cs1 =
> map.contour(x,y,hgt500Comp[__lag,:,:],N.arange(1110,1230,6)__, \
>  >
> colors='purple',linewidth=100,__linestyle = 'dashed')
>  >  cs1 = map.contour(x,y,hgt500aComp[__lag,:,:],levels = clevs,
>  >  colors = 'black')
>  >
>  >
> colors=[(244,2,255),(36,26,__232),(255,255,255),(8,232,61),__(224,255,0)]
>  >  cmap = mF.make_cmap(colors, position=None, bit=True)
>  >  clevs = N.arange(-30,30.025,.025)
>  >  cs2 = map.contourf(xulr,yulr,__olrComp[lag,:,:],cmap=cmap,
>  >  levels = clevs)
>  >  Q =
> map.quiver(x[::2,::2],y[::2,::__2],u850Comp[lag,::2,::2],
>  >  v850Comp[lag,::2,::2],width = 0.002,scale = 50)
>  >  map.drawcoastlines(linewidth = 1)
>  >  map.drawcountries(linewidth = 0.5)
>  >  map.fillcontinents(zorder = 0)
>  >  map.drawmeridians(N.arange(0,__360,30))
>  >  map.drawparallels(N.arange(-__90,90,30))
>  >  title = plt.title('Lag: {0} | Transition Cases | n =
>  > {1}'.format(lag-30,len(cases))__)
>  >  title.set_fontweight('bold')
>  >  axt = fig.add_axes([.15,.35,.3,.01])
>  >  cbar = plt.colorbar(cs,cax = axt,orientation = 'horizontal')
>  >  cbar.set_label('500-hPa Anomaly (m)')
>  >  cbar.set_ticks(N.arange(-50,__51,25))
>  >  cs1.clabel(fmt = '%d')
>  >  axt = fig.add_axes([.58,.35,.3,.01])
>  >  cbar2 = plt.colorbar(cs2,cax = axt,orientation =
> 'horizontal')
>  >  cbar2.set_label(r'OLR Anomaly ($W m^{-2}$)')
>  >  cbar2.set_ticks(N.arange(-30,__31,10))
>  >  qk = plt.quiverkey(Q,0.95,1.05,1.0,__r'1 $m
> s^{-1

Re: [Matplotlib-users] what are the new features of nbagg?

2015-02-18 Thread Eric Firing
On 2015/02/18 6:44 AM, Emilia Petrisor wrote:
> Hi all,
>
> I looked for a link where I could find out what’s new in |matplotlib
> 1.4.3|, but there is no one.
>
> Especially I’m interested in the new features of |nbagg backend|. All I
> know is what I read in an email here, namely that /The nbagg backend is
> looking great - some pretty swish new features/.
> Thanks,
>
> Emilia
>

In a recent IPython, try starting up a notebook and using

%matplotlib nbagg

You will find that the embedded plot is fully interactive, complete with 
a cursor readout and navigation buttons.  I think that's the new part.

Eric



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


Re: [Matplotlib-users] what are the new features of nbagg?

2015-02-18 Thread Eric Firing
On 2015/02/18 2:31 PM, Thomas Caswell wrote:
> Recent means IPython > 2.4.

Did you mean 2.2?  It works on 2.3.

Eric

>
> For 3.0
>
> %matplotlib notebook
>
>   will also work.
>
> Tom
>
> On Wed Feb 18 2015 at 7:25:41 PM Eric Firing  <mailto:efir...@hawaii.edu>> wrote:
>
> On 2015/02/18 6:44 AM, Emilia Petrisor wrote:
>  > Hi all,
>  >
>  > I looked for a link where I could find out what’s new in |matplotlib
>  > 1.4.3|, but there is no one.
>  >
>  > Especially I’m interested in the new features of |nbagg backend|.
> All I
>  > know is what I read in an email here, namely that /The nbagg
> backend is
>  > looking great - some pretty swish new features/.
>  > Thanks,
>  >
>  > Emilia
>  >
>
> In a recent IPython, try starting up a notebook and using
>
> %matplotlib nbagg
>
> You will find that the embedded plot is fully interactive, complete with
> a cursor readout and navigation buttons.  I think that's the new part.
>
> Eric
>
>
>
> 
> --__--__--
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration &
> more
> Get technology previously reserved for billion-dollar corporations, FREE
> 
> http://pubads.g.doubleclick.__net/gampad/clk?id=190641631&__iu=/4140/ostg.clktrk
> 
> <http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk>
> _
> Matplotlib-users mailing list
> Matplotlib-users@lists.__sourceforge.net
> <mailto:Matplotlib-users@lists.sourceforge.net>
> https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users
> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>


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


Re: [Matplotlib-users] axes.get_position() inaccurate until after savefig()?

2015-02-18 Thread Eric Firing
On 2015/02/18 7:51 AM, Ryan Nelson wrote:
> I don't have an answer to your question exactly. But I'll just say that
> this does make sense. The aspect-corrected axes (after show) is a subset
> of what you originally asked for, i.e. the bottom is higher, and the
> height is smaller. My guess is that this is not calculated until the
> final rendering on save on some computational effort. Otherwise, these
> values might need to be recalculated every time you add e.g. a colorbar.
> There is certainly a way to "trick" the plot into rendering, but I
> wonder if you could post a small (maybe two axes) version that
> demonstrates the effect your trying to accomplish. Perhaps someone might
> have a simpler/more robust solution.

There is an Axes method called apply_aspect() that is called by the 
Axes.draw() method.  Normally there is no need to call it before that, 
but I think you could do so.

I think the problem, though, is that until the figure is rendered to a 
real device or saved in a file, its dimensions in inches are not known, 
and apply_aspect needs that information.

Try including the figsize_inches kwarg when you make the figure, and 
then see if calling apply_aspect makes the position settle down to its 
final value.

Eric

>
> Ryan
>
> On Wed, Feb 18, 2015 at 4:27 AM, gdm  > wrote:
>
> New matplotlib user here.  Sometimes I like to make figures with
> multiple
> axes, and have lines that cross multiple axes.  I've run in to
> problems with
> coordinates when doing this.  One such problem is that
> axes.get_position()
> seems to return incorrect coordinates for an axes with a fixed
> aspect ratio.
> However, after calling pyplot.show()  (or fig.savefig()), it returns the
> correct coordinates.
>
> Here is some example code:
> #
> import numpy
> import matplotlib.pyplot as plt
>
> # make up some data
> x = numpy.arange(10)
> y = numpy.sin(x)
> y2 = numpy.cos(x)
>
> # generate the figure
> fig = plt.figure()
>
> # setup the first axes
> ax1 = fig.add_subplot(121)
> plt.plot(x,y)
>
> # setup the second axes with axis ratio
> ax2 = fig.add_subplot(122, aspect=6)
> plt.plot(x, y2)
>
> # Print out the axes position after various operations
> print "aaa", ax2.get_position()
>
> plt.draw()
> print "bbb", ax2.get_position()
>
> fig.canvas.draw()
> print "ccc", ax2.get_position()
>
> plt.show(block=False)
> print "yyy", ax2.get_position()
> ##
>
> Running this code produces the following output:
> aaa Bbox('array([[ 0.54772727,  0.1   ],\n   [ 0.9   ,  0.9
> ]])')
> bbb Bbox('array([[ 0.54772727,  0.1   ],\n   [ 0.9   ,  0.9
> ]])')
> ccc Bbox('array([[ 0.54772727,  0.1   ],\n   [ 0.9   ,  0.9
> ]])')
> yyy Bbox('array([[ 0.54772727,  0.18686869],\n   [ 0.9   ,
> 0.81313131]])')
>
> P.S.: I think this might be related to an issue noted here:
> 
> http://stackoverflow.com/questions/11900654/get-position-does-strange-things-when-using-a-colorbar
>
>
>
>
>
> --
> View this message in context:
> 
> http://matplotlib.1069221.n5.nabble.com/axes-get-position-inaccurate-until-after-savefig-tp44954.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> 
> --
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration &
> more
> Get technology previously reserved for billion-dollar corporations, FREE
> 
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from A

Re: [Matplotlib-users] Problems with pyplot and cm in Matplotlib ver. 1.4.3

2015-02-21 Thread Eric Firing
On 2015/02/21 5:32 PM, Starfighter wrote:
> Per request my question is being resubmitted here.
>
> I'm attempting to generate contour and a color map in Matplotlib ver. 1.4.3
> on a MacBook Pro under Mac OS X ver. 10.10.2 in Python 2.7.3 with the
> Anaconda environment.
>
> A zip file has been attached to this note. Two sub-directories,
> mathplotlib_1.4.3 and mathplotlib_1.1.1rc are included.
>
> mathplotlib_1.4.3 contains the python script that generates the contour and
> color map plots, jpeg files showing the resultant plots and the input data.
>
> mathplotlib_1.1.1rc contains the screen snaps (jpeg files) showing the
> correct contour and color map plots generated by the same python script and
> input data under Linux2 using Python 2.7.3 and Matplotlib 1.1.1rc.
>
> The questions I have include:
> 1. What are the differences between Matplotlib vers. 1.1.1rc and 1.4.3?

Well, you just found one of them.  You should be able to find most 
substantial changes in http://matplotlib.org/users/whats_new.html.

> 2. What is going on where?

The plt.axis('scaled') call is freezing the xlim and ylim at values 
resulting from a call to "nonsingular", which is handling the fact that 
when you call axis(), nothing has been plotted and there is no 
information about what you want the limits to be.  In addition, 'scaled' 
is one of the axis options that turns off autoscaling.  It has always 
been intended to be called *after* plotting with autoscaling on, or 
otherwise setting the xlim and ylim to the desired values.  I don't know 
why it worked for you in 1.1.1rc; I think it was long before this that 
it had the behavior of turning off autoscaling, but I haven't checked.

> 3. How can I fix this problem?

Put the "plt.axis('scaled')" line after your pcolor or plot line.

As a side note, in general pcolormesh will yield the same result as 
pcolor, but *much* faster, so it is recommended in most cases.

Eric
>
>
> Please advise.
>
>
>
>
> mathplotlib_issues.zip
> 
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Problems-with-pyplot-and-cm-in-Matplotlib-ver-1-4-3-tp45002p45004.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


Re: [Matplotlib-users] Plotting style

2015-03-05 Thread Eric Firing
On 2015/03/05 6:11 AM, Marin GILLES wrote:
> Hello everyone,
> After working a bit on the styles, I noticed that some parameters could
> not be modified using an rc or style file (for example, turning off the
> right, left, up or down axis). I kind of saw how to do it using the
> |Axis.spine.set_visible()| method, but it would be better to be able to
> change it in the rc.
> So I was wondering if there would be a way to add rcParameters using a
> method with an external file, or if I would have to change this in the
> mpl source?
> Maybe a method that would add rcParameters on demand…
> Thanks

Marin,

The sort of capability you are describing here is not possible with the 
present architecture.

Eric

--
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] Multiplot with one colorbar

2015-03-06 Thread Eric Firing
On 2015/03/05 11:36 PM, Dyah rahayu martiningrum wrote:
> Hello all,
>
> I make multi plot with colorbars. I need help, how do make only one
> colorbar for six panels? I also want to show only lowest x-axis. I copy
> my recent code and  figure here.

An old example of something like this is here:

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

Eric

--
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] Plotting style

2015-03-09 Thread Eric Firing
On 2015/03/09 8:14 PM, Marin GILLES wrote:
> Hi,
> As suggested in PR 2702
> , I have been trying
> to tell |scatter| to |get_current_color_cycle| for the facecolor. I
> guess I can use |axes.get_color()|to get the current color in the color
> cycle.
> However, I was not able to try this, as when I try to import pyplot I
> get an |ImportError: No module named _path|. It seems to be library
> related, but I’m not quite sure how I can solve this…

It sounds like your installation is broken; _path is an extension module 
compiled from C++, and central to matplotlib's functionality.

In what environment are you working?  Did this failure arise after you 
modified code and then executed "python setup.py install" or something 
of that sort?

Eric

--
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] Plotting style

2015-03-10 Thread Eric Firing
On 2015/03/09 8:56 PM, Marin GILLES wrote:
> Actually, I just brute loaded mpl for source... I am not really used to it.
> So I guess I'll have to make a virtual env and install mpl in it?

You have to build and install it somewhere, where it will be found when 
you try to import it; whether you use a virtual env is up to you.  I 
managed for years without using virtual envs. Recently I've found them 
quite helpful, but a bit tricky and confusing at times.

Eric

--
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] Wind barb plot for a single station data

2015-03-25 Thread Eric Firing
On 2015/03/25 7:08 AM, Foehn wrote:
> Hello all,
>
> the routine barbs(x,y,u,v) in basemap plots a regular 2-dimensional
> vector field for a geographic projection.
>
> What I want is a barb-routine that plots single station wind data (and
> not fields!) at their approriate lat,lon or x,y-position like in a
> station plot on a synoptic weather-chart. I googled and searched a
> while, but I could not find a solution within basemap for that.

There is no requirement that the arguments be on a grid; x, y, u, and v 
can simply be 1-D arrays with the desired locations and values.

basemap's barbs is a mapping wrapper around matplotlib's Axes.barbs() 
method, so you can use either one depending on whether you want to plot 
on a map projection or on some other x,y coordinates.

Eric

>
> Can you help me?
>
>
> Thanks, Foehn
>
> --
> 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] sharex with one figure aspect = 1.0

2015-04-08 Thread Eric Firing
On 2015/04/08 7:04 AM, Jody Klymak wrote:
> Following up on this, I’d like to complain about set_aspect()…
>
> If I do:
>
> import matplotlib.pyplot as plt
> fig, axes = plt.subplots(nrows=2,sharex=True)
> axes[0].set_ylim(0,1.)
> axes[0].set_aspect(1.)
> plt.show()
>
> the x-axis goes from 0. to 1., but axes[0]’s y-axis goes from 0.32 to
> 0.67.  Swapping the order of the y_lim call doesn’t help.  This is very
> un-intuitive, as I’d expect set_ylim() to set what data I see no matter
> what else is happening w/ the plot.
>
> I see that
> axes[0].set_aspect(1.,adjustable=‘box-forced’)
> will give the desired behaviour, but I really think it should be the
> default, not adjustable=‘datalim'.  I had no idea set_aspect() had this
> parameter until today, and have had several cursing matches with
> set_aspect as it kept changing my explicitly set data limits. set_ylim()
> should set the y limits.
>
> Just my opinion.  Maybe there is a reason for the default, but I really
> think the data view should be prioritized over the shape of the axis.

Jody,

I'm the guilty party for most of how set_aspect works.  I developed it a 
long time ago. Yes, there was a reason--still is, I'm 99% sure--but I 
don't remember everything, and don't want to take the time now to 
reconstruct the whole rationale.  When I was developing the behavior, I 
was paying a lot of attention to what happens under various scenarios of 
resizing and reshaping the window, and turning options on and off. 
There are some basic conflicts that arise when shared axes are combined 
with fixed aspect ratios, autoscaling, and gui-driven reshaping. 
Sometimes 'box-forced' does what people want, maybe more often than not; 
but I'm pretty sure it can lead to trouble, which is the reason it is 
not the default.

Eric

>
> Thanks,   Jody
>


--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Eric Firing
On 2015/04/08 7:04 AM, Jody Klymak wrote:
> Maybe there is a reason for the default, but I really think the data
> view should be prioritized over the shape of the axis.

I forgot to include: I was trying to make everything sane (and 
reversible) under zoom and pan as well as reshaping and resizing.

--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Eric Firing
On 2015/04/08 8:43 AM, Jody Klymak wrote:
> Hi Eric,
>
>> On 8 Apr 2015, at  11:02 AM, Eric Firing  wrote:
>>
>> I'm the guilty party for most of how set_aspect works.  I developed it a
>> long time ago. Yes, there was a reason--still is, I'm 99% sure--but I
>> don't remember everything, and don't want to take the time now to
>> reconstruct the whole rationale.  When I was developing the behavior, I
>> was paying a lot of attention to what happens under various scenarios of
>> resizing and reshaping the window, and turning options on and off.
>> There are some basic conflicts that arise when shared axes are combined
>> with fixed aspect ratios, autoscaling, and gui-driven reshaping.
>> Sometimes 'box-forced' does what people want, maybe more often than not;
>> but I'm pretty sure it can lead to trouble, which is the reason it is
>> not the default.
>
> OK, first my apologies:
>
> import matplotlib.pyplot as plt
> fig, axes = plt.subplots(nrows=2)
> axes[0].set_aspect(1.)
> axes[0].plot(np.arange(10),np.arange(10))
> axes[0].set_ylim([0,24])
> axes[0].set_xlim([0,12])
> axes[1].plot(np.arange(10),np.arange(10)*2.)
> plt.show()
>
> Works as I'd expect.  axes[0] gets shrunk in the x dimension to make the 
> aspect ratio 1.
>
> However:
>
> import matplotlib.pyplot as plt
> fig, axes = plt.subplots(nrows=2,sharex=True)
> axes[0].set_aspect(1.)
> axes[0].plot(np.arange(10),np.arange(10))
> axes[0].set_ylim([0,24])
> axes[0].set_xlim([0,12])
> axes[1].plot(np.arange(10),np.arange(10)*2.)
> plt.show()
>
> does not work as I'd expect.  axes[0]'s ylim gets changed so that the line is 
> no longer viewable (= 10-14).  In my opinion, the two calls should work the 
> same, except in the second case, axes[1]'s xlim should be 0-12.
>

If you leave out the set_ylim call, it works.  Given that you have 
specified set_ylim[0, 24], how is mpl supposed to know what ylim range 
you really want, when the axis constraint means it can only plot a small 
part of the specified range?  Basically, you have set up conflicting 
constraints, and mpl failed to resolve the conflict the way you think it 
should have.  Maybe that could be improved, but I warn you, it's a 
tricky business.  Squeeze in one place and things pop out somewhere else.

Eric

> Even worse, if I use the same aspect ratio in axes[1], they *both* do not 
> show all the data:
>
> axes[0].set_aspect(1.)
>
> It appears here that with sharex=True the shape of the axis no longer becomes 
> mutable when set_aspect() is used, whereas if sharex=False set_aspect() can 
> change the axis shape. I don't see any reason for sharex to foist this 
> behaviour onto set_aspect().
>
> I guess the workaround is don't use sharex=True, but I actually think this is 
> a bug.
>
> Thanks,   Jody
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>


--
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] sharex with one figure aspect = 1.0

2015-04-08 Thread Eric Firing
On 2015/04/08 11:15 AM, Jody Klymak wrote:
> Hi Eric,
>
>>> import matplotlib.pyplot as plt
>>> fig, axes = plt.subplots(nrows=2,sharex=True)
>>> axes[0].set_aspect(1.)
>>> axes[0].plot(np.arange(10),np.arange(10))
>>> axes[0].set_ylim([0,24])
>>> axes[0].set_xlim([0,12])
>>> axes[1].plot(np.arange(10),np.arange(10)*2.)
>>> plt.show()
>>>
>>> does not work as I'd expect.  axes[0]'s ylim gets changed so that the
>>> line is no longer viewable (= 10-14).  In my opinion, the two calls
>>> should work the same, except in the second case, axes[1]'s xlim
>>> should be 0-12.
>>>
>>
>> If you leave out the set_ylim call, it works.  Given that you have
>> specified set_ylim[0, 24], how is mpl supposed to know what ylim range
>> you really want, when the axis constraint means it can only plot a
>> small part of the specified range?
>
> It doesn't for me:
>
> import matplotlib.pyplot as plt
> fig, axes = plt.subplots(nrows=2,sharex=True)
> axes[0].set_aspect(1.)
> axes[0].plot(np.arange(10),np.arange(10))
> axes[1].plot(np.arange(10),np.arange(10)*2.)
> plt.show()
>
> still curtails the y limit in axes[0], in my case from ~2.9 to ~6.1 (see
> attached).

Jody, you told it you want x to go from 0 to 12, and have an aspect 
ratio of 1.  It is doing exactly that.  Are you expecting it to override 
your xlim specification?

>
>> Basically, you have set up conflicting constraints, and mpl failed
>> to resolve the conflict the way you think it should have.  Maybe that
>> could be improved, but I warn you, it's a tricky business.  Squeeze in
>> one place and things pop out somewhere else.
>
> I'm not clear what the conflicting constraints are.  There seems to be
> an unspoken one that sharex=True means the physical size of the axes
> must be the same. That constraint doesn't exist if sharex=False, and
> set_aspect() works as expected.  I'm questioning the unspoken
> constraint, and questioning why set_aspect() (or looking at the code
> apply_aspect()) needs to know about shared axes at all.  No doubt there
> is a use case I'm missing...

Yes, sharex=True means the x-axis is identical.  It's shared.  That's 
just what it means, and what it has always meant.  That's what it is 
for--to lock together the x axes of two or more Axes.

>
> I *can* see the issue if we think setting aspect ratios should *not*
> change the size of the axes, because changing the aspect ratio changes
> the data limits and then you have a problem checking all the shared axes
> to see which one has the largest data limits.  Its particularly
> problematic because I think that apply_aspect() is only called at
> draw()-time.  That seems a hard problem, but I'm not sure what the use
> case is for it, so I have trouble wrapping my head around it.

The use case for what--calling apply_aspect at draw time?  That's the 
only time it knows everything it needs to know in the general case, when 
there might be pan/zoom/reshape events.

Eric

>
> Thanks,   Jody
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>
>
>
> --
> 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] I need to force the "rounding" of x axis limits

2015-04-12 Thread Eric Firing
On 2015/04/05 11:19 PM, giacomo boffi wrote:
> INTRO
> =
>
> please consider the following code (I'm trying to draw a timeline)
>
> 1 from matplotlib import pyplot, patches
> 2 fig = pyplot.figure()
> 3 ax = fig.add_subplot('111')
> 4 ax.add_patch(patches.Rectangle((1933,0.25), 73, 0.5))
> 5 pyplot.show()
>
> that gives me a plot with the x axis that goes from 0.0 to 1.0,
> now consider
>
>...
> 5 ax.set_xlim((1933,1933+73))
> 6 pyplot.show()
>
> this gives me an x axis that goes _exactly_ from 1933 to 2006,
> eventually drawing a line superposed to the lower spine
>
>...
> 5 ax.plot((1933,1933+73),(0,0))
> 6 pyplot.show()
>
> gives me what I really want, that is an x axis running from 1930 to
> 2010, with the limits automatically rounded by matplotlib...
>
> (I noted that the extra line forces a rounding also for the y axis
> limits, but that's not a problem...)
>
> QUESTION
> 
>
> I want matplotlib to round the limits of the x axis automatically,
> when given explicitly the lower and upper limits of the data, how to?

I think the initial problem is that ax.add_patch() is not triggering the 
autoscaling that you are looking for; the higher-level plot() function 
does so.  After your call to ax.add_patch(), try adding 
ax.autoscale_view().

Eric


>
> Thank you in advance
>


--
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] Visulization of orthogonal grid

2015-05-06 Thread Eric Firing
On 2015/05/05 6:03 PM, GoogleWind wrote:
> Dear all,
>
> Matplotlib currently support the visuliaztion of triangular mesh and
> square-cell map. Is there any solutions to support the visulization of
> orthogonal grid as follows,
> 

Does pcolormesh do what you need?
http://matplotlib.org/examples/pylab_examples/quadmesh_demo.html
http://matplotlib.org/api/pyplot_api.html?highlight=pcolormesh#matplotlib.pyplot.pcolormesh

Eric

>
> Thanks in advances for your hints.
>
> Best regards,
> Jiacong Huang
> ---
> Nanjing Institute of Geography & Limnology
> Chinese Academy of Sciences
> 73 East Beijing Road, Nanjing 210008, China
> Tel./Fax: +86-25-86882127
> Homepage: http://www.escience.cn/people/elake/index.html
>
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Visulization-of-orthogonal-grid-tp45473.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


  1   2   3   4   5   6   7   8   9   10   >