[Matplotlib-users] Black and white mode

2012-10-02 Thread William Furnass
Did anything ever come of the MPL black and white mode mentioned in
the following?  I rarely want to produce colour plots and having an
inbuilt mechanism for cycling through line styles that can be
activated with a keyword argument would be very handy.

http://www.mail-archive.com/[email protected]/msg00367.html

Cheers,

Will

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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Benjamin Root
On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye  wrote:

> Hi!
>
> I see that the function ax.imshow takes the parameter 'imlim' but in
> the source (status: EPD 7.3-2) it is not being used?
> So what is it for?
>
> Best regards,
> Michael
>
>
>
Confirmed.  I don't see imlim anywhere except in the imshow() signature.  I
have no recollection of this parameter, so it might be from before my time.

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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Damon McDougall
On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root  wrote:
>
>
> On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye  wrote:
>>
>> Hi!
>>
>> I see that the function ax.imshow takes the parameter 'imlim' but in
>> the source (status: EPD 7.3-2) it is not being used?
>> So what is it for?
>>
>> Best regards,
>> Michael
>>
>>
>
> Confirmed.  I don't see imlim anywhere except in the imshow() signature.  I
> have no recollection of this parameter, so it might be from before my time.
>
> Ben Root

Is there some functionality you were looking for or were you just
exploring the codebase?

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

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


Re: [Matplotlib-users] X Window System error

2012-10-02 Thread Mic
Hi Eric,
I have a dataset which contains about 4600 values.

Is it possible to display 4600 values with a bar char and labels?

Thank you in advance.



On Tue, Oct 2, 2012 at 4:04 PM, Eric Firing  wrote:

> On 2012/10/01 7:28 PM, Mic wrote:
> > Hi,
> >
> > I have got the following error with the following code:
> > /$ python mpl.py/
> > /Traceback (most recent call last):/
> > /  File
> > "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk.py",
> > line 398, in expose_event/
> > /self._render_figure(self._pixmap, w, h)/
> > /  File
> >
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py",
> > line 75, in _render_figure/
> > /FigureCanvasAgg.draw(self)/
> > /  File
> > "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> > line 416, in draw/
> > /self.renderer = self.get_renderer()/
> > /  File
> > "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> > line 435, in get_renderer/
> > /self.renderer = RendererAgg(w, h, self.figure.dpi)/
> > /  File
> > "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> > line 72, in __init__/
> > /self._renderer = _RendererAgg(int(width), int(height), dpi,
> > debug=False)/
> > /ValueError: width and height must each be below 32768/
> > /The program 'mpl.py' received an X Window System error./
> > /This probably reflects a bug in the program./
> > /The error was 'BadAlloc (insufficient resources for operation)'./
> > /  (Details: serial 486 error_code 11 request_code 53 minor_code 0)/
> > /  (Note to programmers: normally, X errors are reported asynchronously;/
> > /   that is, you will receive the error a while after causing it./
> > /   To debug your program, run it with the --sync command line/
> > /   option to change this behavior. You can then get a meaningful/
> > /   backtrace from your debugger if you break on the gdk_x_error()
> > function.)/
> >
> > With the following code:
> > /import random /
> > /import matplotlib.pyplot as plt /
> > //
> > /coverages = [random.randint(1,10)*2] * 4605 /
> > /contig_names = ['AAB0008r'] * len(coverages) /
> > /# Set the figure size /
> > /#fig = plt.figure(1, [20, 2]) /
> > /fig = plt.figure(figsize=(int(len(coverages)*0.1), 4)) /
> > //
> > /ax = fig.add_subplot(111) /
> > //
> > /# Set the x-axis limit /
> > /#ax.set_xlim(-1,100) /
> > /ax.set_xlim(0,len(coverages)) /
> > /#ax.set_ylim(0,3) /
> > /ax.yaxis.grid(True, linestyle='-', which='major', color='grey',
> > alpha=0.5) /
> > //
> > /ind = range(len(coverages)) /
> > /rects = ax.bar(ind, coverages, width=0.1, align='center',
> > color='thistle') /
> > /ax.set_xticks(ind) /
> > /#ax.set_xticklabels(contig_names)/
> > /#ax.tick_params(axis='both', which='major', labelsize=10)/
> > /#ax.tick_params(axis='both', which='minor', labelsize=8)/
> > /
> > /
> > /
> > /
> > /#function to auto-rotate the x axis labels/
> > /fig.autofmt_xdate()/
> > /plt.setp(ax.get_xticklabels(), fontsize=8, rotation='vertical')/
> > /plt.show()/
> >
> > How is it possible to get big charts?
>
> It looks like you are trying to make a figure that is 460 inches by 4
> inches.  How do you expect to display or print it?  I think displaying
> it is out of the question, so you would need to use a non-interactive
> backend.  I don't know whether ps or pdf can handle those sorts of
> dimensions.
>
> Eric
>
> >
> > Thank you in advance.
> >
> >
> >
> >
> --
> > Don't let slow site performance ruin your business. Deploy New Relic APM
> > Deploy New Relic app performance management and know exactly
> > what is happening inside your Ruby, Python, PHP, Java, and .NET app
> > Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> > http://p.sf.net/sfu/newrelic-dev2dev
> >
> >
> >
> > ___
> > Matplotlib-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
>
> --
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shir

Re: [Matplotlib-users] Black and white mode

2012-10-02 Thread Benjamin Root
On Tue, Oct 2, 2012 at 8:31 AM, William Furnass  wrote:

> Did anything ever come of the MPL black and white mode mentioned in
> the following?  I rarely want to produce colour plots and having an
> inbuilt mechanism for cycling through line styles that can be
> activated with a keyword argument would be very handy.
>
>
> http://www.mail-archive.com/[email protected]/msg00367.html
>
> Cheers,
>
> Will
>
>
Perhap's Tony Yu's mpltools might be the closest we have gotten to this
goal.  There has been a number of technical hurdles that I have not had the
time or resources to iron out.  Hopefully, it will be helpful to you.

http://tonysyu.github.com/mpltools/getting_started.html

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


Re: [Matplotlib-users] Black and white mode

2012-10-02 Thread Tony Yu
On Tue, Oct 2, 2012 at 11:04 AM, Benjamin Root  wrote:

