Re: [Matplotlib-users] how to reduce the file size of plots generated with matplotlib

2014-03-22 Thread Andrea Gavana
On 22 March 2014 20:23, Christopher Kuhlman wrote:

> Hello:
>
> I use matplotlib to generate x-y data plots; i.e., 2-D plots.  The problem
> is that the output files (the PDF files containing plots that are generated
> with matplotlib) are huge.  I can generate files that are 100's of KB or
> even MBs.  This seems absurd to me.  These file sizes cause programs that
> use them to come to a grinding halt.  My goal is to reduce the plot files
> that I produce with matplotlib.  Details follow.
>
>
> --
>
> I use matplotlib from EPD.
> Enthought Canopy Python 2.7.3 | 64-bit | (default, Aug  8 2013, 05:37:06)
>
> Matplotlib version:
> >>> print matplotlib.__version__
> 1.3.0
>
> OS:
> I'm using Mac OS X Version 10.8.4.
>
> --
>
> I use a home-grown code whose starting point was an example code on
> matplotlib website.
>
> My relevant imports are:
>
> import numpy
> import scipy
> import pylab
> import matplotlib.pyplot as plt
> import matplotlib
>
> My plotting code lines are:
>
>
> ## PDF.
> outfile = "basefile" + ".pdf"
> ## pylab.savefig(outfile, bbox_inches=0)
> pylab.savefig(outfile,bbox_inches='tight')
>
>
> --
>
> My PDF files contain simple plots which consist of (a) data points only,
> (b) lines between data points (data points not plotted), or (c) both data
> points and lines.
>
> I have a consistent problem in that the files produced have sizes that
> seem way too big.
> For example, most recently, I am plotting 3 data sets; each data set has
> about 90,000 points.  If I plot all three sets in one PDF figure, the file
> size is over 2MB.
>


There is no way ever that a human eye (or the computer screen) is going to
distinguish or even see 90,000 points on a standard line-plot. Especially
if you reduce it to a 3 inch by 3 inch graph. You may want to
downscale/interpolate your data to a more manageable set of points and try
again. I'm no expert of the PDF side of things, but I agree with Goyo that
raster files may give you smaller file sizes.




> This seems absurd to me.  I used R plotting for many years (again, my own
> homegrown code, for 6 years) and never had this issue, and I was making
> these kinds of plots/figures.
>
> I thought it may be a vector/raster issue, but the following web page says
> that PDF are generated as vector image, which, to my understanding (which
> could be wrong), is the more compact format.
> http://matplotlib.org/faq/usage_faq.html
>
> Is there a command I can use to reduce the file size?  Since I am using
> these in reports and publications, the figures are almost always less than
> 3 inches by 3 inches in size; i.e., I do not have issues about taking a
> raster figure and trying to blow it up.  So I am not concerned about
> pixelation problems that occur when an image is increased in size.
>
> Thank you very much.
>
> c
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>



-- 
Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://www.infinity77.net

# - #
def ask_mailing_list_support(email):

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


[Matplotlib-users] Axes changing position while programmatically zooming in/out

2013-09-20 Thread Andrea Gavana
Hello list,

I am creating a series of plots automatically. During the first 10 of
them, I gradually zoom in to a specific area, while during the last 10 I
zoom out to the original axes limits.

The problem is, I am only changing the x/y limits of the axes, not their
position. However, when savefig is called on the figure, the actual axes
position changes (even thought I specifically give the axes position myself
at every iteration).

I am attaching a sample application which demonstrates the problem. This is
on Windows 7, Python 2.7.3, WXAgg, Matplotlib 1.2.0. The output I get for
the axes bbox is as follow (from the attached script):

Reached date: 01-Jan-2010
Bbox('array([[ 0.52953281,  0.062 ],\n   [ 0.90046719,  0.93
 ]])')

Reached date: 01-Feb-2010
Bbox('array([[ 0.5314989,  0.062],\n   [ 0.8985011,  0.93 ]])')

Reached date: 01-Mar-2010
Bbox('array([[ 0.53257326,  0.062 ],\n   [ 0.89742674,  0.93
 ]])')

Reached date: 01-Apr-2010
Bbox('array([[ 0.53371628,  0.062 ],\n   [ 0.89628372,  0.93
 ]])')

Reached date: 01-May-2010
Bbox('array([[ 0.53493477,  0.062 ],\n   [ 0.89506523,  0.93
 ]])')

Reached date: 01-Jun-2010
Bbox('array([[ 0.53623645,  0.062 ],\n   [ 0.89376355,  0.93
 ]])')

Reached date: 01-Jul-2010
Bbox('array([[ 0.53763013,  0.062 ],\n   [ 0.89236987,  0.93
 ]])')

Reached date: 01-Aug-2010
Bbox('array([[ 0.53912594,  0.062 ],\n   [ 0.89087406,  0.93
 ]])')

Reached date: 01-Sep-2010
Bbox('array([[ 0.54073553,  0.062 ],\n   [ 0.88926447,  0.93
 ]])')

Reached date: 01-Oct-2010
Bbox('array([[ 0.54247238,  0.062 ],\n   [ 0.88752762,  0.93
 ]])')

Reached date: 01-Nov-2010
Bbox('array([[ 0.54247238,  0.062 ],\n   [ 0.88752762,  0.93
 ]])')


Does anyone see what I may be doing wrong?

Thank you in advance for your help.

-- 
Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://www.infinity77.net

# - #
def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():
send_message(email)
else:
install_malware()
erase_hard_drives()
# - #


mpl_sample.py
Description: Binary data
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Image as marker and axes "equal" aspect ratio

2012-09-24 Thread Andrea Gavana
On 22 September 2012 16:57, Jae-Joon Lee wrote:
> I recommend you to use OffsetImage. Here is an example of how one can
> use OffsetImage.
>
> http://matplotlib.org/examples/pylab_examples/demo_annotation_box.html
>
> And attached is the modified version of the original script.

Thank you JJ, I wasn't aware of OffsetImage. It works perfectly now,
thanks again.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Image as marker and axes "equal" aspect ratio

2012-09-21 Thread Andrea Gavana
Hi Eric, All,

On 21 September 2012 15:46, Moore, Eric (NIH/NIDDK) [F] wrote:
>> -Original Message-
>> From: Andrea Gavana [mailto:andrea.gav...@gmail.com]
>> Sent: Wednesday, September 19, 2012 11:09 AM
>> To: matplotlib-users@lists.sourceforge.net
>> Subject: [Matplotlib-users] Image as marker and axes "equal" aspect
>> ratio
>>
>> Hi All,
>>
>> I am currently trying to plot 4 points (but they will be more, in
>> an animated sequence later), and I am trying to use an image as a point
>> marker. I am using the axes transData transform to get the point
>> coordinates from the data world to the display world.
>>
>> Everything seems to be working OK (i.e., the images are placed
>> correctly close to the plot points); however, as soon as I try to force
>> the axes into an "equal" aspect ratio with this command:
>>
>> ax.set_aspect('equal')
>>
>> Then all the calculations are messed up and the images end up very far
>> from the plot points. I have tried also the approach mentioned in this
>> StackOverflow post:
>>
>> http://stackoverflow.com/questions/2318288/how-to-use-custom-marker-
>> with-plot
>>
>> But I get the same wrong answer when I set the "equal" aspect ratio for
>> the axes.
>>
>> I am attaching a small sample application which demonstrates the
>> problem, a small  "smiley.png" image needed to run the script and two
>> plots generated by my script, one with the "equal" aspect ratio and the
>> other without.
>>
>> I appreciate any suggestion, as I feel I am missing something
>> important...
>>
> The source of the problem is that the transformation you are using has not 
> been updated to account for your set_aspect call.  I played around a little 
> bit, but I'm not sure how to force mpl to update the transform.  Perhaps 
> someone else can comment.  This is a very fragile way to do things anyway 
> because figimage places the image in screen coordinates and you really would 
> like to place it relative to the axis.

