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

2012-02-06 Thread John Hunter
On Mon, Feb 6, 2012 at 1:59 PM, Benjamin Root  wrote:
> Alternate title: "How I finally convinced my Dad that open-source can put
> food on the table". Since this entire story got started on this mailing
> list, I figured it would be appropriate to end it here.

Love the alternate title.  I'm sure we can all substitute
dad|mom|wife|husband|significant_other in that one.

> About a week later, I got a personal email from the original poster
> informing me that my solution worked perfectly.  He also noticed that I was
> working in a neighboring building on campus and wondered just how much
> longer my PhD was going to take and if I had any interest in going into the
> private sector.  (The company happened to deal with atmospheric science and
> my PhD is in meteorology).

I love that a tiny bit of altruism turned into a good job for you.
Recently my wife, who is a criminal defense attorney, decided to
transition from criminal law to family law, and took on a pro-bono
case of a friend who was in a tough spot (he was accused of spousal
battery by a mentally ill wife and they had several young kids in the
middle).  At a Halloween party, she met someone who worked at a family
law firm and began telling him about her case, and that led to a job
interview and soon she'll be having her third interview with the firm.
 I don't know how it will turn out, but I'm pretty sure that she
wouldn't have gotten this opportunity had she not taken on this case
pro-bono.

I grew up pretty much accepting the US ethos that 'there is no such
thing as free lunch" and "no one works for free".  So it came as a
great surprise to me, sometime in 1994-1995, when I posted a question
on comp.lang.awk about a script I was developing mixing sed and awk
which parsed BibTeX.  Some kind soul responded withing 12 hours, "you
should really be using Perl for this", *and* wrote a non-trivial,
several hundred line piece of Perl to solve my problem.  I was
dumbstruck that someone would stay up all night solving a problem for
me, not looking for anything except perhaps for "credit".  What I
learned next was that altruism is infectious.  I began diving deeply
into Perl, mastering it, and answering other people's questions on the
Perl mailing list.  At one point, I was one of the top ten posters on
the Perl mailing list -- no mean feat at the time -- mainly
obsessively answering people's questions.  Of course when I discovered
Python, I dropped Perl faster than a hot potato, but that spirit of
contributing to and benefiting from a community of people motivated
not by a payback but by contributing to and participating in something
excellent persisted.  That free help that guy gave me on comp.lang.awk
probably caused me to spend 8,000 hours over the next decade helping
other people.  I guess there is no such thing as free lunch.


> It turned out that the company realized the value of having on-staff a
> "SciPy Guru" (I still consider myself a beginner).  After the usual visits
> and interviews, I was offered a position.  At multiple times throughout the
> process, it was obvious to me that while it was good that I was an
> atmospheric scientist, what was most valuable to them was my knowledge,
> insight and expertise with Python and its tools.
>
> The lesson I hope everyone here can take in is that there are many companies
> out there that are using open-source tools and libraries for their
> purposes.  Learning and using these tools for your own purposes not only
> solves your immediate needs, but also sets you up for future opportunities.

No doubt about this one.  I have tried with mixed success on a number
of occasions to hire people for a job in quantitative finance who
possess skills in scientific python tools as well as statistics, and
it is hard to find good matches.  Whenever I meet other people like me
who are trying to hire people, they all tell the same tale: it's hard
to find talent.  So if you have these skills and would like a job,
contact me :-)

I've been astounded by the degree of uptake of the scientific python
toolset, and it is accelerating.  As more and more people use these
tools, more and more companies require them and most importantly, more
and more talented developers put their energies into them.  The amount
of productivity being poured into not only the core tools but also
pandas, scikits-learn, scikits-image, pystatsmodels and others is
awesome, and is definitely taking the tool chain to the next level.

> Therefore, I would like to thank John Hunter for making matplotlib available
> for the community, and a hearty thanks to the rest of the community for
> their contributions to matplotlib.  Without this, I doubt I would have found
> this job opportunity, nor have the "value-added" skills to have them
> consider hiring me.

You're welcome, but I owe you a significant thanks as well.  As my
time for significant development has dwindled, the major contributions
by you and the other developers has enabled the project to thrive.

[Matplotlib-users] rendering unicode using the PDF backend

2012-02-06 Thread Mark Janikas
Hi All,