>
>
> On Tue, Oct 2, 2012 at 8:31 AM, William Furnass wrote:
>
>> Did anything ever come of the MPL black and white mode mentioned in
>> the following?  I rarely want to produce colour plots and having an
>> inbuilt mechanism for cycling through line styles that can be
>> activated with a keyword argument would be very handy.
>>
>>
>> http://www.mail-archive.com/[email protected]/msg00367.html
>>
>> Cheers,
>>
>> Will
>>
>>
> Perhap's Tony Yu's mpltools might be the closest we have gotten to this
> goal.  There has been a number of technical hurdles that I have not had the
> time or resources to iron out.  Hopefully, it will be helpful to you.
>
> http://tonysyu.github.com/mpltools/getting_started.html
>
> Cheers!
> Ben Root
>

Thanks for the advertisement Ben ;)

Will: If you're just interested in grayscale plotting, here's a direct link
to the example:


http://tonysyu.github.com/mpltools/auto_examples/style/plot_grayscale.html

The discussion that you link to talks specifically about line styles. In
the past there's been discussion of adding a linestyle cycle rc param, but
I don't think there's been progress on that front.

BTW, Ben: are you still thinking about some sort of hierarchical
configuration management? I think it'd make a great MEP, if you find the
time.

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


Re: [Matplotlib-users] problems making grayscale lines

2012-10-02 Thread Jonathan Slavin
D'oh! Caught my mistake.  I was thinking of the grayscale backwards.
color = '1.0' is white not black!  Got it working now.

Jon
-- 
__
Jonathan D. Slavin  Harvard-Smithsonian CfA
[email protected] 60 Garden Street, MS 83
phone: (617) 496-7981   Cambridge, MA 02138-1516
 cell: (781) 363-0035   USA
__


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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread K.-Michael Aye


On Oct 2, 2012, at 6:33 AM, Damon McDougall  wrote:

> On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root  wrote:
>> 
>> 
>> On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye  wrote:
>>> 
>>> Hi!
>>> 
>>> I see that the function ax.imshow takes the parameter 'imlim' but in
>>> the source (status: EPD 7.3-2) it is not being used?
>>> So what is it for?
>>> 
>>> Best regards,
>>> Michael
>>> 
>>> 
>> 
>> Confirmed.  I don't see imlim anywhere except in the imshow() signature.  I
>> have no recollection of this parameter, so it might be from before my time.
>> 
>> Ben Root
> 
> Is there some functionality you were looking for or were you just
> exploring the codebase?
> 
How nice of you to ask! ;)
Indeed: I had the case that image arrays inside an ImageGrid where shown with 
some white overhead area around, e.g. for an image of 100 pixels on the x-axis, 
the imshow resulted in an x-axis that went from -10 to 110. I was looking for a 
simple way to suppress that behavior and let imshow instead use the exact image 
extent. I believe that the plot command has such a flag, hasn't it? (I.e. to 
use the exact xdata range and not try to beautify the plot?

Michael


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

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


[Matplotlib-users] problems making grayscale lines

2012-10-02 Thread Jonathan Slavin
Hi all,

I'm trying to make a plot with several lines, each with a different
grayscale color.  I thought I could do something like 
clrs = ['0.125', '0.25', '0.375', '0.5', '0.625', '0.75', '0.875',
'1.0']
and then either set the color cycle using clrs or just use the
color=clrs[i] argument in a loop that draws the lines.  This kind of
works, but it seems that there's some autoscaling going on.  If I use
values ranging from 0 to 1, the curve with 0 doesn't show up at all
(which I would expect) and the curve with 1 is black.  If I use values
ranging from 0.5 to 1, the curve with 0.5 doesn't show up and the curve
with 1 is gray instead of black.  What gives?  How can I get a set of
curves with gray values ranging from medium gray to black?

As a simple demo if I do:
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.cm as cmap

x = np.linspace(0,1.,num=10)
y1 = 0.5*x
y2 = 0.4*x
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(x,y1,color='0.5')
ax.plot(x,y2,color='1.0')
ax.legend(['y1','y2'])

plt.show()

I get a single visible line that is a sort of medium gray.

Jon
-- 
__
Jonathan D. Slavin  Harvard-Smithsonian CfA
[email protected] 60 Garden Street, MS 83
phone: (617) 496-7981   Cambridge, MA 02138-1516
 cell: (781) 363-0035   USA
__


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


Re: [Matplotlib-users] X Window System error

2012-10-02 Thread Eric Firing
On 2012/10/02 4:12 AM, Mic wrote:
> Hi Eric,
> I have a dataset which contains about 4600 values.
>
> Is it possible to display 4600 values with a bar char and labels?
>
> Thank you in advance.

Mic,

I don't think so, as a practical matter.  A screen doesn't even have 
that many pixels of width.

Eric