Thank you for your answer and for taking the time to play with the
sample I posted. I know that using figimage is not exactly the best
way to go, but I can only think of two other approaches:

1) Use imshow: from the documentation, it appears to me that you can't
place an image wherever you want, and I was unable to find any example
on how to use imshow to place multiple images in a specific place
inside the axes;

2) Use scatter: again, from the docs it seems that scatter supports
symbols, mathtext, paths and regular polygons, but no images...

I may of course be wrong about the above statements, and again I
welcome any suggestion you may have.

Thank you.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

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


[Matplotlib-users] Image as marker and axes "equal" aspect ratio

2012-09-19 Thread Andrea Gavana
Hi All,

I am currently trying to plot 4 points (but they will be more, in
an animated sequence later), and I am trying to use an image as a
point marker. I am using the axes transData transform to get the point
coordinates from the data world to the display world.

Everything seems to be working OK (i.e., the images are placed
correctly close to the plot points); however, as soon as I try to
force the axes into an "equal" aspect ratio with this command:

ax.set_aspect('equal')

Then all the calculations are messed up and the images end up very far
from the plot points. I have tried also the approach mentioned in this
StackOverflow post:

http://stackoverflow.com/questions/2318288/how-to-use-custom-marker-with-plot

But I get the same wrong answer when I set the "equal" aspect ratio
for the axes.

I am attaching a small sample application which demonstrates the
problem, a small  "smiley.png" image needed to run the script and two
plots generated by my script, one with the "equal" aspect ratio and
the other without.

I appreciate any suggestion, as I feel I am missing something important...

Thank you in advance.


Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

# - #
def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():
send_message(email)
else:
install_malware()
erase_hard_drives()
# - #


image_in_axes.py
Description: Binary data
<><><>--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend with edition capabilities

2012-03-01 Thread Andrea Gavana
On 1 March 2012 21:37, Benjamin Root wrote:
>
>
> On Wed, Feb 29, 2012 at 4:02 PM, Federico Ariza 
> wrote:
>>
>> Dear all
>>
>> I am a long time matplotlib user  (under linux) but new to the list
>> (second post).
>>
>> On of the things that bothers me the most is the inability of the standard
>> backend to change simple things (line color, labels, etc...).
>>
>
> There was a feature a couple of us were hacking on a while back that would
> allow for live switching between color and black&white modes.  Is this sort
> of stuff what you are speaking of?  The changes were too invasive to be
> included, but it was an interesting experiment.

I thought the OP's original question was something like the Matlab
"plot editor" (or whatever is its name), which allows you to edit line
colours, styles, gridlines styles, this kind of stuff on a "live" plot
(mind you, it's been 6 years since I used Matlab for the last time and
I may have forgotten what the "plot editor" does).

Anyway, if I am not completely off-track, this is something I had been
looking for as well in matplotlib a while back (3, 4 years ago), but
at that time I was told it would have been complicated to implement it
for all the "live" backend (I can't recall the exact reason).

I would say that, at least for the backends based on wxPython, this
kind of modify-the-live-plot-via-GUI-interaction should be relatively
straightforward, at least for the GUI part and for the basics (line
styles, colours, markers and so on). However I am not sure what are
the implications on the core matplotlib code.

But if I have misunderstood, I apologize for the noise :-) .

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

>>> import PyQt4.QtGui
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named PyQt4.QtGui
>>>
>>> import pygtk
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named pygtk
>>>
>>> import wx
>>>
>>>

--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] "Visually equivalent" contours/parallels

2012-02-17 Thread Andrea Gavana
Hello Jerzy & All,

On 14 February 2012 17:55, Jerzy Karczmarczuk wrote:
> Andrea, I believe that if you find ONE good visual aspect ratio,
> according to your figure size, that should do. Yo know your
> figsize, and if you know all in your axes([bot,lft,wid, height]), that
> this visual ratio should be easy to fix.

I managed to get *almost* there, but there still is a small glitch. I
attach a self-evident sample, which generates data very similar to the
real ones I have and shows the two "parallel" curves to the main one.

You will notice that the "parallel" curves look parallel almost all
the time, except in a few areas (I have annotated the plot for
reference). I can't see the reason for this difference, but it is
obvious I am missing something.

One thing I didn't include is that in my real-life plot, the figure
size should be full screen (which on my screen means 20x13.65 inches)
and I use the subplots_adjust command like this:

fig.subplots_adjust(left=0.03, right=0.7, bottom=0.04, top=0.96)

Thank you in advance for any suggestion.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/


parallels2.py
Description: Binary data
--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] "Visually equivalent" contours/parallels

2012-02-14 Thread Andrea Gavana
Hi Jerzy,

On 14 February 2012 16:03, Jerzy Karczmarczuk wrote:
> Andrea Gavana :
>> after some great help from the Numpy users list, I have managed to
>> create "parallel curves".
>>
>>
>> But I can't really do that with the set of data I have, as the X and Y
>> variables have different order of magnitude and I need a single
>> subplot on the figure to have rectangular axes (not square).
> (...)
>> So, my question would be: how do I scale the
>> X and Y vectors so that the parallels look parallel to the main curve
>> even if the axes are not square and the X and Y variables have
>> different data-ranges/magnitudes?
> Andrea, you have TWO problems.
>
> The first is to scale your offset according to your axes range. This can
> be done using ax.get_data_ratio(). In your case you will get 5, and this
> factor should enhance your vertical offset wrt. the horizontal.
> (Or, use .get_xlim() and .get_ylim() and do the computations yourself).

Thank you for your answer, I have implemented this and it looks a bit
better (on the real X/Y pairs I have).

> The second problem is that your FIGURE scales your plot visually,
> independently of your axes, so without special scaling it will have
> different aspects according to your manipulation. An arbitrary affine
> transform will keep straight lines parallel, but no chance with
> arbitrary curves.  You may play with fig.get_figwidth(), etc., but here
> my digging stops.

Will this argument still stand if I am only interested in a single
figure size (maximized window on my screen, plus set_size_inches(20,
12)) and fixed axes positions (set by figure.subplots_adjust)? If not,
should the further scaling simply be the ratio between the x-axis
extent and y-axis extent (in pixels)? Or am I missing something
(again)?

Thank you in advance for your suggestions.


Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

--
Keep Your Developer Skills Current with LearnDevNow!
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-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] "Visually equivalent" contours/parallels

2012-02-14 Thread Andrea Gavana
Hi All,

after some great help from the Numpy users list, I have managed to
create "parallel curves".

Basically I have a set of X, Y data (around 1,000 elements each) and I
want to create 2 parallel "curves" (offset curves) to the original
one; "parallel" means curves which are displaced from the base curve
by a constant offset, either positive or negative, in the direction of
the curve's normal. I attach a sample demonstrating what I am doing
(and if you have the Shapely package installed, the two additional
subplots look even nicer).

Now, the generated parallels are really parallels (see right subplot),
but visually it doesn't seem so (see the left subplot) because the X
and Y scales are different and the axes area is not square. I know I
could force the axes to be equals via:

ax.set_aspect('equal', 'datalim')

But I can't really do that with the set of data I have, as the X and Y
variables have different order of magnitude and I need a single
subplot on the figure to have rectangular axes (not square). In my
situation, unfortunately it wouldn't make sense to set the axes
square/equal as the plot will lose its meaning and visual usefulness.