I am having trouble rendering my Unicode strings in matplotlib using the PDF 
backend.   When I use certain fonts  (like the Win 7 default), I get no 
complaints but the characters are not rendered When I use a font like Arial 
Unicode MS, that I know contains all the chars, then I get the error message 
below.  I did in fact, find a tty file that would work with Chinese ("Microsoft 
YaHei"), but I would like to avoid trying to map font files to languages.  Any 
info on this subject would be greatly appreciated.  Here is a snippet that 
reproduces the error below... if you remove the fontproperties option to the 
PYLAB.xlabel() call then the error is avoided but the result is not rendered.  
Thanks so much!

MJ


import matplotlib.pyplot as PLT
import pylab as PYLAB
from matplotlib.backends.backend_pdf import PdfPages as PDF
import matplotlib.font_manager as fm

fontFile = r'C:\Windows\Fonts\ARIALUNI.TTF'
fp1 = fm.FontProperties(fname=fontFile)

reportFile = r'C:\Temp\TestUnicode.pdf'
pdfOutput = PDF(reportFile)
vals = range(100)

PLT.plot(vals, vals, color = "r", linestyle = "-")
mess = u'\u6B63\u5728\u8BFB\u53D6\u6570\u636E...'
PYLAB.xlabel(mess, fontproperties = fp1)
PLT.savefig(pdfOutput, format='pdf')
PLT.close()
pdfOutput.close()



Traceback (most recent call last):
  File "C:\Data\CRs\10.1\MemLeak\matplotlib\Scripts\matplotlib_unicode.py", 
line 27, in 
PLT.savefig(pdfOutput, format='pdf')
  File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 472, in 
savefig
return fig.savefig(*args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1173, in 
savefig
self.canvas.print_figure(*args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line 2027, 
in print_figure
**kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_pdf.py", line 
2181, in print_pdf
self.figure.draw(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in 
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 886, in draw
func(*args)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in 
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 1983, in draw
a.draw(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in 
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 1054, in draw
self.label.draw(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in 
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\text.py", line 587, in draw
ismath=ismath)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_pdf.py", line 
1784, in draw_text
return draw_text_woven(chunks)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_pdf.py", line 
1754, in draw_text_woven
glyph_name = font.get_glyph_name(gind)
RuntimeError: Face has no glyph names










PS.  I cannot use a different backend.
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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

2012-02-06 Thread C M
On Mon, Feb 6, 2012 at 2:59 PM, Benjamin Root  wrote:

> Alternate title: "How I finally convinced my Dad that open-source can put
> food on the table". Since this entire story got started on this mailing
> list, I figured it would be appropriate to end it here.
>

Inspiring and uplifting story, Ben.  I'm glad you posted it.
Congratulations on your new job!  (That's also interesting that your father
even knows what open-source is).

Che
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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

2012-02-06 Thread Paul Ivanov
Benjamin Root, on 2012-02-06 13:59,  wrote:
> Alternate title: "How I finally convinced my Dad that open-source can put
> food on the table". Since this entire story got started on this mailing
> list, I figured it would be appropriate to end it here.
> 
> Last Friday, I signed a contract to begin working as a "Senior Scientific
> Programmer" for a research company.   

Congrats on the new job, Ben! Great story, I could say that it
had me "Root-ing" for you - but that would make you groan from
the number of times you've probably heard it before, so I'm not
gonna do that ;)

> Lastly, a reminder to everyone on this list, I hope this encourages more of
> you to help each other out with answers.  You never know if the person you
> help out is your future co-worker!

Hope this doesn't mean you'll be posting less, now :)

I want to second Ben's comments: I learned (and continue to
learn) quite a bit about matplotlib by trying to answer the
questions others have (with my trusty IPython tab-completion, and
when necessary, doing what every Python Jedi does, and use the
Source) - and by following along with the answers others provide.

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How matplotlib got me a job

2012-02-06 Thread Benjamin Root
Alternate title: "How I finally convinced my Dad that open-source can put
food on the table". Since this entire story got started on this mailing
list, I figured it would be appropriate to end it here.

Last Friday, I signed a contract to begin working as a "Senior Scientific
Programmer" for a research company.  The company has recently begun making
Python the "preferred language for new development" and has become heavily
dependent upon NumPy, SciPy and matplotlib.  They have been doing fairly
well for a while now, but a few months ago, they ran into a problem with
matplotlib.  After spending a few weeks butting heads on it, they finally
decided to post a question about it to the matplotlib-users list.  After
reading the question and seeing the code example, I replied with a one-line
fix within half an hour of its posting and moved on.

About a week later, I got a personal email from the original poster
informing me that my solution worked perfectly.  He also noticed that I was
working in a neighboring building on campus and wondered just how much
longer my PhD was going to take and if I had any interest in going into the
private sector.  (The company happened to deal with atmospheric science and
my PhD is in meteorology).

It turned out that the company realized the value of having on-staff a
"SciPy Guru" (I still consider myself a beginner).  After the usual visits
and interviews, I was offered a position.  At multiple times throughout the
process, it was obvious to me that while it was good that I was an
atmospheric scientist, what was most valuable to them was my knowledge,
insight and expertise with Python and its tools.

The lesson I hope everyone here can take in is that there are many
companies out there that are using open-source tools and libraries for
their purposes.  Learning and using these tools for your own purposes not
only solves your immediate needs, but also sets you up for future
opportunities.

Therefore, I would like to thank John Hunter for making matplotlib
available for the community, and a hearty thanks to the rest of the
community for their contributions to matplotlib.  Without this, I doubt I
would have found this job opportunity, nor have the "value-added" skills to
have them consider hiring me.

Lastly, a reminder to everyone on this list, I hope this encourages more of
you to help each other out with answers.  You never know if the person you
help out is your future co-worker!

Cheers!
Ben Root
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] specgram memory problem

2012-02-06 Thread David Craig
uname -a gives,
Linux David 3.2.2-1.fc16.i686 #1 SMP Thu Jan 26 03:38:31 UTC 2012 i686 i686
i386 GNU/Linux

On Mon, Feb 6, 2012 at 6:07 PM, Benjamin Root  wrote:

>
>
> On Mon, Feb 6, 2012 at 11:59 AM, David Craig  wrote:
>
>> I'm using a lenovo laptop with fedora 16. It has 2.9 GiB memory and 4
>> intel core CPUs @ 2.3GHz each. Available disk space is 147.9GiB.
>> numpy 1.6.0
>> matplotlib 1.0.1
>>
>>
> 32-bit or 64-bit OS?  Please use 'uname -a' to tell us, because you can
> install a 32-bit OS on a 64-bit machine.
>
> Ben Root
>
>
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Why pixel marker size is 4 pixels?

2012-02-06 Thread Michael Droettboom

There is a pull request for this here:

https://github.com/matplotlib/matplotlib/pull/695

If you're able to checkout and build that branch from git, I would 
appreciate hearing if it resolves your issue.


Mike

On 02/06/2012 12:58 PM, Chris wrote:

JJ,

Thanks for the clarification.  Now I understand why EPS outputs of
pixel plot from mpl is a few times bigger than those from SuperMongo.
I guess that mpl uses the square implementation for pixel so that it
would use the same method to handle all marker types.  I will file an
issue report on git.  Meanwhile, is there any easy workaround?

Jonathan,

Tom Robitaille's module does help reducing file size of postscript,
but by rasterize a scalable plot.  It doesn't really help my problem
since the markers are still drawn with the same method as other
plotting methods.

Bests,
Chris


On Mon, Feb 6, 2012 at 4:28 AM, Jae-Joon Lee  wrote:

Thanks. Now I understand the situation.

As far as I can see, marker="," is implemented as a rectangle path
with width/height of 1 pixel, so this result in 2x2 pixel filled
square.
I tried to change the size of the rectangle, etc, to get a single
pixel filled square, but did not get a satisfactory result.
I think we need an Agg expert. I hope Mike or others take a look.

Chris,
if you do not get a response from others in this mailing list, I
recommend you to open a new issue in our github page.

Regards,

-JJ



On Mon, Feb 6, 2012 at 6:19 AM, Jonathan Slavin  wrote:

Chris,

You might want to try a module written by Tom Robitaille (aka astrofrog)
called rasterized_scatter.  Look for it on github.

Jon

On Mon, 2012-02-06 at 21:28 +0900, Jae-Joon Lee wrote:

Thanks. Now I understand the situation.

As far as I can see, marker="," is implemented as a rectangle path
with width/height of 1 pixel, so this result in 2x2 pixel filled
square.
I tried to change the size of the rectangle, etc, to get a single
pixel filled square, but did not get a satisfactory result.
I think we need an Agg expert. I hope Mike or others take a look.

Chris,
if you do not get a response from others in this mailing list, I
recommend you to open a new issue in our github page.

Regards,

-JJ


On Mon, Feb 6, 2012 at 1:53 AM, Chris  wrote:

Thanks JJ.

The problem seems not to be a size issue --  markersize has no effect
when use marker="," (pixel).  I have also tried to turn off aa, and it
doesn't help either.  I also tried different backends.  The PNG output
from Agg and Cairo is slightly different: Agg's point has 4 solid
pixel, while Cairo's has 4 pixel with random shade.

Postscript output has the same problem.  The "pixel" in an EPS file
generated by mpl is significantly bigger than that from another
drawing program I used.

The problem occurs in all my plotting scripts, e.g., this basic one:

[CODE]
import numpy as np

x=np.arange(100)
y=np.random.randn(100)

ioff()
fig=gcf()
fig.clf()

ax=fig.add_axes(0.15,0.1,0.8, 0.85)
ax.plot(x,y,"k,")

ion()
fig.canvas.draw()
[/CODE]

Here is how I identify the problem:
1. use the above script to plot on screen
2. savefig("plot.png")
3. open plot.png in GIMP and check the pixel size.

I also attached the two PNG files generated with Agg and Cairo backends.


On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee  wrote:

How are you plotting your points.

If you use *plot*, there is a *markersize* parameter.
If you use *scatter*, the third argument controls the marker size.

But you may actually complaining about other issues, e.g.,
antialiasing, etc. So, if above are not your answer, please post a
complete example and describe your problem in more detail.

Regards,

-JJ


On Sat, Feb 4, 2012 at 2:15 PM, Chris  wrote:

I noticed this a few years back, but left it aside because most of the
time I can live with it.  Recently I need to make a few plots
containing a few million points, and 4 pixels for a point is a
disaster.  So my question is why the pixel marker size is set at 4
pixels?  And is there anyway to change it to a single pixel?

Thanks,
Chris

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Mat

Re: [Matplotlib-users] (no subject)

2012-02-06 Thread Benjamin Root
On Mon, Feb 6, 2012 at 1:07 PM, Debashish Saha  wrote:

> what is the basic difference between the commands
> import pylab as *
> import matplotlib.pyplot as plt
>
>
This page should help you out.  Let us know if you have any further
questions.

http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related

Ben Root
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] (no subject)