>
>
>
> On Tue, Oct 2, 2012 at 4:04 PM, Eric Firing  > wrote:
>
> On 2012/10/01 7:28 PM, Mic wrote:
>  > Hi,
>  >
>  > I have got the following error with the following code:
>  > /$ python mpl.py/ 
>  > /Traceback (most recent call last):/
>  > /  File
>  >
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk.py",
>  > line 398, in expose_event/
>  > /self._render_figure(self._pixmap, w, h)/
>  > /  File
>  >
> 
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py",
>  > line 75, in _render_figure/
>  > /FigureCanvasAgg.draw(self)/
>  > /  File
>  >
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
>  > line 416, in draw/
>  > /self.renderer = self.get_renderer()/
>  > /  File
>  >
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
>  > line 435, in get_renderer/
>  > /self.renderer = RendererAgg(w, h, self.figure.dpi)/
>  > /  File
>  >
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
>  > line 72, in __init__/
>  > /self._renderer = _RendererAgg(int(width), int(height), dpi,
>  > debug=False)/
>  > /ValueError: width and height must each be below 32768/
>  > /The program 'mpl.py' received an X Window System error./
>  > /This probably reflects a bug in the program./
>  > /The error was 'BadAlloc (insufficient resources for operation)'./
>  > /  (Details: serial 486 error_code 11 request_code 53 minor_code 0)/
>  > /  (Note to programmers: normally, X errors are reported
> asynchronously;/
>  > /   that is, you will receive the error a while after causing it./
>  > /   To debug your program, run it with the --sync command line/
>  > /   option to change this behavior. You can then get a meaningful/
>  > /   backtrace from your debugger if you break on the gdk_x_error()
>  > function.)/
>  >
>  > With the following code:
>  > /import random /
>  > /import matplotlib.pyplot as plt /
>  > //
>  > /coverages = [random.randint(1,10)*2] * 4605 /
>  > /contig_names = ['AAB0008r'] * len(coverages) /
>  > /# Set the figure size /
>  > /#fig = plt.figure(1, [20, 2]) /
>  > /fig = plt.figure(figsize=(int(len(coverages)*0.1), 4)) /
>  > //
>  > /ax = fig.add_subplot(111) /
>  > //
>  > /# Set the x-axis limit /
>  > /#ax.set_xlim(-1,100) /
>  > /ax.set_xlim(0,len(coverages)) /
>  > /#ax.set_ylim(0,3) /
>  > /ax.yaxis.grid(True, linestyle='-', which='major', color='grey',
>  > alpha=0.5) /
>  > //
>  > /ind = range(len(coverages)) /
>  > /rects = ax.bar(ind, coverages, width=0.1, align='center',
>  > color='thistle') /
>  > /ax.set_xticks(ind) /
>  > /#ax.set_xticklabels(contig_names)/
>  > /#ax.tick_params(axis='both', which='major', labelsize=10)/
>  > /#ax.tick_params(axis='both', which='minor', labelsize=8)/
>  > /
>  > /
>  > /
>  > /
>  > /#function to auto-rotate the x axis labels/
>  > /fig.autofmt_xdate()/
>  > /plt.setp(ax.get_xticklabels(), fontsize=8, rotation='vertical')/
>  > /plt.show()/
>  >
>  > How is it possible to get big charts?
>
> It looks like you are trying to make a figure that is 460 inches by 4
> inches.  How do you expect to display or print it?  I think displaying
> it is out of the question, so you would need to use a non-interactive
> backend.  I don't know whether ps or pdf can handle those sorts of
> dimensions.
>
> Eric
>
>  >
>  > Thank you in advance.
>  >
>  >
>  >
>  >
> 
> --
>  > Don't let slow site performance ruin your business. Deploy New
> Relic APM
>  > Deploy New Relic app performance management and know exactly
>  > what is happening inside your Ruby, Python, PHP, Java, and .NET app
>  > Try New Relic at no cost today and get our sweet Data Nerd shirt too!
>  > http://p.sf.net/sfu/newrelic-dev2dev
>  >
>  >
>  >
>  > ___
>  > Matplotlib-users mailing list
>  > [email protected]
> 
>  > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>  >
>
>
> 
> --
> Don't let slow site performance ruin 

[Matplotlib-users] How to modify the navigation toolbar easily in a matplotlib figure window?

2012-10-02 Thread Jianbao Tao
Is it possible to do something like the following to modify the navigation
toolbar in matplotlib?

   1. Generate a figure window, such as by *fig = figure()*
   2. Get a reference of the navigation toolbar, such as by *tbar =
   fig.get_navigation_toolbar()* or better yet, just by *tbar = fig.navtbar*
   3. Modify the toolbar through the reference *tbar*, such as
   delete/add/edit a button by something like this: *tbar.add_button()*,
*tbar.remove_button(a reference to a button)*,  *tbar.edit_button(a
   reference to a button)*.
   4. Update the figure by *fig.canvas.draw()*

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


[Matplotlib-users] Fwd: imlim in ax.imshow

2012-10-02 Thread Damon McDougall
Forgot to reply all. Sorry.


-- Forwarded message --
From: Damon McDougall 
Date: Tue, Oct 2, 2012 at 7:09 PM
Subject: Re: [Matplotlib-users] imlim in ax.imshow
To: "K.-Michael Aye" 


On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye  wrote:
>
>
> On Oct 2, 2012, at 6:33 AM, Damon McDougall  wrote:
>
>> On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root  wrote:
>>>
>>>
>>> On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye  wrote:

 Hi!

 I see that the function ax.imshow takes the parameter 'imlim' but in
 the source (status: EPD 7.3-2) it is not being used?
 So what is it for?

 Best regards,
 Michael


>>>
>>> Confirmed.  I don't see imlim anywhere except in the imshow() signature.  I
>>> have no recollection of this parameter, so it might be from before my time.
>>>
>>> Ben Root
>>
>> Is there some functionality you were looking for or were you just
>> exploring the codebase?
>>
> How nice of you to ask! ;)
> Indeed: I had the case that image arrays inside an ImageGrid where shown with 
> some white overhead area around, e.g. for an image of 100 pixels on the 
> x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was 
> looking for a simple way to suppress that behavior and let imshow instead use 
> the exact image extent. I believe that the plot command has such a flag, 
> hasn't it? (I.e. to use the exact xdata range and not try to beautify the 
> plot?
>
> Michael
>
>
>> --
>> Damon McDougall
>> http://www.damon-is-a-geek.com
>> B2.39
>> Mathematics Institute
>> University of Warwick
>> Coventry
>> West Midlands
>> CV4 7AL
>> United Kingdom

Is the 'extent' keyword what you're looking for?

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


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

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


Re: [Matplotlib-users] X Window System error