I have been told to scale the X, Y variables normalizing them by the
display units of the plot, but I must be dumber than usual as I can't
get it to work properly. So, my question would be: how do I scale the
X and Y vectors so that the parallels look parallel to the main curve
even if the axes are not square and the X and Y variables have
different data-ranges/magnitudes?

Thank you in advance for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/


sample_buffer.py
Description: Binary data
--
Keep Your Developer Skills Current with LearnDevNow!
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-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Runtime customization of plots

2010-03-03 Thread Andrea Gavana
Hi,

On 3 March 2010 00:18, Gökhan Sever wrote:
>
>
> On Tue, Mar 2, 2010 at 5:57 PM, Andrea Gavana 
> wrote:
>>
>> Hi All,
>>
>>    I believe this question has been already asked in the past (I
>> found something at
>>
>> http://old.nabble.com/A-good,-interactive-plotting-package-td15396445.html).
>>
>> I use matplotlib extensively in our applications, and some of my users
>> repetitively asked for a way to customize *in runtime* the plots my
>> apps generate. I.e., the app brings up a figure with a bunch of lines,
>> points and texts, and they would like to change this linewidth, the
>> colour of that point, the appearance of an axis, the legend keys and
>> so on. I am currently answering "it can't be done at the moment" :-D.
>> It is obviously not true, it just require some (a lot, maybe) work.
>
> I can list three ways to interact with active plots:
>
> 1-)  Using keyboard shortcuts: Changing scaling  using "k" and "l" keys are
> my favorite. See more at
> http://matplotlib.sourceforge.net/users/navigation_toolbar.html
>
> 2-) Using the interactive navigation toolbar and with a small extension
> written by Pierre Raybaut (on Qt4Agg backend) For a screenshot see
> http://img156.imageshack.us/img156/9210/mplqtextra.png
> This is open to development. Actually many of the command line mpl interface
> could be integrated into that window.
>
> 3-) Directly from within IPython shell. That's another useful way of
> updating figure properties (e.g. adding labels, changing font) IPython and
> matplotlib are very well integrated in that manner. Similarly, Mayavi does a
> great job of integrating shell and UI.

Only the second approach slightly resembles what I have in mind.
Navigating the plot using shortcuts and the MPL toolbars is less than
1% of what you can do to customize a MPL plot. Asking a user who knows
nothing about Python (or programming in general) to use the IPython
shell to modify the plot in runtime is unrealistic at best.

The second approach looks interesting (pity it's been done using Qt,
but then, the world is not perfect either...). I could use some of
that code to build something that looks like a *beginning* of a
possible customization of plots (using THE GUI toolkit). I thought
this issue could have been important, as any other 2D/3D plotting
toolkits (commercial and not commercial) have some (or a lot) of
ability to customize their plots once they have been generated...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Runtime customization of plots

2010-03-02 Thread Andrea Gavana
Hi All,

I believe this question has been already asked in the past (I
found something at
http://old.nabble.com/A-good,-interactive-plotting-package-td15396445.html).

I use matplotlib extensively in our applications, and some of my users
repetitively asked for a way to customize *in runtime* the plots my
apps generate. I.e., the app brings up a figure with a bunch of lines,
points and texts, and they would like to change this linewidth, the
colour of that point, the appearance of an axis, the legend keys and
so on. I am currently answering "it can't be done at the moment" :-D.
It is obviously not true, it just require some (a lot, maybe) work.

Now, I know nothing about the other backends, but I know something
about wx and I believe it is doable. Obviously, if my job was software
programming and not reservoir engineering I would already have given
it a try, but unfortunately we only get 24 hours per day...

I don't think anything like this already exists, but it's an innocent
question and I hope I won't be kicked for asking :-D . If someone
knows about a possible/existing implementation, or even a start of an
implementation, please let me know.

Thank you.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Optimal positioning of text

2010-03-01 Thread Andrea Gavana
Hi Jae-Joon & All,

On 28 February 2010 03:09, Jae-Joon Lee wrote:
> If I read your correctly,
>
>       for l, b in zip(x, y):
>
>          # And here  I work with data coordinates (!)
>
>           dashBox = Bbox.from_bounds(l, b, width+5, height+5)
>           badness = 0
>           for line in lines:
>               if line.intersects_bbox(dashBox):
>                   badness += 1
>
> x, y (therefore l, b) in data coordinate.
> width, height?? this seems to be some wx specific coordinate, i have no idea.
> lines (therefore line)  in display coordinate.
>
> converting x,y to display coordinate should straight forward. But I'm
> not sure what kind of coordinate width and height has. Is it a method
> of some class derived from matplotlib's Text?? If then, the extent of
> the text can be measured using the get_window_extent method. This
> requires a renderer instance, which should be known if the method is
> called during the drawing time.
>
> Again, post a complete but simple(!) code.

OK, I think I got a complete code. Not super-simple, but simple enough
I believe. After you run it you'll see a bunch of points and lines
with some text. If you left-click inside the axis this will start the
calculations for the "optimal positioning". There are a couple of
problems:

1) The code I have looks only for optimal positioning with respect to
lines in the plot, it doesn't include texts (I don't know how to do
it); You'll see what I mean if you run the code, the "optimally"
positioned texts overlap with other text in the plot, and with
themselves too (i.e., one "optimally" positioned text overlap with
another "optimally" positioned text);
2) The code as it stands it's very slow. On my (relatively fast)
computer, it takes almost 6 seconds to "optimally" position 14 labels.

In order to run the code, you'll also need the "lines.txt" file, which
contains the main lines coordinates. Sorry about this extra file but I
wanted it to be as close as possible to my use-case.

Thank you in advance for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/
import wx
import numpy
import matplotlib
import time

matplotlib.use("WXAGG")

from matplotlib.transforms import Bbox
from matplotlib.pyplot import figure, show


x = [71, 75, 56, 61, 42, 73, 89, 17, 70, 89, 26.2, 77, 82, 80, 53, 47,
 54, 46, 84, 29, 26, 89, 50, 71, 62, 69, 75, 76, 66, 70, 71, 85, 60]
y = [42, 31, 42, 43, 34, 31, 13, 39, 58, 47, 42.5, 39, 25, 12, 34, 46,
 13, 17.7, 59, 26, 33, 57, 40, 22, 47, 40, 45, 17, 55, 51, 63, 24, 16.5]

pointNames = ["Point_%d"%indx for indx in xrange(1, len(x)+1)]

fid = open("lines.txt", "rt")
xLines = eval(fid.readline().strip())
yLines = eval(fid.readline().strip())
fid.close()

lineNames = ["Line_%d"%indx for indx in xrange(1, len(xLines)+1)]

lineText = "MODEL 1: %0.6g\nMODEL 2: %0.6g"
multValues = numpy.random.random((len(x), 2))


def button_press_callback(event):

if event.inaxes is not None:
start = time.clock()
ax = event.inaxes
position_labels(ax)
print "\nElapsed Time:", time.clock() - start
ax.get_figure().canvas.mpl_disconnect('button_press_event')


def position_labels(ax):

dc = wx.MemoryDC()
dc.SelectObject(wx.EmptyBitmap(1, 1))
font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
font.SetPointSize(8)
dc.SetFont(font)

inv = ax.transData.inverted()
count = 0

for xl, yl in zip(xLines, yLines):
name = lineText%(multValues[count][0], multValues[count][1])

txt = ax.text(xl[0], yl[0], name, fontsize=8, withdash=True, 
dashdirection=1,
  dashlength=10, rotation=0, dashrotation=90, dashpush=10)