2012-02-06 Thread Debashish Saha
what is the basic difference between the commands
import pylab as *
import matplotlib.pyplot as plt

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] specgram memory problem

2012-02-06 Thread Benjamin Root
On Mon, Feb 6, 2012 at 11:59 AM, David Craig  wrote:

> I'm using a lenovo laptop with fedora 16. It has 2.9 GiB memory and 4
> intel core CPUs @ 2.3GHz each. Available disk space is 147.9GiB.
> numpy 1.6.0
> matplotlib 1.0.1
>
>
32-bit or 64-bit OS?  Please use 'uname -a' to tell us, because you can
install a 32-bit OS on a 64-bit machine.

Ben Root
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] specgram memory problem

2012-02-06 Thread David Craig
I'm using a lenovo laptop with fedora 16. It has 2.9 GiB memory and 4  
intel core CPUs @ 2.3GHz each. Available disk space is 147.9GiB.
numpy 1.6.0
matplotlib 1.0.1


On 6 Feb 2012, at 10:29, Fabrice Silva wrote:

> On Sat, Feb 4, 2012 at 9:44 AM, Fabrice Silva  mrs.fr> wrote:
>> Le vendredi 03 février 2012 à 17:39 +, David Craig a  
>> écrit :
>>> sure how to get it to plot the outputs from specgram. I use
>>> specgram as follows,
>>> Pxx, freqs, bins, im = plt.specgram(..)
>>> what am I trying imshow??
>>
>>
>> plt.specgram computes the spectrogram and when calls  
>> imshow to display
>> the resulting array into an image
>>
>> Please tell the shape of Pxx, and try the following
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>> a = np.empty((12000, 14400), dtype=float)
>> plt.imshow(a)
>> plt.show()
>
> Le samedi 04 février 2012 à 10:30 +, David Craig a écrit :
>> Pxx has shape (6001, 1430) and when I tried the lines of code it  
>> returned the following memory error,
>>
>> Traceback (most recent call last):
>>   File "/usr/lib/python2.7/site-packages/matplotlib/backends/ 
>> backend_gtk.py", line 394, in expose_event
>> self._render_figure(self._pixmap, w, h)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/backends/ 
>> backend_gtkagg.py", line 75, in _render_figure
>> FigureCanvasAgg.draw(self)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/backends/ 
>> backend_agg.py", line 394, in draw
>> self.figure.draw(self.renderer)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/artist.py",  
>> line 55, in draw_wrapper
>> draw(artist, renderer, *args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/figure.py",  
>> line 798, in draw
>> func(*args)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/artist.py",  
>> line 55, in draw_wrapper
>> draw(artist, renderer, *args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line  
>> 1946, in draw
>> a.draw(renderer)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/artist.py",  
>> line 55, in draw_wrapper
>> draw(artist, renderer, *args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/image.py",  
>> line 354, in draw
>> im = self.make_image(renderer.get_image_magnification())
>>   File "/usr/lib/python2.7/site-packages/matplotlib/image.py",  
>> line 569, in make_image
>> transformed_viewLim)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/image.py",  
>> line 201, in _get_unsampled_image
>> x = self.to_rgba(self._A, self._alpha)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/cm.py", line  
>> 193, in to_rgba
>> x = self.norm(x)
>>   File "/usr/lib/python2.7/site-packages/matplotlib/colors.py",  
>> line 802, in __call__
>> val = ma.asarray(value).astype(np.float)
>>   File "/usr/lib/python2.7/site-packages/numpy/ma/core.py", line  
>> 2908, in astype
>> output = self._data.astype(newtype).view(type(self))
>> MemoryError
>
> Please, answer on the mailing list,
> It confirms that the troubles lie in the rendering of images. Could  
> you
> tell the versions of numpy and matplotlib you are using, and the
> characteristics of the computer you are working on ?
>
>
> -- 
> 
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft  
> developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3,  
> MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Why pixel marker size is 4 pixels?

2012-02-06 Thread Chris
JJ,

Thanks for the clarification.  Now I understand why EPS outputs of
pixel plot from mpl is a few times bigger than those from SuperMongo.
I guess that mpl uses the square implementation for pixel so that it
would use the same method to handle all marker types.  I will file an
issue report on git.  Meanwhile, is there any easy workaround?

Jonathan,

Tom Robitaille's module does help reducing file size of postscript,
but by rasterize a scalable plot.  It doesn't really help my problem
since the markers are still drawn with the same method as other
plotting methods.

Bests,
Chris


On Mon, Feb 6, 2012 at 4:28 AM, Jae-Joon Lee  wrote:
> Thanks. Now I understand the situation.
>
> As far as I can see, marker="," is implemented as a rectangle path
> with width/height of 1 pixel, so this result in 2x2 pixel filled
> square.
> I tried to change the size of the rectangle, etc, to get a single
> pixel filled square, but did not get a satisfactory result.
> I think we need an Agg expert. I hope Mike or others take a look.
>
> Chris,
> if you do not get a response from others in this mailing list, I
> recommend you to open a new issue in our github page.
>
> Regards,
>
> -JJ
>


On Mon, Feb 6, 2012 at 6:19 AM, Jonathan Slavin  wrote:
> Chris,
>
> You might want to try a module written by Tom Robitaille (aka astrofrog)
> called rasterized_scatter.  Look for it on github.
>
> Jon
>
> On Mon, 2012-02-06 at 21:28 +0900, Jae-Joon Lee wrote:
>> Thanks. Now I understand the situation.
>>
>> As far as I can see, marker="," is implemented as a rectangle path
>> with width/height of 1 pixel, so this result in 2x2 pixel filled
>> square.
>> I tried to change the size of the rectangle, etc, to get a single
>> pixel filled square, but did not get a satisfactory result.
>> I think we need an Agg expert. I hope Mike or others take a look.
>>
>> Chris,
>> if you do not get a response from others in this mailing list, I
>> recommend you to open a new issue in our github page.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Mon, Feb 6, 2012 at 1:53 AM, Chris  wrote:
>> > Thanks JJ.
>> >
>> > The problem seems not to be a size issue --  markersize has no effect
>> > when use marker="," (pixel).  I have also tried to turn off aa, and it
>> > doesn't help either.  I also tried different backends.  The PNG output
>> > from Agg and Cairo is slightly different: Agg's point has 4 solid
>> > pixel, while Cairo's has 4 pixel with random shade.
>> >
>> > Postscript output has the same problem.  The "pixel" in an EPS file
>> > generated by mpl is significantly bigger than that from another
>> > drawing program I used.
>> >
>> > The problem occurs in all my plotting scripts, e.g., this basic one:
>> >
>> > [CODE]
>> > import numpy as np
>> >
>> > x=np.arange(100)
>> > y=np.random.randn(100)
>> >
>> > ioff()
>> > fig=gcf()
>> > fig.clf()
>> >
>> > ax=fig.add_axes(0.15,0.1,0.8, 0.85)
>> > ax.plot(x,y,"k,")
>> >
>> > ion()
>> > fig.canvas.draw()
>> > [/CODE]
>> >
>> > Here is how I identify the problem:
>> > 1. use the above script to plot on screen
>> > 2. savefig("plot.png")
>> > 3. open plot.png in GIMP and check the pixel size.
>> >
>> > I also attached the two PNG files generated with Agg and Cairo backends.
>> >
>> >
>> > On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee  wrote:
>> >> How are you plotting your points.
>> >>
>> >> If you use *plot*, there is a *markersize* parameter.
>> >> If you use *scatter*, the third argument controls the marker size.
>> >>
>> >> But you may actually complaining about other issues, e.g.,
>> >> antialiasing, etc. So, if above are not your answer, please post a
>> >> complete example and describe your problem in more detail.
>> >>
>> >> Regards,
>> >>
>> >> -JJ
>> >>
>> >>
>> >> On Sat, Feb 4, 2012 at 2:15 PM, Chris  wrote:
>> >>> I noticed this a few years back, but left it aside because most of the
>> >>> time I can live with it.  Recently I need to make a few plots
>> >>> containing a few million points, and 4 pixels for a point is a
>> >>> disaster.  So my question is why the pixel marker size is set at 4
>> >>> pixels?  And is there anyway to change it to a single pixel?
>> >>>
>> >>> Thanks,
>> >>> Chris
>

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting x scale manually, but letting y scale automatic within the current x-axis

2012-02-06 Thread Pål Gunnar Ellingsen
Hi

That was a very nice explanation of how autoscale works, thank you very
much :D
After now understanding how the function autoscale function works, I see
that this would be a major change in the code, as it would require the axes
to know all of the bounding boxes, and not only one of them.
As it, at least in my code, is easy to calculate the new limits on the
unset axis, I would not put this up as something that should be a feature.
Though I think the documentation for autoscale, section axis could be a bit
clearer and state that autoscaling only one axis autoscales that axis with
respect to everything plotted, even though xlim/ylim has been set.

Regards

Pål


On 6 February 2012 18:02, Benjamin Root  wrote:

>
>
> On Mon, Feb 6, 2012 at 4:47 AM, Pål Gunnar Ellingsen wrote:
>
>> Hi
>>
>> I understand that it would be hard to implement, as it requires that all
>> the points are checked, which for a arbitrary plot is not easy.
>> Though is this not what is already done for the normal autoscale, or have
>> I misunderstood how the normal autoscale is done?
>>
>> I would like to have this as a new feature, as it would prove useful for
>> analysing graphs, especially in scientific research.
>>
>> Kind regards
>>
>> Pål
>>
>>
>>
> Pal,
>
> Normal autoscaling (when aspect is None, which is default) means to
> display all the data that has been plotted.  This is possible because the
> plotting functions (which were given the data as input) updates the limits
> of the "known data bounding box" for the axes.  This data is not stored
> except within each artist object, in their own form. It becomes difficult
> to then "re-query" that data in the general case.  It isn't to say that it
> isn't possible to do, just that the architecture isn't set up to query
> subsets of collections.
>
> I hope this is clearer,
> Ben Root
>
>
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting x scale manually, but letting y scale automatic within the current x-axis

2012-02-06 Thread Benjamin Root
On Mon, Feb 6, 2012 at 4:47 AM, Pål Gunnar Ellingsen wrote:

> Hi
>
> I understand that it would be hard to implement, as it requires that all
> the points are checked, which for a arbitrary plot is not easy.
> Though is this not what is already done for the normal autoscale, or have
> I misunderstood how the normal autoscale is done?
>
> I would like to have this as a new feature, as it would prove useful for
> analysing graphs, especially in scientific research.
>
> Kind regards
>
> Pål
>
>
>
Pal,

Normal autoscaling (when aspect is None, which is default) means to display
all the data that has been plotted.  This is possible because the plotting
functions (which were given the data as input) updates the limits of the
"known data bounding box" for the axes.  This data is not stored except
within each artist object, in their own form. It becomes difficult to then
"re-query" that data in the general case.  It isn't to say that it isn't
possible to do, just that the architecture isn't set up to query subsets of
collections.

I hope this is clearer,
Ben Root
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Why pixel marker size is 4 pixels?

2012-02-06 Thread Michael Droettboom
I'm looking into the source of this bug now.

Mike

On 02/06/2012 09:19 AM, Jonathan Slavin wrote:
> Chris,
>
> You might want to try a module written by Tom Robitaille (aka astrofrog)
> called rasterized_scatter.  Look for it on github.
>
> Jon
>
> On Mon, 2012-02-06 at 21:28 +0900, Jae-Joon Lee wrote:
>> Thanks. Now I understand the situation.
>>
>> As far as I can see, marker="," is implemented as a rectangle path
>> with width/height of 1 pixel, so this result in 2x2 pixel filled
>> square.
>> I tried to change the size of the rectangle, etc, to get a single
>> pixel filled square, but did not get a satisfactory result.
>> I think we need an Agg expert. I hope Mike or others take a look.
>>
>> Chris,
>> if you do not get a response from others in this mailing list, I
>> recommend you to open a new issue in our github page.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Mon, Feb 6, 2012 at 1:53 AM, Chris  wrote:
>>> Thanks JJ.
>>>
>>> The problem seems not to be a size issue --  markersize has no effect
>>> when use marker="," (pixel).  I have also tried to turn off aa, and it
>>> doesn't help either.  I also tried different backends.  The PNG output
>>> from Agg and Cairo is slightly different: Agg's point has 4 solid
>>> pixel, while Cairo's has 4 pixel with random shade.
>>>
>>> Postscript output has the same problem.  The "pixel" in an EPS file
>>> generated by mpl is significantly bigger than that from another
>>> drawing program I used.
>>>
>>> The problem occurs in all my plotting scripts, e.g., this basic one:
>>>
>>> [CODE]
>>> import numpy as np
>>>
>>> x=np.arange(100)
>>> y=np.random.randn(100)
>>>
>>> ioff()
>>> fig=gcf()
>>> fig.clf()
>>>
>>> ax=fig.add_axes(0.15,0.1,0.8, 0.85)
>>> ax.plot(x,y,"k,")
>>>
>>> ion()
>>> fig.canvas.draw()
>>> [/CODE]
>>>
>>> Here is how I identify the problem:
>>> 1. use the above script to plot on screen
>>> 2. savefig("plot.png")
>>> 3. open plot.png in GIMP and check the pixel size.
>>>
>>> I also attached the two PNG files generated with Agg and Cairo backends.
>>>
>>>
>>> On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee  wrote:
 How are you plotting your points.

 If you use *plot*, there is a *markersize* parameter.
 If you use *scatter*, the third argument controls the marker size.

 But you may actually complaining about other issues, e.g.,
 antialiasing, etc. So, if above are not your answer, please post a
 complete example and describe your problem in more detail.

 Regards,

 -JJ


 On Sat, Feb 4, 2012 at 2:15 PM, Chris  wrote:
> I noticed this a few years back, but left it aside because most of the
> time I can live with it.  Recently I need to make a few plots
> containing a few million points, and 4 pixels for a point is a
> disaster.  So my question is why the pixel marker size is set at 4
> pixels?  And is there anyway to change it to a single pixel?
>
> Thanks,
> Chris
>
> --
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Change xaxis labels

2012-02-06 Thread C M
On Mon, Feb 6, 2012 at 9:23 AM, David Craig  wrote:

> Hi, I have a plot and the xaxis shows number of seconds after a start
> point. I would like to convert them to days anyone know how to do this.
> I have looked at the documentation but cant find what I need.
>

Couldn't you divide your data points by the conversion (86400) before
plotting?  E.g., 432,000 seconds then becomes 5 days.
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Change xaxis labels

2012-02-06 Thread David Craig
Hi, I have a plot and the xaxis shows number of seconds after a start 
point. I would like to convert them to days anyone know how to do this. 
I have looked at the documentation but cant find what I need.

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Why pixel marker size is 4 pixels?

2012-02-06 Thread Jonathan Slavin
Chris,

You might want to try a module written by Tom Robitaille (aka astrofrog)
called rasterized_scatter.  Look for it on github.

Jon

On Mon, 2012-02-06 at 21:28 +0900, Jae-Joon Lee wrote:
> Thanks. Now I understand the situation.
> 
> As far as I can see, marker="," is implemented as a rectangle path
> with width/height of 1 pixel, so this result in 2x2 pixel filled
> square.
> I tried to change the size of the rectangle, etc, to get a single
> pixel filled square, but did not get a satisfactory result.
> I think we need an Agg expert. I hope Mike or others take a look.
> 
> Chris,
> if you do not get a response from others in this mailing list, I
> recommend you to open a new issue in our github page.
> 
> Regards,
> 
> -JJ
> 
> 
> On Mon, Feb 6, 2012 at 1:53 AM, Chris  wrote:
> > Thanks JJ.
> >
> > The problem seems not to be a size issue --  markersize has no effect
> > when use marker="," (pixel).  I have also tried to turn off aa, and it
> > doesn't help either.  I also tried different backends.  The PNG output
> > from Agg and Cairo is slightly different: Agg's point has 4 solid
> > pixel, while Cairo's has 4 pixel with random shade.
> >
> > Postscript output has the same problem.  The "pixel" in an EPS file
> > generated by mpl is significantly bigger than that from another
> > drawing program I used.
> >
> > The problem occurs in all my plotting scripts, e.g., this basic one:
> >
> > [CODE]
> > import numpy as np
> >
> > x=np.arange(100)
> > y=np.random.randn(100)
> >
> > ioff()
> > fig=gcf()
> > fig.clf()
> >
> > ax=fig.add_axes(0.15,0.1,0.8, 0.85)
> > ax.plot(x,y,"k,")
> >
> > ion()
> > fig.canvas.draw()
> > [/CODE]
> >
> > Here is how I identify the problem:
> > 1. use the above script to plot on screen
> > 2. savefig("plot.png")
> > 3. open plot.png in GIMP and check the pixel size.
> >
> > I also attached the two PNG files generated with Agg and Cairo backends.
> >
> >
> > On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee  wrote:
> >> How are you plotting your points.
> >>
> >> If you use *plot*, there is a *markersize* parameter.
> >> If you use *scatter*, the third argument controls the marker size.
> >>
> >> But you may actually complaining about other issues, e.g.,
> >> antialiasing, etc. So, if above are not your answer, please post a
> >> complete example and describe your problem in more detail.
> >>
> >> Regards,
> >>
> >> -JJ
> >>
> >>
> >> On Sat, Feb 4, 2012 at 2:15 PM, Chris  wrote:
> >>> I noticed this a few years back, but left it aside because most of the
> >>> time I can live with it.  Recently I need to make a few plots
> >>> containing a few million points, and 4 pixels for a point is a
> >>> disaster.  So my question is why the pixel marker size is set at 4
> >>> pixels?  And is there anyway to change it to a single pixel?
> >>>
> >>> Thanks,
> >>> Chris


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Why pixel marker size is 4 pixels?

2012-02-06 Thread Jae-Joon Lee
Thanks. Now I understand the situation.

As far as I can see, marker="," is implemented as a rectangle path
with width/height of 1 pixel, so this result in 2x2 pixel filled
square.
I tried to change the size of the rectangle, etc, to get a single
pixel filled square, but did not get a satisfactory result.
I think we need an Agg expert. I hope Mike or others take a look.

Chris,
if you do not get a response from others in this mailing list, I
recommend you to open a new issue in our github page.

Regards,

-JJ


On Mon, Feb 6, 2012 at 1:53 AM, Chris  wrote:
> Thanks JJ.
>
> The problem seems not to be a size issue --  markersize has no effect
> when use marker="," (pixel).  I have also tried to turn off aa, and it
> doesn't help either.  I also tried different backends.  The PNG output
> from Agg and Cairo is slightly different: Agg's point has 4 solid
> pixel, while Cairo's has 4 pixel with random shade.
>
> Postscript output has the same problem.  The "pixel" in an EPS file
> generated by mpl is significantly bigger than that from another
> drawing program I used.
>
> The problem occurs in all my plotting scripts, e.g., this basic one:
>
> [CODE]
> import numpy as np
>
> x=np.arange(100)
> y=np.random.randn(100)
>
> ioff()
> fig=gcf()
> fig.clf()
>
> ax=fig.add_axes(0.15,0.1,0.8, 0.85)
> ax.plot(x,y,"k,")
>
> ion()
> fig.canvas.draw()
> [/CODE]
>
> Here is how I identify the problem:
> 1. use the above script to plot on screen
> 2. savefig("plot.png")
> 3. open plot.png in GIMP and check the pixel size.
>
> I also attached the two PNG files generated with Agg and Cairo backends.
>
>
> On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee  wrote:
>> How are you plotting your points.
>>
>> If you use *plot*, there is a *markersize* parameter.
>> If you use *scatter*, the third argument controls the marker size.
>>
>> But you may actually complaining about other issues, e.g.,
>> antialiasing, etc. So, if above are not your answer, please post a
>> complete example and describe your problem in more detail.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Sat, Feb 4, 2012 at 2:15 PM, Chris  wrote:
>>> I noticed this a few years back, but left it aside because most of the
>>> time I can live with it.  Recently I need to make a few plots
>>> containing a few million points, and 4 pixels for a point is a
>>> disaster.  So my question is why the pixel marker size is set at 4
>>> pixels?  And is there anyway to change it to a single pixel?
>>>
>>> Thanks,
>>> Chris
>>>
>>> --
>>> Try before you buy = See our experts in action!
>>> The most comprehensive online learning library for Microsoft developers
>>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>>> Metro Style Apps, more. Free future releases when you subscribe now!
>>> http://p.sf.net/sfu/learndevnow-dev2
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting x scale manually, but letting y scale automatic within the current x-axis

2012-02-06 Thread Pål Gunnar Ellingsen
Hi

I understand that it would be hard to implement, as it requires that all
the points are checked, which for a arbitrary plot is not easy.
Though is this not what is already done for the normal autoscale, or have I
misunderstood how the normal autoscale is done?

I would like to have this as a new feature, as it would prove useful for
analysing graphs, especially in scientific research.

Kind regards

Pål





On 3 February 2012 19:56, Eric Firing  wrote:

> On 02/03/2012 06:07 AM, Benjamin Root wrote:
> >
> >
> > On Fri, Feb 3, 2012 at 9:15 AM, Pål Gunnar Ellingsen  > > wrote:
> >
> > Hi
> >
> > Thank you for trying to help me, though I can't see how aspect is
> going
> > to help me. As I understand of the documentation, it would require
> > me to know the
> > relationship between x and y, which I don't.
> > I can calculate it, but since it varies between each change in
> xlimits
> > and different plot, it would be the same as calculating the ylimits.
> >
> > As for pyplot.xlim(xmin,xmax) (suggested by Ethan Swint), it does
> > the same as ax.set_xlim() for me.
> >
> > Below is a sample code that will illustrate the problem.
> >
> > Regards
> >
> > Pål
> >
> > ### Start code 
> >
> > #!/usr/bin/env python
> > import matplotlib
> > matplotlib.use('Qt4Agg')   # generate postscript output by default
> >
> > import matplotlib.pyplot as plt
> > import numpy as np
> >
> > # Creating a function to plot
> > x = np.linspace(-10, 10, 200)
> > p = np.poly1d([2, 3, 1, 4])
> > y = p(x) * np.sin(x)
> >
> > # plotting the full figure
> > fig = plt.figure()
> >
> > ax = fig.add_subplot(111)
> > ax.plot(x, y)
> > ax.autoscale(tight=True)
> > plt.title('Full graph. (Press key for next plot)')
> > plt.draw()
> >
> > plt.waitforbuttonpress()
> >
> > # This is how I'm currently doing it
> > # x limits
> > xmin = 2
> > xmax = 6
> >
> > # Calculating y limits
> > ymin = y[np.logical_and(xmin < x, x < xmax)].min()
> > ymax = y[np.logical_and(xmin < x, x < xmax)].max()
> >
> > # Inserting some room
> > room = np.maximum(np.abs(ymin * 0.05), np.abs(ymax * 0.05))
> > ymin = ymin + room * np.sign(ymin)
> > ymax = ymax + room * np.sign(ymax)
> >
> > # Setting the limits
> > ax.set_xlim([xmin, xmax])
> > ax.set_ylim([ymin, ymax])
> >
> > plt.title('What I want (Press key for next plot)')
> > plt.draw()
> > plt.waitforbuttonpress()
> >
> > # This is what pyplot does by default if I only set the limits
> > ax.autoscale(tight=True)
> > ax.set_xlim([2, 6])
> >
> > plt.title('What I get if I only use set_xlim (Press key for exit)')
> > plt.draw()
> > plt.waitforbuttonpress()
> > plt.close()
> >
> > ### End code 
> >
> >
> >
> > Ok, I see what you want.  You want the y-limits to automatically change
> > to fit only the data that is displayed for the x-domain you have chosen.
>
> This has never been supported; it would have to be a new option.  I
> suspect it would be quite difficult to get this right in general, even
> though the concept seems simple enough.
>
> Eric
>
> >
> > I have tried some tricks, and I am not sure that it is currently
> > possible.  There might even be some sort of bug at play here because the
> > function ax.update_datalim() does not appear to update the internal data
> > used for autoscaling.  We might have to look into this further.
> >
> > Ben Root
> >
> >
> >
> >
> --
> > Try before you buy = See our experts in action!
> > The most comprehensive online learning library for Microsoft developers
> > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> > Metro Style Apps, more. Free future releases when you subscribe now!
> > http://p.sf.net/sfu/learndevnow-dev2
> >
> >
> >
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $9

Re: [Matplotlib-users] specgram memory problem

2012-02-06 Thread Fabrice Silva
On Sat, Feb 4, 2012 at 9:44 AM, Fabrice Silva  wrote:
> Le vendredi 03 février 2012 à 17:39 +, David Craig a écrit :
> > sure how to get it to plot the outputs from specgram. I use
> > specgram as follows,
> > Pxx, freqs, bins, im = plt.specgram(..)
> > what am I trying imshow??
> 
> 
> plt.specgram computes the spectrogram and when calls imshow to display
> the resulting array into an image
> 
> Please tell the shape of Pxx, and try the following
> 
> import numpy as np
> import matplotlib.pyplot as plt
> a = np.empty((12000, 14400), dtype=float)
> plt.imshow(a)
> plt.show()

Le samedi 04 février 2012 à 10:30 +, David Craig a écrit :
> Pxx has shape (6001, 1430) and when I tried the lines of code it returned the 
> following memory error,
> 
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", 
> line 394, in expose_event
> self._render_figure(self._pixmap, w, h)
>   File 
> "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", 
> line 75, in _render_figure
> FigureCanvasAgg.draw(self)
>   File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", 
> line 394, in draw
> self.figure.draw(self.renderer)
>   File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in 
> draw_wrapper
> draw(artist, renderer, *args, **kwargs)
>   File "/usr/lib/python2.7/site-packages/matplotlib/figure.py", line 798, in 
> draw
> func(*args)
>   File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in 
> draw_wrapper
> draw(artist, renderer, *args, **kwargs)
>   File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 1946, in 
> draw
> a.draw(renderer)
>   File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in 
> draw_wrapper
> draw(artist, renderer, *args, **kwargs)
>   File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 354, in 
> draw
> im = self.make_image(renderer.get_image_magnification())
>   File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 569, in 
> make_image
> transformed_viewLim)
>   File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 201, in 
> _get_unsampled_image
> x = self.to_rgba(self._A, self._alpha)
>   File "/usr/lib/python2.7/site-packages/matplotlib/cm.py", line 193, in 
> to_rgba
> x = self.norm(x)
>   File "/usr/lib/python2.7/site-packages/matplotlib/colors.py", line 802, in 
> __call__
> val = ma.asarray(value).astype(np.float)
>   File "/usr/lib/python2.7/site-packages/numpy/ma/core.py", line 2908, in 
> astype
> output = self._data.astype(newtype).view(type(self))
> MemoryError

Please, answer on the mailing list,
It confirms that the troubles lie in the rendering of images. Could you
tell the versions of numpy and matplotlib you are using, and the
characteristics of the computer you are working on ?


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [matplotlib-users] Is it possible to show a fullscreen plot on windows?

2012-02-06 Thread Fabien Lafont
The question is inside the title...

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users