2012-10-02 Thread Damon McDougall
On Tue, Oct 2, 2012 at 6:07 PM, Eric Firing  wrote:
> On 2012/10/02 4:12 AM, Mic wrote:
>> Hi Eric,
>> I have a dataset which contains about 4600 values.
>>
>> Is it possible to display 4600 values with a bar char and labels?
>>
>> Thank you in advance.
>
> Mic,
>
> I don't think so, as a practical matter.  A screen doesn't even have
> that many pixels of width.
>
> Eric
>
>>
>>
>>
>> On Tue, Oct 2, 2012 at 4:04 PM, Eric Firing > > wrote:
>>
>> On 2012/10/01 7:28 PM, Mic wrote:
>>  > Hi,
>>  >
>>  > I have got the following error with the following code:
>>  > /$ python mpl.py/ 
>>  > /Traceback (most recent call last):/
>>  > /  File
>>  >
>> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk.py",
>>  > line 398, in expose_event/
>>  > /self._render_figure(self._pixmap, w, h)/
>>  > /  File
>>  >
>> 
>> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py",
>>  > line 75, in _render_figure/
>>  > /FigureCanvasAgg.draw(self)/
>>  > /  File
>>  >
>> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
>>  > line 416, in draw/
>>  > /self.renderer = self.get_renderer()/
>>  > /  File
>>  >
>> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
>>  > line 435, in get_renderer/
>>  > /self.renderer = RendererAgg(w, h, self.figure.dpi)/
>>  > /  File
>>  >
>> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
>>  > line 72, in __init__/
>>  > /self._renderer = _RendererAgg(int(width), int(height), dpi,
>>  > debug=False)/
>>  > /ValueError: width and height must each be below 32768/
>>  > /The program 'mpl.py' received an X Window System error./
>>  > /This probably reflects a bug in the program./
>>  > /The error was 'BadAlloc (insufficient resources for operation)'./
>>  > /  (Details: serial 486 error_code 11 request_code 53 minor_code 0)/
>>  > /  (Note to programmers: normally, X errors are reported
>> asynchronously;/
>>  > /   that is, you will receive the error a while after causing it./
>>  > /   To debug your program, run it with the --sync command line/
>>  > /   option to change this behavior. You can then get a meaningful/
>>  > /   backtrace from your debugger if you break on the gdk_x_error()
>>  > function.)/
>>  >
>>  > With the following code:
>>  > /import random /
>>  > /import matplotlib.pyplot as plt /
>>  > //
>>  > /coverages = [random.randint(1,10)*2] * 4605 /
>>  > /contig_names = ['AAB0008r'] * len(coverages) /
>>  > /# Set the figure size /
>>  > /#fig = plt.figure(1, [20, 2]) /
>>  > /fig = plt.figure(figsize=(int(len(coverages)*0.1), 4)) /
>>  > //
>>  > /ax = fig.add_subplot(111) /
>>  > //
>>  > /# Set the x-axis limit /
>>  > /#ax.set_xlim(-1,100) /
>>  > /ax.set_xlim(0,len(coverages)) /
>>  > /#ax.set_ylim(0,3) /
>>  > /ax.yaxis.grid(True, linestyle='-', which='major', color='grey',
>>  > alpha=0.5) /
>>  > //
>>  > /ind = range(len(coverages)) /
>>  > /rects = ax.bar(ind, coverages, width=0.1, align='center',
>>  > color='thistle') /
>>  > /ax.set_xticks(ind) /
>>  > /#ax.set_xticklabels(contig_names)/
>>  > /#ax.tick_params(axis='both', which='major', labelsize=10)/
>>  > /#ax.tick_params(axis='both', which='minor', labelsize=8)/
>>  > /
>>  > /
>>  > /
>>  > /
>>  > /#function to auto-rotate the x axis labels/
>>  > /fig.autofmt_xdate()/
>>  > /plt.setp(ax.get_xticklabels(), fontsize=8, rotation='vertical')/
>>  > /plt.show()/
>>  >
>>  > How is it possible to get big charts?
>>
>> It looks like you are trying to make a figure that is 460 inches by 4
>> inches.  How do you expect to display or print it?  I think displaying
>> it is out of the question, so you would need to use a non-interactive
>> backend.  I don't know whether ps or pdf can handle those sorts of
>> dimensions.
>>
>> Eric
>>
>>  >
>>  > Thank you in advance.

If you have that much data, a bar chart is probably not the way to go.
Maybe try taking the height of what would be each bar and using that
as a y-coordinate array then call plt.plot(y)? You'll get a line plot,
and the x axis may not make a huge amount of sense, but at least
you'll see all your data.

Or, perhaps even a histogram?

It's hard to advise without knowing your application, but that should
help at least a little. Good luck!

Best wishes,
Damon

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

--
Don't let slow site performance ruin your business. Deploy New Rel

Re: [Matplotlib-users] How to modify the navigation toolbar easily in a matplotlib figure window?

2012-10-02 Thread Eric Firing
On 2012/10/02 8:08 AM, Jianbao Tao wrote:
> Is it possible to do something like the following to modify the
> navigation toolbar in matplotlib?
>
>  1. Generate a figure window, such as by *fig = figure()*
>  2. Get a reference of the navigation toolbar, such as by *tbar =
> fig.get_navigation_toolbar()* or better yet, just by *tbar =
> fig.navtbar*
>  3. Modify the toolbar through the reference /tbar/, such as
> delete/add/edit a button by something like this:
> *tbar.add_button()*,  *tbar.remove_button(a reference to a button)*,
>   *tbar.edit_button(a reference to a button)*.
>  4. Update the figure by *fig.canvas.draw()*

No, this sort of flexibility has been at least on the mental wish-list 
for a long time, but it is not available.  It would require substantial 
work on all of the gui backends.

Eric

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


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


Re: [Matplotlib-users] How to modify the navigation toolbar easily in a matplotlib figure window?

2012-10-02 Thread Benjamin Root
On Tue, Oct 2, 2012 at 2:34 PM, Eric Firing  wrote:

> On 2012/10/02 8:08 AM, Jianbao Tao wrote:
> > Is it possible to do something like the following to modify the
> > navigation toolbar in matplotlib?
> >
> >  1. Generate a figure window, such as by *fig = figure()*
> >  2. Get a reference of the navigation toolbar, such as by *tbar =
> > fig.get_navigation_toolbar()* or better yet, just by *tbar =
> > fig.navtbar*
> >  3. Modify the toolbar through the reference /tbar/, such as
> > delete/add/edit a button by something like this:
> > *tbar.add_button()*,  *tbar.remove_button(a reference to a button)*,
> >   *tbar.edit_button(a reference to a button)*.
> >  4. Update the figure by *fig.canvas.draw()*
>
> No, this sort of flexibility has been at least on the mental wish-list
> for a long time, but it is not available.  It would require substantial
> work on all of the gui backends.
>
> Eric
>
>
Note, however, code has been improved for the 1.2.0 release to make it
easier to modify the set of buttons that are used.  In backend_bases.py,
look for the NavigationToolbar2 class.

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


Re: [Matplotlib-users] Fwd: imlim in ax.imshow

2012-10-02 Thread Michael Aye
On 2012-10-02 18:10:01 +, Damon McDougall said:

> Forgot to reply all. Sorry.
> 
> 
> -- Forwarded message --
> From: Damon McDougall 
> Date: Tue, Oct 2, 2012 at 7:09 PM
> Subject: Re: [Matplotlib-users] imlim in ax.imshow
> To: "K.-Michael Aye" 
> 
> 
> On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye 
>  wrote:
>> 
>> 
>> On Oct 2, 2012, at 6:33 AM, Damon McDougall 
>>  wrote:
>> 
>>> On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root 
>>>  wrote:
 
 
 On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye 
  wrote:
> 
> Hi!
> 
> I see that the function ax.imshow takes the parameter 'imlim' but in
> the source (status: EPD 7.3-2) it is not being used?
> So what is it for?
> 
> Best regards,
> Michael
> 
> 
 
 Confirmed.  I don't see imlim anywhere except in the imshow() signature.  I
 have no recollection of this parameter, so it might be from before my time.
 
 Ben Root