txt.set_backgroundcolor((1, 1, 1))
txt.set_multialignment("left")

ox, oy = position_annotation(dc, ax, name, txt, xl, yl)
ox1, oy1 = inv.transform((ox, oy))
txt.set_position((ox1, oy1))
count += 1

dc.SelectObject(wx.NullBitmap)
ax.get_figure().canvas.draw()


def position_annotation(dc, ax, name, txt, xl, yl):

lines = []

for handle in ax.lines:
path = handle.get_path()
trans = handle.get_transform()
tpath = trans.transform_path(path)
lines.append(tpath)

width, height, dummy = dc.GetMultiLineTextExtent(name)
candidates = []

values = ax.transData.transform(zip(xl, yl))

for l, b in values:
dashBox = Bbox.from_bounds(l, b, width, height)
badness = 0
for line in lines:
if line.intersects_bbox(dashBox):
badness += 1

if badness == 0:
return l, b

candidates.append((badness, (l, b)))

# rather than use min() or list.sort(), do this so that we are assured
# that in the case of two equal badnesses, the one first considered is
# returned.
# NOTE: list.sort() is stable.But leave

Re: [Matplotlib-users] Optimal positioning of text

2010-02-27 Thread Andrea Gavana
On 28 February 2010 01:18, Jae-Joon Lee wrote:
> On Sat, Feb 27, 2010 at 12:29 PM, Andrea Gavana  
> wrote:
>> This code is not doing anything useful as I always get a badness of 0,
>> although I can see that the new text overlaps quite a lot of other
>> artists.
>>
>> Does anyone have some suggestion on how to improve the code?
>>
>
> A snippet of code seldom helps.
> Is your x,y input in display coordinates?

No, data values.

> Ideally, this must be checked in the drawing time (as in the legend).

This is what I am trying to do, but I messed up screen/data/canvas
coordinates and I can't get my head around it :-(

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Optimal positioning of text

2010-02-27 Thread Andrea Gavana
Hi All,

I am trying to visualize some more text in an already rather
crowded 2D plot. As this new information I want to display is optional
(it depends on a use choice) but possibly very useful as information,
I would like to add it as text inside my plot, and possibly to add it
in a "smart" way (i.e., with minimum or no overlapping between this
new text and the rest of the plot, like legend does with loc=0).

Now, I have tried to steal the code from legend.py but I am not
getting anywhere, also because I am mixing display coordinates, data
coordinates and wx.DC text extents and I am getting crazy :-(

This is the code I have so far:


def PositionAnnotation(self, dc, label, dash, x, y):
"""
Position a matplotlib text instance without overlapping with
the rest of the data.

:param `dc`: an instance of wx.ClientDC;
:param `label`: the label to display (2 lines of text);
:param `dash`: the actual TextWithDash matplotlib class to position
:param `x`: a list of possible x location (this is fixed)
:param `y`: a list of possible y location (this is fixed)
"""

# Stolen from legend.py
lines = []

   # Here I work with display coordinates (!)

for handle in self.leftaxis.lines:
path = handle.get_path()
trans = handle.get_transform()
tpath = trans.transform_path(path)
lines.append(tpath)

# End of stolen from legend.py

   # Here I work with screen/character coordinates (!)
width, height, dummy = dc.GetMultiLineTextExtent(label)
candidates = []

for l, b in zip(x, y):

   # And here  I work with data coordinates (!)

dashBox = Bbox.from_bounds(l, b, width+5, height+5)
badness = 0
for line in lines:
if line.intersects_bbox(dashBox):
badness += 1

ox, oy = l, b
if badness == 0:
return ox, oy

candidates.append((badness, (l, b)))

# Stolen from legend.py

# rather than use min() or list.sort(), do this so that we are assured
# that in the case of two equal badnesses, the one first considered is
# returned.
# NOTE: list.sort() is stable.But leave as it is for now. -JJL
minCandidate = candidates[0]
for candidate in candidates:
if candidate[0] < minCandidate[0]:
minCandidate = candidate

ox, oy = minCandidate[1]

return ox, oy


This code is not doing anything useful as I always get a badness of 0,
although I can see that the new text overlaps quite a lot of other
artists.

Does anyone have some suggestion on how to improve the code?

Thank you in advance.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot(x,y) Trouble?

2010-02-21 Thread Andrea Gavana
On 21 February 2010 15:44, Alan G Isaac wrote:
> On 2/21/2010 10:29 AM, Wayne Watson wrote:
>> plot(2.8,3.4) doesn't work in my program
>>
>
> Why should it?

I believe it should.

> Plot takes once or two *sequences* of numbers as arguments.

I don't think it would be so complicated for the "plot" code to check
for the type of the input arguments and then create a list (or a
sequence) on the fly, i.e. (pseudo-code, untested):

if isinstance(x, types.IntType):
   x = [x]

The same apply for the second input.

As it appears to work in tools like Matlab, I don't see why MPL should
not support it. But then, I am no expert in MPL so it might be
difficult to do it for other reasons.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Movable Legend

2009-10-27 Thread Andrea Gavana
Hi Jae-Joon,

2009/10/26 Jae-Joon Lee:
> This is a known bug. While this is fixed in the svn, this did go into
> the maint. branch.
> As a workaround, add the following line after line 70.
>
>        self.legend.set_axes(self.subplot)

Thank you for your help, it works perfectly.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Movable Legend

2009-10-26 Thread Andrea Gavana
Hi All,

a while ago, Che posted a nice example on how to drag a legend
with the mouse. I have upgraded to matplotlib 0.99.1 and it looks like
the nice example is not working anymore: for the life of me I can't
figure out what's wrong. I attach the runnable sample submitted
originally.

Any suggestion regarding what's wrong with the code?

Thank you in advance.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/
#Boa:Frame:Frame1

import wx

import matplotlib
matplotlib.interactive(True)
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure

def create(parent):
return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1NOTEBOOK1, wxID_FRAME1PANEL1, 
] = [wx.NewId() for _init_ctrls in range(3)]

class PlotPanel(wx.Panel):
def __init__(self, parent,id = -1, color = None,\
dpi = None, style = wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs):
self.gotLegend = 0  #to begin, legend is not picked.

self.parent = parent
self.line_collections_list = []

wx.Panel.__init__(self, parent, **kwargs)

self.figure = Figure(None, dpi)
self.canvas = FigureCanvasWxAgg( self, -1, self.figure )

#Connect all the mpl events
self.canvas.mpl_connect('motion_notify_event', self.on_motion)
self.canvas.mpl_connect('pick_event', self.on_pick)
self.canvas.mpl_connect('button_release_event', self.on_release)

self._SetInitialSize()

self.Bind(wx.EVT_SIZE, self._onSize)

self.draw()

#a few sizing issues, not relevant to this draggable legend point.
def _onSize(self, event):
self._SetSize()
event.Skip()

def _SetSize( self ):
pixels = tuple( self.GetClientSize() )
self.SetSize( pixels )
self.canvas.SetSize( pixels )
self.figure.set_size_inches( float( pixels[0] )/self.figure.get_dpi(),
 float( pixels[1] )/self.figure.get_dpi() )

def _SetInitialSize(self,):
pixels = self.parent.GetClientSize()
self.canvas.SetSize(pixels)
self.figure.set_size_inches( (pixels[0])/self.figure.get_dpi(), 
 (pixels[1])/self.figure.get_dpi(), forward=True )

def draw(self): 
self.subplot = self.figure.add_subplot(111)
line, = self.subplot.plot([1],[6],'o',picker=5) 
if self.gotLegend == 0:  #need to prevent it from keep appending each 
time if it is just moving legend.
self.line_collections_list.append(line)

#Legend.
self.legend = self.subplot.legend(self.line_collections_list, ['1'], 
numpoints=1)
self.legend.set_picker(self.my_legend_picker)

#pick up the legend patch
def my_legend_picker(self, legend, event): 
return self.legend.legendPatch.contains(event)   

#pick the legend
def on_pick(self, event):
legend = self.legend
if event.artist == legend:
bbox = self.legend.get_window_extent()  #gets the box of the legend.
self.mouse_x = event.mouseevent.x  #get mouse coordinates at time 
of pick.
self.mouse_y = event.mouseevent.y
print 'mouse x position at pick time', self.mouse_x
print 'mouse y position at pick time', self.mouse_y
self.legend_x = bbox.xmin  #get legend coordinates at time 
of pick.
self.legend_y = bbox.ymin 
print 'Legend x position @ pick time = ', self.legend_x
print 'Legend y position @ pick time= ', self.legend_y
self.gotLegend = 1  #indicates we picked up the legend.

#drag the legend
def on_motion(self, event):  
if self.gotLegend == 1:
x = mouse_diff_x = self.mouse_x - event.x  #how much the mouse 
moved.
y = mouse_diff_y = self.mouse_y - event.y

print 'motion_event.x =', event.x
print 'motion_event.y =', event.y
print 'mouse moved x = ', mouse_diff_x
print 'mouse moved y = ', mouse_diff_y

#move the legend from its previous location by that same amount
loc_in_canvas = self.legend_x - mouse_diff_x, self.legend_y - 
mouse_diff_y
#transform into legend coordinate system
loc_in_norm_axes = 
self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas)
self.legend._loc = tuple(loc_in_norm_axes)

self.canvas.draw()

#release the legend
def on_release(self, event):
if self.gotLegend == 1:
self.gotLegend = 0
print 'legend released'

class Frame1(wx.Frame):
def _init_coll_boxSizer1_Items(self, parent):
# generated method, don't edit

parent.AddWindow(self.notebook1, 1,

Re: [Matplotlib-users] Contour/Contourf misunderstanding?

2008-12-10 Thread Andrea Gavana
Hi Mauro & All,

On Wed, Dec 10, 2008 at 10:32 AM, Mauro Cavalcanti wrote:
> Dear Andrea,
>
> Greetings. I have tried your script here.
>
> 2008/12/10 Andrea Gavana <[EMAIL PROTECTED]>:
>> I attach my small sample to the message. Am I doing something worng in
>> my call to contour? Why I am unable to see the 20 contour I specified
>> in my vector V?
>
> But you can. Simply change the line below to:
>> CS = plt.contourf(X, Y, Z, V=V)
>
>> CS = plt.contourf(X, Y, Z, V)
> (I did not understand the reason behind the "V=V" in the argument list?)

Ah! I thought "V" was a keyword argument. Shame on me. Thank you for the hint.

>> Another related problem is with contourf: if I modify the attached
>> sample to use contourf and clabel, I get this error:
>
> Well, this one I do not understand myself.

Uhm, I will wait for further suggestions. Maybe I am doing something
stupid, again ;-)

Thank you!

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Contour/Contourf misunderstanding?

2008-12-10 Thread Andrea Gavana
Hi All,

I am trying to create a contour map with matplotlib. I have
modified the source code for the contour sample which comes with the
matplotlib 0.98.3 online documentation: I am using the "contour(X, Y,
Z, V)" API call and, as the docs say:

"""
contour(X,Y,Z,V)
draw contour lines at the values specified in sequence V
"""

I have specified a 20-elements vector in V, buit I still only see 6
contours being drawn, namely the ones at the values:

[-1.0, -0.5, 0.0, 0.5, 1.0, 1.5]


I attach my small sample to the message. Am I doing something worng in
my call to contour? Why I am unable to see the 20 contour I specified
in my vector V?

Another related problem is with contourf: if I modify the attached
sample to use contourf and clabel, I get this error:

Traceback (most recent call last):
  File "E:\MyProjects\prova143.py", line 24, in 
plt.clabel(CS, fontsize=9, inline=1)
  File "C:\Python25\lib\site-packages\matplotlib\pyplot.py", line
1736, in clabel
ret =  gca().clabel(*args, **kwargs)
  File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 6027, in clabel
return CS.clabel(*args, **kwargs)
  File "C:\Python25\lib\site-packages\matplotlib\contour.py", line
161, in clabel
self.labelCValueList = np.take(self.cvalues, self.labelIndiceList)
  File "C:\Python25\lib\site-packages\numpy\core\fromnumeric.py", line
85, in take
return take(indices, axis, out, mode)
IndexError: index out of range for array


This is in Windows XP, Python 2.5.2, matplotlib 0.98.3, numpy 1.2.0.

Thank you for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/


# CODE START

#!/usr/bin/env python

import matplotlib
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt

delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)

V = np.linspace(np.min(np.min(Z)), np.max(np.max(Z)), 20)

print V

# And you can manually specify the colors of the contour
plt.figure()
CS = plt.contourf(X, Y, Z, V=V)
plt.clabel(CS, fontsize=9, inline=1)

plt.show()

# CODE END

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Box Off on Axis

2008-07-15 Thread Andrea Gavana
Hi All,

I am helping my girlfriend in doing some plots for her thesis (!).
Normally, matplotlib puts the graph in a box, left y axis, bottom x
axis, right y axis, top x axis. What she would like to do is to remove
the right y axis and the top x axis, akin the matlab command "box off"
(if I remember correctly), leaving just the 2 principal axis in the
plot.
I remember seeing something like that done with matplotlib, but
tonight my google-fu is really bad...
Is there a way to do what she is asking me to do? ;-)

Thank you in advance for all suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axis Limits and Dash Text Misbehaviours

2008-06-30 Thread Andrea Gavana
Hi All,

On 6/27/08, Andrea Gavana wrote:
> Hi Michael,
>
> On Fri, Jun 27, 2008 at 7:54 PM, Michael Droettboom wrote:
> > Andrea Gavana wrote:
> >>
> >> 2) The dashed text positioning is wrong, you can see it by running
> >> dashpointlabel.py in the
> >> matplotlib_examples_0.98.1\examples\pylab_examples: the position of
> >> the values should be at the other end of the dash, not over the
> >> plotted point.
> >>
> >
> > I believe I have this fixed in SVN.  Please kick the tires and let me know
> > if you still have problems.

It seems like Michael changes were reverted back to the previous
behaviour. I have scanned the matplotlib-devel archives and found the
reason. Even if the message says that text.py is fixed, I still see
the problem I was having in dashpointlabel.py example using the latest
text.py from SVN. I am probably missing something...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axis Limits and Dash Text Misbehaviours

2008-06-27 Thread Andrea Gavana
Hi Michael,

On Fri, Jun 27, 2008 at 7:54 PM, Michael Droettboom wrote:
> Andrea Gavana wrote:
>>
>> 2) The dashed text positioning is wrong, you can see it by running
>> dashpointlabel.py in the
>> matplotlib_examples_0.98.1\examples\pylab_examples: the position of
>> the values should be at the other end of the dash, not over the
>> plotted point.
>>
>
> I believe I have this fixed in SVN.  Please kick the tires and let me know
> if you still have problems.

Thank you for the very fast answer and fix. Everything looks fine at
the moment, I'll do some more testing on monday but I don't expect any
problem.

Thank you!

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: offset_copy in transforms.py... Gone?