>>> 
>>> Is there some functionality you were looking for or were you just
>>> exploring the codebase?
>>> 
>> How nice of you to ask! ;)
>> Indeed: I had the case that image arrays inside an ImageGrid where 
>> shown with some white overhead area around, e.g. for an image of 100 
>> pixels on the x-axis, the imshow resulted in an x-axis that went from 
>> -10 to 110. I was looking for a simple way to suppress that behavior 
>> and let imshow instead use the exact image extent. I believe that the 
>> plot command has such a flag, hasn't it? (I.e. to use the exact xdata 
>> range and not try to beautify the plot?
>> 
>> Michael
>> 
>> 
>>> --
>>> Damon McDougall
>>> http://www.damon-is-a-geek.com
>>> B2.39
>>> Mathematics Institute
>>> University of Warwick
>>> Coventry
>>> West Midlands
>>> CV4 7AL
>>> United Kingdom
> 
> Is the 'extent' keyword what you're looking for?

No, because it requires input. I am looking for a boolean switch that 
says something along the lines: Respect the data, not beauty. Show 
exactly like the data is.


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




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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Damon McDougall
On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye  wrote:
>
> On Oct 2, 2012, at 11:09 AM, Damon McDougall  
> wrote:
>
>> On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye  
>> wrote:
>>>
>>>
>>> On Oct 2, 2012, at 6:33 AM, Damon McDougall  
>>> wrote:
>>>
 On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root  wrote:
>
>
> On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye  
> wrote:
>>
>> Hi!
>>
>> I see that the function ax.imshow takes the parameter 'imlim' but in
>> the source (status: EPD 7.3-2) it is not being used?
>> So what is it for?
>>
>> Best regards,
>> Michael
>>
>>
>
> Confirmed.  I don't see imlim anywhere except in the imshow() signature.  
> I
> have no recollection of this parameter, so it might be from before my 
> time.
>
> Ben Root

 Is there some functionality you were looking for or were you just
 exploring the codebase?

>>> How nice of you to ask! ;)
>>> Indeed: I had the case that image arrays inside an ImageGrid where shown 
>>> with some white overhead area around, e.g. for an image of 100 pixels on 
>>> the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I 
>>> was looking for a simple way to suppress that behavior and let imshow 
>>> instead use the exact image extent. I believe that the plot command has 
>>> such a flag, hasn't it? (I.e. to use the exact xdata range and not try to 
>>> beautify the plot?
>>>
>>> Michael
>>>
>>>
 --
 Damon McDougall
 http://www.damon-is-a-geek.com
 B2.39
 Mathematics Institute
 University of Warwick
 Coventry
 West Midlands
 CV4 7AL
 United Kingdom
>>
>> Is the 'extent' keyword what you're looking for?
>>
>
> No, because it needs detail. I was looking for a boolean switch that 
> basically says: Respect the data, not beauty.

I don't understand what you mean by 'beauty'. If your image is 100
pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
that doesn't do what you want?

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

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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread K.-Michael Aye

On Oct 2, 2012, at 12:06 PM, Damon McDougall  wrote:

> On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye  wrote:
>> 
>> On Oct 2, 2012, at 11:09 AM, Damon McDougall  
>> wrote:
>> 
>>> On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye  
>>> wrote:
 
 
 On Oct 2, 2012, at 6:33 AM, Damon McDougall  
 wrote:
 
> On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root  wrote:
>> 
>> 
>> On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye  
>> wrote:
>>> 
>>> Hi!
>>> 
>>> I see that the function ax.imshow takes the parameter 'imlim' but in
>>> the source (status: EPD 7.3-2) it is not being used?
>>> So what is it for?
>>> 
>>> Best regards,
>>> Michael
>>> 
>>> 
>> 
>> Confirmed.  I don't see imlim anywhere except in the imshow() signature. 
>>  I
>> have no recollection of this parameter, so it might be from before my 
>> time.
>> 
>> Ben Root
> 
> Is there some functionality you were looking for or were you just
> exploring the codebase?
> 
 How nice of you to ask! ;)
 Indeed: I had the case that image arrays inside an ImageGrid where shown 
 with some white overhead area around, e.g. for an image of 100 pixels on 
 the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I 
 was looking for a simple way to suppress that behavior and let imshow 
 instead use the exact image extent. I believe that the plot command has 
 such a flag, hasn't it? (I.e. to use the exact xdata range and not try to 
 beautify the plot?
 
 Michael
 
 
> --
> Damon McDougall
> http://www.damon-is-a-geek.com
> B2.39
> Mathematics Institute
> University of Warwick
> Coventry
> West Midlands
> CV4 7AL
> United Kingdom
>>> 
>>> Is the 'extent' keyword what you're looking for?
>>> 
>> 
>> No, because it needs detail. I was looking for a boolean switch that 
>> basically says: Respect the data, not beauty.
> 
> I don't understand what you mean by 'beauty'. If your image is 100
> pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
> that doesn't do what you want?
> 
As I wrote, that's not what is happening. I get extent=[-10,110,0,50].


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


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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Damon McDougall
On Tue, Oct 2, 2012 at 8:07 PM, K.-Michael Aye  wrote:
>
> On Oct 2, 2012, at 12:06 PM, Damon McDougall  
> wrote:
>
>> On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye  
>> wrote:
>>>
>>> On Oct 2, 2012, at 11:09 AM, Damon McDougall  
>>> wrote:
>>>
 On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye  
 wrote:
>
>
> On Oct 2, 2012, at 6:33 AM, Damon McDougall  
> wrote:
>
>> On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root  wrote:
>>>
>>>
>>> On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye  
>>> wrote:

 Hi!

 I see that the function ax.imshow takes the parameter 'imlim' but in
 the source (status: EPD 7.3-2) it is not being used?
 So what is it for?

 Best regards,
 Michael


>>>
>>> Confirmed.  I don't see imlim anywhere except in the imshow() 
>>> signature.  I
>>> have no recollection of this parameter, so it might be from before my 
>>> time.
>>>
>>> Ben Root
>>
>> Is there some functionality you were looking for or were you just
>> exploring the codebase?
>>
> How nice of you to ask! ;)
> Indeed: I had the case that image arrays inside an ImageGrid where shown 
> with some white overhead area around, e.g. for an image of 100 pixels on 
> the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I 
> was looking for a simple way to suppress that behavior and let imshow 
> instead use the exact image extent. I believe that the plot command has 
> such a flag, hasn't it? (I.e. to use the exact xdata range and not try to 
> beautify the plot?
>
> Michael
>
>
>> --
>> Damon McDougall
>> http://www.damon-is-a-geek.com
>> B2.39
>> Mathematics Institute
>> University of Warwick
>> Coventry
>> West Midlands
>> CV4 7AL
>> United Kingdom

 Is the 'extent' keyword what you're looking for?

>>>
>>> No, because it needs detail. I was looking for a boolean switch that 
>>> basically says: Respect the data, not beauty.
>>
>> I don't understand what you mean by 'beauty'. If your image is 100
>> pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
>> that doesn't do what you want?
>>
> As I wrote, that's not what is happening. I get extent=[-10,110,0,50].
>
>
>> --
>> Damon McDougall
>> http://www.damon-is-a-geek.com
>> B2.39
>> Mathematics Institute
>> University of Warwick
>> Coventry
>> West Midlands
>> CV4 7AL
>> United Kingdom
>

The following script works for me:

import numpy as np
import matplotlib.pyplot as plt

image = np.random.random((100,50))

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.imshow(image, extent=[0,100,0,50])
plt.show()


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

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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Benjamin Root
On Tue, Oct 2, 2012 at 3:07 PM, K.-Michael Aye wrote:

>
> On Oct 2, 2012, at 12:06 PM, Damon McDougall 
> wrote:
>
> > On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye 
> wrote:
> >>
> >> On Oct 2, 2012, at 11:09 AM, Damon McDougall 
> wrote:
> >>
> >>> On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye 
> wrote:
> 
> 
>  On Oct 2, 2012, at 6:33 AM, Damon McDougall <
> [email protected]> wrote:
> 
> > On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root 
> wrote:
> >>
> >>
> >> On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye 
> wrote:
> >>>
> >>> Hi!
> >>>
> >>> I see that the function ax.imshow takes the parameter 'imlim' but
> in
> >>> the source (status: EPD 7.3-2) it is not being used?
> >>> So what is it for?
> >>>
> >>> Best regards,
> >>> Michael
> >>>
> >>>
> >>
> >> Confirmed.  I don't see imlim anywhere except in the imshow()
> signature.  I
> >> have no recollection of this parameter, so it might be from before
> my time.
> >>
> >> Ben Root
> >
> > Is there some functionality you were looking for or were you just
> > exploring the codebase?
> >
>  How nice of you to ask! ;)
>  Indeed: I had the case that image arrays inside an ImageGrid where
> shown with some white overhead area around, e.g. for an image of 100 pixels
> on the x-axis, the imshow resulted in an x-axis that went from -10 to 110.
> I was looking for a simple way to suppress that behavior and let imshow
> instead use the exact image extent. I believe that the plot command has
> such a flag, hasn't it? (I.e. to use the exact xdata range and not try to
> beautify the plot?
> 
>  Michael
> 
> 
> > --
> > Damon McDougall
> > http://www.damon-is-a-geek.com
> > B2.39
> > Mathematics Institute
> > University of Warwick
> > Coventry
> > West Midlands
> > CV4 7AL
> > United Kingdom
> >>>
> >>> Is the 'extent' keyword what you're looking for?
> >>>
> >>
> >> No, because it needs detail. I was looking for a boolean switch that
> basically says: Respect the data, not beauty.
> >
> > I don't understand what you mean by 'beauty'. If your image is 100
> > pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
> > that doesn't do what you want?
> >
> As I wrote, that's not what is happening. I get extent=[-10,110,0,50].
>
>
>
Which version of matplotlib are you using?  Also, are you on a 32-bit
machine or a 64-bit machine.  This might be related to a bug we have seen
recently.

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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Eric Firing
On 2012/10/02 9:11 AM, Damon McDougall wrote:
> On Tue, Oct 2, 2012 at 8:07 PM, K.-Michael Aye  wrote:
>>
>> On Oct 2, 2012, at 12:06 PM, Damon McDougall  
>> wrote:
>>
>>> On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye  
>>> wrote:

 On Oct 2, 2012, at 11:09 AM, Damon McDougall  
 wrote:

> On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye  
> wrote:
>>
>>
>> On Oct 2, 2012, at 6:33 AM, Damon McDougall  
>> wrote:
>>
>>> On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root  wrote:


 On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye  
 wrote:
>
> Hi!
>
> I see that the function ax.imshow takes the parameter 'imlim' but in
> the source (status: EPD 7.3-2) it is not being used?
> So what is it for?
>
> Best regards,
> Michael
>
>

 Confirmed.  I don't see imlim anywhere except in the imshow() 
 signature.  I
 have no recollection of this parameter, so it might be from before my 
 time.

 Ben Root
>>>
>>> Is there some functionality you were looking for or were you just
>>> exploring the codebase?
>>>
>> How nice of you to ask! ;)
>> Indeed: I had the case that image arrays inside an ImageGrid where shown 
>> with some white overhead area around, e.g. for an image of 100 pixels on 
>> the x-axis, the imshow resulted in an x-axis that went from -10 to 110. 
>> I was looking for a simple way to suppress that behavior and let imshow 
>> instead use the exact image extent. I believe that the plot command has 
>> such a flag, hasn't it? (I.e. to use the exact xdata range and not try 
>> to beautify the plot?
>>
>> Michael
>>
>>
>>> --
>>> Damon McDougall
>>> http://www.damon-is-a-geek.com
>>> B2.39
>>> Mathematics Institute
>>> University of Warwick
>>> Coventry
>>> West Midlands
>>> CV4 7AL
>>> United Kingdom
>
> Is the 'extent' keyword what you're looking for?
>

 No, because it needs detail. I was looking for a boolean switch that 
 basically says: Respect the data, not beauty.
>>>
>>> I don't understand what you mean by 'beauty'. If your image is 100
>>> pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
>>> that doesn't do what you want?
>>>
>> As I wrote, that's not what is happening. I get extent=[-10,110,0,50].
>>
>>
>>> --
>>> Damon McDougall
>>> http://www.damon-is-a-geek.com
>>> B2.39
>>> Mathematics Institute
>>> University of Warwick
>>> Coventry
>>> West Midlands
>>> CV4 7AL
>>> United Kingdom
>>
>
> The following script works for me:
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> image = np.random.random((100,50))
>
> fig = plt.figure()
> ax = fig.add_subplot(1, 1, 1)
> ax.imshow(image, extent=[0,100,0,50])
> plt.show()
>
>

I think the problem is that Michael is using ImageGrid, and apparently 
it is not using the tight autoscaling that imshow normally uses by default.