2008-06-27 Thread Andrea Gavana
-- Forwarded message --
From: Andrea Gavana <[EMAIL PROTECTED]>
Date: Jun 27, 2008 1:53 PM
Subject: Re: [Matplotlib-users] offset_copy in transforms.py... Gone?
To: Michael Droettboom <[EMAIL PROTECTED]>


Hi Michael,

On 6/27/08, Michael Droettboom wrote:
> Yes, this is one of the casualties of the transforms refactoring in 0.98.
> The new transformation framework is documented here:
>
> http://matplotlib.sourceforge.net/doc/html/devel/transformations.html
>
> Most of the changes from 0.91 to 0.98 are documented here:
>
> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/API_CHANGES?view=markup
>
> ...but it seems offset_copy was overlooked (probably because no code
> internal to matplotlib was using it.)
>
> You can do something like this to simulate offset_copy:
>
>  return ax.transData + transforms.Affine2D().translate(x,
> y)
>
> Let me know if that works in your context.  If not, I'm glad to help.

Thank you for the quick answer. I did some quick testing and
everything seems to work perfectly. Thank you again.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/


-- 
Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Axis Limits and Dash Text Misbehaviours

2008-06-27 Thread Andrea Gavana
Hi All,

I have switched from matplotlib 0.91.2 to 0.98.1, and I have
noticed a couple of "strange" behaviours (I am not using PyLab, but
matplotlib embedded in wxPython):

1) If I use:

ylims = self.myAxis.get_ylim()

And then I add other lines to the plot, the value of ylims is
modified. It gets modified even if I use something like this:

ylims = self.myAxis.get_ylim()[:]

The only way of keeping the ylims list untouched by other plotting
commands I have to do this:

ylims = copy.deepcopy(self.leftaxis.get_ylim())

Which is a bit of an overkill. See the attached Python script for an
example. This did not happen before in 0.91.2.

2) The dashed text positioning is wrong, you can see it by running
dashpointlabel.py in the
matplotlib_examples_0.98.1\examples\pylab_examples: the position of
the values should be at the other end of the dash, not over the
plotted point.

Am I missing something?

Thank you for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
#!/usr/bin/env python

import wx

from numpy import arange, sin, pi
import matplotlib

matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.figure import Figure

class CanvasFrame(wx.Frame):

def __init__(self):

wx.Frame.__init__(self, None,-1,
 'CanvasFrame',size=(550,350))

self.SetBackgroundColour(wx.NamedColor("WHITE"))

self.figure = Figure()
self.canvas = FigureCanvas(self, -1, self.figure)

self.axes = self.figure.add_subplot(111)
t = arange(0.0, 3.0, 0.01)
s = sin(2*pi*t)

self.axes.plot(t,s)
ylims = self.axes.get_ylim()
print "\nBEFORE ADDING ANOTHER PLOT ==> ylims =", ylims

self.axes.plot([2.0], [3.0])
print "AFTER  ADDING ANOTHER PLOT ==> ylims =", ylims


def OnPaint(self, event):

self.canvas.draw()


class App(wx.App):

def OnInit(self):
'Create the main window and insert the custom frame'
frame = CanvasFrame()
frame.Show(True)

return True

app = App(0)
app.MainLoop()
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] offset_copy in transforms.py... Gone?

2008-06-27 Thread Andrea Gavana
Hi All,

I have upgraded matplotlib from an old version I was using
(0.91.2) to the very latest one (0.98.1). In one of my applications, I
am using this code:

from matplotlib.transforms import offset_copy

def offset(ax, x, y):
return offset_copy(ax.transData, x=x, y=y, units='dots')

Right now I get:

Traceback (most recent call last):
  File "E:\MyProjects\SimKill\SimKill.py", line 9, in 
from PlotPage import PlotPage
  File "E:\MyProjects\SimKill\PlotPage.py", line 11, in 
from matplotlib.transforms import offset_copy
ImportError: cannot import name offset_copy

Is offset_copy gone? How can I modify my code to get back the original
behaviour?

Thank you for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread Andrea Gavana
Hi Michael,

On Fri, Jun 13, 2008 at 2:23 PM, Michael Droettboom wrote:
> FWIW, I developed the new wx backend using wx 2.8.6.1, and it does currently
> work for me.  Unfortunately, it's always hard to know how to write for a
> broad range of point releases for wxPython -- the documentation offers
> little clues about when features were added or changed.

Then it might be possible that something has changed between 2.8.4.0
(the OP wxPython version) and 2.8.6.0 (yours), although it looks like
a wxWidgets difference rather than a wxPython one...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend_wx and 0.98.0

2008-06-13 Thread Andrea Gavana
Hi Stan,

On Fri, Jun 13, 2008 at 2:09 PM, Stan West wrote:
> For what it's worth, the WX backend isn't working for me with wxPython
> 2.8.4; I get the following when I attempt to show a figure:
>
>  File "C:\Program
> Files\Python25\lib\site-packages\matplotlib-0.98.0_r5467-py2.5-win32.egg\mat
> plotlib\backends\backend_wx.py", line 474, in select
>self.SelectObject(self.bitmap)
> AttributeError: GraphicsContextWx instance has no attribute 'SelectObject'
>
> I'm at wxPython 2.8.4 simply because it is included with the Enthought
> Python Distribution that I picked for getting started with Python.
>
> However, I don't normally use the WX backend.  I've been using WXAgg, so WX
> is relevant for me only for the functionality inherited by WXAgg.

Please upgrade wxPython to the latest release (2.8.7.1) from here:

http://www.wxpython.org/download.php#binaries

Or use the very latest pre-release:

http://wxpython.wxcommunity.com/preview/20080608

This will (probably) fix the problem you see with wx.GraphicsContext,
although I know next to nothing about matplotlib internal handling of
wxPython things.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Custom Pie-Like Marker In Scatter

2008-04-19 Thread Andrea Gavana
Hi Manuel,

On Fri, Apr 18, 2008 at 8:49 AM, Manuel Metz wrote:
>
> Andrea Gavana wrote:
> > Hi All,
> >
> >   I was wondering about custom markers in the scatter method, and I
> > thought to ask here for some suggestions.
> > Basically, I have 3 variables to show, which are oil, gas and water
> > production. I would like to define the bubble size by the sum of these
> > three variables (or something akin), and then I would like to be able
> > to split the bubble marker in 3 sections (like having a small pie
> > chart in place of the marker), with each section area proportional to
> > the value of oil, gas and water production respectively. I know this
> > might sound not very clear, I attach a small picture of what I mean
> > (the picture shows the bubble divided into 2 sections, but the purpose
> > is the same).
> > I know about custom marker, but I am not so expert with matplotlib to
> > be able to implement it... could someone please share some suggestion
> > on how to do this?
> >
> > Thank you very much.
> >
> > Andrea.
> >
>
> Hi,
> as you already suggested, you have to do a little hand-work, but its not too
> hard. I attached an example, which you can use as a starting point...

Thank you for the sample, this is exactly wht I was looking for. Thank
you very much!

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Custom Pie-Like Marker In Scatter

2008-04-17 Thread Andrea Gavana
Hi All,

   I was wondering about custom markers in the scatter method, and I
thought to ask here for some suggestions.
Basically, I have 3 variables to show, which are oil, gas and water
production. I would like to define the bubble size by the sum of these
three variables (or something akin), and then I would like to be able
to split the bubble marker in 3 sections (like having a small pie
chart in place of the marker), with each section area proportional to
the value of oil, gas and water production respectively. I know this
might sound not very clear, I attach a small picture of what I mean
(the picture shows the bubble divided into 2 sections, but the purpose
is the same).
I know about custom marker, but I am not so expert with matplotlib to
be able to implement it... could someone please share some suggestion
on how to do this?