Eric

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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Michael Aye
> >
>  How nice of you to ask! ;)
>  Indeed: I had the case that image arrays inside an ImageGrid where 
> shown with some white overhead area around, e.g. for an image of 100 
> pixels on the x-axis, the imshow resulted in an x-axis that went from 
> -10 to 110. I was looking for a simple way to suppress that behavior 
> and let imshow instead use the exact image extent. I believe that the 
> plot command has such a flag, hasn't it? (I.e. to use the exact xdata 
> range and not try to beautify the plot?
> 
>  Michael
> 
> >>>
> >>> Is the 'extent' keyword what you're looking for?
> >>>
> >>
> >> No, because it needs detail. I was looking for a boolean switch that 
> basically says: Respect the data, not beauty.
> >
> > I don't understand what you mean by 'beauty'. If your image is 100
> > pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
> > that doesn't do what you want?
> >
> As I wrote, that's not what is happening. I get extent=[-10,110,0,50].
> 
> 
> Which version of matplotlib are you using?  Also, are you on a 32-bit 
> machine or a 64-bit machine.  This might be related to a bug we have 
> seen recently.

I am using mpl 1.1.0 from EPD 7.3-2 on a 64-bit Mac OSX.

Thanks for the effort Damon. I should have been starting with an 
example script from the beginning.
I believe the problem appears only for subplots in the case of sharex 
=sharey = True:

from matplotlib.pyplot import show, subplots
from numpy import arange, array

arr = arange(1).reshape(100,100)
l = [arr,arr,arr,arr]
narr = array(l)

fig, axes = subplots(2,2,sharex=True,sharey=True)

for ax,im in zip(axes.flatten(),narr):
ax.imshow(im)

show()

One can see that all the 4 axes show the array with an extent of 
[-10,110, 0, 100] here.

Michael


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




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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Michael Aye
 
>>> How nice of you to ask! ;)
>>> Indeed: I had the case that image arrays inside an ImageGrid where 
>>> shown with some white overhead area around, e.g. for an image of 100 
>>> pixels on the x-axis, the imshow resulted in an x-axis that went from 
>>> -10 to 110. I was looking for a simple way to suppress that behavior 
>>> and let imshow instead use the exact image extent. I believe that the 
>>> plot command has such a flag, hasn't it? (I.e. to use the exact xdata 
>>> range and not try to beautify the plot?
>>> 
>>> Michael
>> 
>> Is the 'extent' keyword what you're looking for?
>> 
> 
> No, because it needs detail. I was looking for a boolean switch that 
> basically says: Respect the data, not beauty.
 
 I don't understand what you mean by 'beauty'. If your image is 100
 pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
 that doesn't do what you want?
 
>>> As I wrote, that's not what is happening. I get extent=[-10,110,0,50].
>>> 
>>> 
>> 
>> The following script works for me:
>> 
>> import numpy as np
>> import matplotlib.pyplot as plt
>> 
>> image = np.random.random((100,50))
>> 
>> fig = plt.figure()
>> ax = fig.add_subplot(1, 1, 1)
>> ax.imshow(image, extent=[0,100,0,50])
>> plt.show()
>> 
>> 
> 
> I think the problem is that Michael is using ImageGrid, and apparently
> it is not using the tight autoscaling that imshow normally uses by default.

I might have confused where I had the problem as I was trying out many 
a'things yesterday, so today I only can reproduce it with subplots. Can 
I activate tight autoscaling somehow? tight_layout only influences the 
axes towards each-other not the imshows itself.


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




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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Damon McDougall
On Tue, Oct 2, 2012 at 8:33 PM, Michael Aye  wrote:
>
 How nice of you to ask! ;)
 Indeed: I had the case that image arrays inside an ImageGrid where
 shown with some white overhead area around, e.g. for an image of 100
 pixels on the x-axis, the imshow resulted in an x-axis that went from
 -10 to 110. I was looking for a simple way to suppress that behavior
 and let imshow instead use the exact image extent. I believe that the
 plot command has such a flag, hasn't it? (I.e. to use the exact xdata
 range and not try to beautify the plot?

 Michael
>>>
>>> Is the 'extent' keyword what you're looking for?
>>>
>>
>> No, because it needs detail. I was looking for a boolean switch that
>> basically says: Respect the data, not beauty.
>
> I don't understand what you mean by 'beauty'. If your image is 100
> pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
> that doesn't do what you want?
>
 As I wrote, that's not what is happening. I get extent=[-10,110,0,50].


>>>
>>> The following script works for me:
>>>
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>>
>>> image = np.random.random((100,50))
>>>
>>> fig = plt.figure()
>>> ax = fig.add_subplot(1, 1, 1)
>>> ax.imshow(image, extent=[0,100,0,50])
>>> plt.show()
>>>
>>>
>>
>> I think the problem is that Michael is using ImageGrid, and apparently
>> it is not using the tight autoscaling that imshow normally uses by default.
>
> I might have confused where I had the problem as I was trying out many
> a'things yesterday, so today I only can reproduce it with subplots. Can
> I activate tight autoscaling somehow? tight_layout only influences the
> axes towards each-other not the imshows itself.
>
>
>>
>> Eric
>>
>> --
>> Don't let slow site performance ruin your business. Deploy New Relic APM
>> Deploy New Relic app performance management and know exactly
>> what is happening inside your Ruby, Python, PHP, Java, and .NET app
>> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
>> http://p.sf.net/sfu/newrelic-dev2dev
>
>
>
>
> --
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I think you may have encountered a bug, as Ben pointed out. Here's a workaround:

import matplotlib
matplotlib.use('macosx')
import matplotlib.pyplot as plt
from numpy import arange, array

arr = arange(1).reshape(100,100)
l = [arr,arr,arr,arr]
narr = array(l)

axes = []
fig = plt.figure()
for i in range(4):
axes.append(fig.add_subplot(2, 2, i))

for ax, im in zip(axes, narr):
ax.imshow(im, extent=[0,100,0,100])

plt.show()

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

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


[Matplotlib-users] Is there an update on: "Matplotlib 1.1.0 animation vs. contour plots"?

2012-10-02 Thread Mark Bakker
Hello List,

Apparently, it is not straightforward to make an animation of contour plots.
I found a discussion (and work-around solution including punching ducks) on
the list through this link: punch the QuadContourSet until it behaves like
an 
Artist

Has there been a fix since then? It would be nice if contours work with
animations like the other plots.
If not, no big deal.

Thanks,

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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Michael Aye
On 2012-10-02 19:49:16 +, Damon McDougall said:

> On Tue, Oct 2, 2012 at 8:33 PM, Michael Aye 
>  wrote:
>> 
> How nice of you to ask! ;)
> Indeed: I had the case that image arrays inside an ImageGrid where
> shown with some white overhead area around, e.g. for an image of 100
> pixels on the x-axis, the imshow resulted in an x-axis that went from
> -10 to 110. I was looking for a simple way to suppress that behavior
> and let imshow instead use the exact image extent. I believe that the
> plot command has such a flag, hasn't it? (I.e. to use the exact xdata
> range and not try to beautify the plot?
> 
> Michael
 
 Is the 'extent' keyword what you're looking for?
 
>>> 
>>> No, because it needs detail. I was looking for a boolean switch that
>>> basically says: Respect the data, not beauty.
>> 
>> I don't understand what you mean by 'beauty'. If your image is 100
>> pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
>> that doesn't do what you want?
>> 
> As I wrote, that's not what is happening. I get extent=[-10,110,0,50].
> 
> 
 
 The following script works for me:
 
 import numpy as np
 import matplotlib.pyplot as plt
 
 image = np.random.random((100,50))
 
 fig = plt.figure()
 ax = fig.add_subplot(1, 1, 1)
 ax.imshow(image, extent=[0,100,0,50])
 plt.show()
 
 
>>> 
>>> I think the problem is that Michael is using ImageGrid, and apparently
>>> it is not using the tight autoscaling that imshow normally uses by default.
>> 
>> I might have confused where I had the problem as I was trying out many
>> a'things yesterday, so today I only can reproduce it with subplots. Can
>> I activate tight autoscaling somehow? tight_layout only influences the
>> axes towards each-other not the imshows itself.
>> 
>> 
>>> 
>>> Eric
>>> 
>>> --
>>> Don't let slow site performance ruin your business. Deploy New Relic APM
>>> Deploy New Relic app performance management and know exactly
>>> what is happening inside your Ruby, Python, PHP, Java, and .NET app
>>> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
>>> http://p.sf.net/sfu/newrelic-dev2dev
>> 
>> 
>> 
>> 
>> --
>> Don't let slow site performance ruin your business. Deploy New Relic APM
>> Deploy New Relic app performance management and know exactly
>> what is happening inside your Ruby, Python, PHP, Java, and .NET app
>> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
>> http://p.sf.net/sfu/newrelic-dev2dev
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> I think you may have encountered a bug, as Ben pointed out. Here's a 
> workaround:
> 
> import matplotlib
> matplotlib.use('macosx')
> import matplotlib.pyplot as plt
> from numpy import arange, array
> 
> arr = arange(1).reshape(100,100)
> l = [arr,arr,arr,arr]
> narr = array(l)
> 
> axes = []
> fig = plt.figure()
> for i in range(4):
> axes.append(fig.add_subplot(2, 2, i))
> 
> for ax, im in zip(axes, narr):
> ax.imshow(im, extent=[0,100,0,100])
> 
> plt.show()

Interestingly, providing the extent does not help using subplots.
And your way of creating the subplots does not have the bug in the 
first place. Removing the extent parameter from this still plots fine.





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


Re: [Matplotlib-users] imlim in ax.imshow

2012-10-02 Thread Eric Firing
On 2012/10/02 9:21 AM, Michael Aye wrote:
>>>
>> How nice of you to ask! ;)
>> Indeed: I had the case that image arrays inside an ImageGrid where
>> shown with some white overhead area around, e.g. for an image of 100
>> pixels on the x-axis, the imshow resulted in an x-axis that went from
>> -10 to 110. I was looking for a simple way to suppress that behavior
>> and let imshow instead use the exact image extent. I believe that the
>> plot command has such a flag, hasn't it? (I.e. to use the exact xdata
>> range and not try to beautify the plot?
>>
>> Michael
>>
>
> Is the 'extent' keyword what you're looking for?
>

 No, because it needs detail. I was looking for a boolean switch that
>> basically says: Respect the data, not beauty.
>>>
>>> I don't understand what you mean by 'beauty'. If your image is 100
>>> pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
>>> that doesn't do what you want?
>>>
>> As I wrote, that's not what is happening. I get extent=[-10,110,0,50].
>>
>>
>> Which version of matplotlib are you using?  Also, are you on a 32-bit
>> machine or a 64-bit machine.  This might be related to a bug we have
>> seen recently.
>
> I am using mpl 1.1.0 from EPD 7.3-2 on a 64-bit Mac OSX.
>
> Thanks for the effort Damon. I should have been starting with an
> example script from the beginning.
> I believe the problem appears only for subplots in the case of sharex
> =sharey = True:

Aha!  This is a real bug. It may take a bit of work to track it down. 
Would you enter it, with this test script, as a github issue, please?

Thank you.

Eric

>
> from matplotlib.pyplot import show, subplots
> from numpy import arange, array
>
> arr = arange(1).reshape(100,100)
> l = [arr,arr,arr,arr]
> narr = array(l)
>
> fig, axes = subplots(2,2,sharex=True,sharey=True)
>
> for ax,im in zip(axes.flatten(),narr):
>  ax.imshow(im)
>
> show()
>
> One can see that all the 4 axes show the array with an extent of
> [-10,110, 0, 100] here.
>
> Michael
>
>
>>
>> Ben Root
>>
>> --
>> Don't let slow site performance ruin your business. Deploy New Relic APM
>> Deploy New Relic app performance management and know exactly
>> what is happening inside your Ruby, Python, PHP, Java, and .NET app
>> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
>> http://p.sf.net/sfu/newrelic-dev2dev
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


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


[Matplotlib-users] Create a figure window without navigation toolbar

2012-10-02 Thread Jianbao Tao
Hi,

I know one can make a figure window without toolbar by doing
mpl.rcParams['toolbar'] = 'None'

However, this approach is kind of annoying if one just wants to remove the
toolbar for one figure window and to keep the default behavior to be with a
toolbar. So, I am wondering if it is possible to do something like:
fig = figure(toolbar=False) # Create a new figure window with no toolbar.

If it is not possible now, I am wondering if the matplotlib team has any
intention to implement that feature. I would think it is not hard to do so,
since it is so easy to achieve that goal by setting a parameter. But I
could very much be wrong, as I know nothing about how things work under the
hood for matplotlib.

Anyway, I am mostly just curious, since I have already got a workaround for
that. But it would be nice to know other's people's approaches/ideas. :-)

Thank you very much.

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


[Matplotlib-users] Control the position of a figure window

2012-10-02 Thread Jianbao Tao
Hi,

Is it possible to specify the position of a figure window when one is
created? This will be a killing feature if one wants to put the figure
window at the right place in the screen automatically. It is annoying if
ones has to drag a new figure to a comfortable place in the screen every
time a new figure is created.

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