Thank you very much.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
<>-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plot vs Line Collections

2007-06-02 Thread Andrea Gavana
Hi John and All,

On 6/1/07, Andrea Gavana  wrote:
> Hi John,
>
> On 5/31/07, John Hunter wrote:
> > On 5/31/07, Andrea Gavana <[EMAIL PROTECTED]> wrote:
> > > Hi All,
> > >
> > > I am writing an application (wxPython based) which embeds a big
> > > matplotlib figure as a main panel. Basically, this app shows oil well
> > > producers and gas injectors on a 2D map as dots (every dot represents
> > > its surface location), and a bunch of "streamlines" (i.e., straight
> > > lines or simple curves) which connect injectors and producers.
> > > As the numerical simulation continues, more and more streamlines are
> > > added to the plot (because of new wells or because interference
> > > between wells), and actually I end up having 200 dots plus 800-1200
> > > lines. As the simulation progresses, the plots become slower and
> > > slower...
> > > As the lines are usually 2-points straight lines, I was thinking about
> > > using Line Collections; however, every matplotlib line has a linewidth
> > > value that is dependent on the calculated "interference" effect
> > > between wells, which means I have to build a matplotlib line for every
> > > line connecting an injector with a producer. Moreover, every injector
> > > well has its own colour for the streamlines (there are 33 injector
> > > wells).
> > > Will Line Collections save some time in this case? If not, does anyone
> > > have a suggestion on how I could try to speed-up the plotting? I am
> > > not really familiar with some obscure line/axes properties, so I may
> > > have overlooked something.
> >
> > Yes, a line collection will save you a lot of time with upwards of
> > 1000 line segments.  This is the use case they were designed to solve:
> > a bunch of segments of differing widths and colors.  One could
> > optimize it for the special case of simple line segments, ie [(x1,y1),
> > (x2, y2)] in which case we could use numpy arrays, but currently we
> > have only the general case of a collection of arbitrary length
> > segments, and since they are not necessarily the same length, we use a
> > sequence of segments rather than an array, and this is slower than it
> > could be.
>
> I managed to get things twice faster than before using Line
> Collections (even though some more optimization can be done). However,
> I am facing a problem with the legend: as I put all the lines in a
> single collection, and I don't want all the lines to be marked in the
> legend but only the ones with biggest linewidth for every injector
> well, how do I get a particular line of the collection in order to
> legend() that line only? I didn't find any method or attribute about
> that. Maybe it is just plain impossible.
>
> Thank you for every hint.

I probably solved this thing, with a workaround instead of a real
solution. Instead of definining a single Line Collection for all the
lines, I just build a Line Collection for every injector well (from
which the lines start). That means I have at most 33 Line Collections
to plot instead of 800-1000 calls to axis.plot(), and I can use the
legend() command. It's not optimal, but it works sufficiently fast.
I still have a couple of questions:

1) I am plotting a bunch of points (which represent the well positions
on a 2D map) and next to them the well names as axis.text() instances.
I don't think something like a "Text Collection" exists, but is there
a way to draw a bunch of texts without a loop?
2) I am currently using the pure Python implementation of the WxAgg
backend, as with wxPython 2.8.4 and the pyd backend I always get the
message that "wxPython2.6-unicode can not be found" or something like
that. Is there any plan to adapt matplotlib to use the available
wxPython installation instead of a predefined one? And, in this
respect, will I get any performance improvement for the kind of plots
I am doing right now?

Thank you for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plot vs Line Collections

2007-06-01 Thread Andrea Gavana
Hi John,

On 5/31/07, John Hunter wrote:
> On 5/31/07, Andrea Gavana <[EMAIL PROTECTED]> wrote:
> > Hi All,
> >
> > I am writing an application (wxPython based) which embeds a big
> > matplotlib figure as a main panel. Basically, this app shows oil well
> > producers and gas injectors on a 2D map as dots (every dot represents
> > its surface location), and a bunch of "streamlines" (i.e., straight
> > lines or simple curves) which connect injectors and producers.
> > As the numerical simulation continues, more and more streamlines are
> > added to the plot (because of new wells or because interference
> > between wells), and actually I end up having 200 dots plus 800-1200
> > lines. As the simulation progresses, the plots become slower and
> > slower...
> > As the lines are usually 2-points straight lines, I was thinking about
> > using Line Collections; however, every matplotlib line has a linewidth
> > value that is dependent on the calculated "interference" effect
> > between wells, which means I have to build a matplotlib line for every
> > line connecting an injector with a producer. Moreover, every injector
> > well has its own colour for the streamlines (there are 33 injector
> > wells).
> > Will Line Collections save some time in this case? If not, does anyone
> > have a suggestion on how I could try to speed-up the plotting? I am
> > not really familiar with some obscure line/axes properties, so I may
> > have overlooked something.
>
> Yes, a line collection will save you a lot of time with upwards of
> 1000 line segments.  This is the use case they were designed to solve:
> a bunch of segments of differing widths and colors.  One could
> optimize it for the special case of simple line segments, ie [(x1,y1),
> (x2, y2)] in which case we could use numpy arrays, but currently we
> have only the general case of a collection of arbitrary length
> segments, and since they are not necessarily the same length, we use a
> sequence of segments rather than an array, and this is slower than it
> could be.

I managed to get things twice faster than before using Line
Collections (even though some more optimization can be done). However,
I am facing a problem with the legend: as I put all the lines in a
single collection, and I don't want all the lines to be marked in the
legend but only the ones with biggest linewidth for every injector
well, how do I get a particular line of the collection in order to
legend() that line only? I didn't find any method or attribute about
that. Maybe it is just plain impossible.

Thank you for every hint.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plot vs Line Collections

2007-06-01 Thread Andrea Gavana
Hi John,

On 5/31/07, John Hunter wrote:
> On 5/31/07, Andrea Gavana <[EMAIL PROTECTED]> wrote:
> > Hi All,
> >
> > I am writing an application (wxPython based) which embeds a big
> > matplotlib figure as a main panel. Basically, this app shows oil well
> > producers and gas injectors on a 2D map as dots (every dot represents
> > its surface location), and a bunch of "streamlines" (i.e., straight
> > lines or simple curves) which connect injectors and producers.
> > As the numerical simulation continues, more and more streamlines are
> > added to the plot (because of new wells or because interference
> > between wells), and actually I end up having 200 dots plus 800-1200
> > lines. As the simulation progresses, the plots become slower and
> > slower...
> > As the lines are usually 2-points straight lines, I was thinking about
> > using Line Collections; however, every matplotlib line has a linewidth
> > value that is dependent on the calculated "interference" effect
> > between wells, which means I have to build a matplotlib line for every
> > line connecting an injector with a producer. Moreover, every injector
> > well has its own colour for the streamlines (there are 33 injector
> > wells).
> > Will Line Collections save some time in this case? If not, does anyone
> > have a suggestion on how I could try to speed-up the plotting? I am
> > not really familiar with some obscure line/axes properties, so I may
> > have overlooked something.
>
> Yes, a line collection will save you a lot of time with upwards of
> 1000 line segments.  This is the use case they were designed to solve:
> a bunch of segments of differing widths and colors.  One could
> optimize it for the special case of simple line segments, ie [(x1,y1),
> (x2, y2)] in which case we could use numpy arrays, but currently we
> have only the general case of a collection of arbitrary length
> segments, and since they are not necessarily the same length, we use a
> sequence of segments rather than an array, and this is slower than it
> could be.

Thank you for your answer. I am going to try to build these line
collections and see what I can get. I never used them before so it's
like I will get something not very well performing at first...

Thank you for your answer, I am going to look at some examples...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plot vs Line Collections

2007-05-31 Thread Andrea Gavana
Hi All,

I am writing an application (wxPython based) which embeds a big
matplotlib figure as a main panel. Basically, this app shows oil well
producers and gas injectors on a 2D map as dots (every dot represents
its surface location), and a bunch of "streamlines" (i.e., straight
lines or simple curves) which connect injectors and producers.
As the numerical simulation continues, more and more streamlines are
added to the plot (because of new wells or because interference
between wells), and actually I end up having 200 dots plus 800-1200
lines. As the simulation progresses, the plots become slower and
slower...
As the lines are usually 2-points straight lines, I was thinking about
using Line Collections; however, every matplotlib line has a linewidth
value that is dependent on the calculated "interference" effect
between wells, which means I have to build a matplotlib line for every
line connecting an injector with a producer. Moreover, every injector
well has its own colour for the streamlines (there are 33 injector
wells).
Will Line Collections save some time in this case? If not, does anyone
have a suggestion on how I could try to speed-up the plotting? I am
not really familiar with some obscure line/axes properties, so I may
have overlooked something.
This is with matplotlib 0.90, numpy 1.0.3, wxPython 2.8.4, Python 2.5,
Windows XP, WxAgg (pure Python implementation).

Thank you for every suggestion, and sorry for the long post.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] line set_visible() and legend

2006-11-15 Thread Andrea Gavana
Hi gang,

I apologize to come up always with noob questions, but it's been a
while I used matplotlib seriously...
Related to the "deleting a line from a plot" subject, I was thinking
about *hiding* the line instead of completely erasing it from the
graph. This is because the user can check or unchech a checkbox that
toggles the line visibility, and it would be much easier to call
set_visible() instead of continuously deleting/replotting the line.
Now, how does this impact on legend? I mean, is there a way with which
I can simply hide a line => update the legend by removing the missing
line label, or show a line => restore the legend label?

Thank you for every pointer.

-- 
Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a line from a plot

2006-11-14 Thread Andrea Gavana
Hi John,

sorry to come back so late with this subject. Well, I have tried
your suggestion:

> When you add lines to the plot, the dataLim are updated, but when you
> remove data with del ax.lines[-1] etc, the dataLim are not updated.
> If all you have in the Axes are line instances, you can update the
> dataLim with the remaining lines, but first you must tell it to ignore
> it's current limits.  You do this with the ignore flag
>
> # after removing a line, do
> ignore = True
> for line in ax.lines:
>x = line.get_xdata()
>y = line.get_ydata()
>ax.dataLim.update_numerix(x, y, ignore)
>ignore = False
>

No way, it doesn't update the axes. Uhm, in my plot I have only lines
and one legend, nothing more. Even if I try a simple case with 2 lines
and I remove one of them, the axes still stay with their previous
limits. I must be missing something.

> After you have tested this, would you mind updating the wiki with this
> information?

No problem, as soon as I am able to update the axes, I will add that
info to the wiki.

Thank you.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a line from a plot

2006-11-10 Thread Andrea Gavana
Hi Gang,

Andrea> Thank you guys, and thanks for the Wiki entry ;-) Andrea.

I have a further small question. When I add a line to my plot, the
axes gracefully rescale to accomodate the new data plotted. However,
when I remove a line, they do not rescale, even if I call:

locator = self.leftaxis.yaxis.get_major_locator()
locator.autoscale()

Or:

self.leftaxis.autoscale_view(scalex=False, scaley=True)

I also call self.canvas.draw(), self.Refresh()... nothing happens. Is
there a way to make the axes rescale after removing a line from a
plot?

Thank you.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] New to matplotlib; documentation errors

2006-11-09 Thread Andrea Gavana
Hi,

>* You need PyNum (documented)

I suppose you meant NumPy

>* You need wxPython (not documented that I've found)

No, I don't remember that particular need, unless things have changed
in the meanwhile. If so, please correct my ignorance.

> Python 2.4.3 (#1, Mar 30 2006, 11:02:16)
> [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> from pylab import *
>  >>> dt = 0.01
>  >>> t = arrange(0,10,dt)
> Traceback (most recent call last):
>   File "", line 1, in ?
> NameError: name 'arrange' is not defined

I suppose you meant "arange" and not "arrange".


Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a line from a plot

2006-11-09 Thread Andrea Gavana
Thank you guys, and thanks for the Wiki entry ;-)

Andrea.

On 11/9/06, Pierre GM <[EMAIL PROTECTED]> wrote:
>
> > I have a GUI written in wxPython, the main portion of it is a
> > matplotlib canvas. There is a tree control on the left with
> > checkboxes: if the user checks a checkbox, I add a line on the plot.
> > So far so good. The problem comes when the user *un-checks* the
> > checkbox. I would like to remove the line from the plot, but the only
> > way I found to do it is to do:
>
> To suppress the last line drawn:
> del(gca().lines[-1])
>
> (replace gca() by the handle of the subplot you're acting on)
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


-- 
Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Removing a line from a plot

2006-11-08 Thread Andrea Gavana
Hi NG,

I posted this question few months ago and I didn't receive any
answer, so I'll try to rephrase my problem.

I have a GUI written in wxPython, the main portion of it is a
matplotlib canvas. There is a tree control on the left with
checkboxes: if the user checks a checkbox, I add a line on the plot.
So far so good. The problem comes when the user *un-checks* the
checkbox. I would like to remove the line from the plot, but the only
way I found to do it is to do:

line.set_linestyle("None")

Which is not very nice (and not very correct), as it seems to me that
the line is still there (invisible, but still there). Am I right or
have I completely misunderstood the set_linestyle behavior? If this
method is not correct, is there any alternative that I could try to
erase completely the line from the plot (and from the legend,
obviously)?
The alternative of replotting everything just because a line should be
erased came into my mind but I discarded it because it is
fantastically time consuming with my graphs.

Thank you for every hint.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Compatible Version of Numpy?

2006-10-23 Thread Andrea Gavana
Hi Chris,

> Ok, thanks. I suspected that, but since even Google isn't able to find
> an rc2 binary, I guess my only option is to wait for a compatible
> Matplotlib to be released.

Try here:

http://prdownloads.sourceforge.net/numpy/numpy-1.0rc2.win32-py2.4.exe?download

Or, for Python 2.5:

http://prdownloads.sourceforge.net/numpy/numpy-1.0rc2.win32-py2.5.exe?download

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plot3D errors

2006-10-21 Thread Andrea Gavana
Hi all,
 
    am I the only one that noticed that 3D plots do not work anymore? Unless I am missing something, contour3D, contourf3D simply fails with this message:
 
Traceback (most recent call last):  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 440, in add_axes    a = Axes(self, rect, **kwargs)  File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 348, in __init__ 

    self._position = map(makeValue, rect)TypeError: argument 2 to map() must support iteration
While the other 3D plots suffer of problems when the mouse enter the plot window; I get these error messages:
 
Traceback (most recent call last):  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py", line 1149, in _onMotion    FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=evt) 
  File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py", line 895, in motion_notify_event    func(event)  File "C:\Python25\lib\site-packages\matplotlib\axes3d.py", line 414, in on_move 
    if event.inaxes != self or not self.M:ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Am I missing something? I am using:
 
Windows XP
Python 2.5
wx* 2.7.1.1 (it doesn't matter in reality)
Numpy 1.0rc2
matplotlib 0.87.6 (NOT svn)
 
Thanks for every suggestion.-- Andrea."Imagination Is The Only Weapon In The War Against Reality."http://xoomer.virgilio.it/infinity77/
 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users