[Matplotlib-users] event.ind in point picking gives wrong number

2013-09-15 Thread C M
I have Matplotlib 1.1.0, and am doing point picking (using the OO approach
to Matplotlib, and embedded in wxPython).  My relevant code is as follows:

#connect the pick event to the pick event handler:
self.cid = self.canvas.mpl_connect('pick_event', self.on_pick)

#This is the relevant part of the pick event handler:
def on_pick(self, event):
if isinstance(event.artist, Line2D):
ind = event.ind
print 'ind is: ', str(ind)

This had been working in some cases, but I've found a case in which it
appears to be giving me a value for ind that doesn't make sense.  For
example, I have a plot with two lines on it (and two y axes), each with
over 50 points.  When I pick one of the points right near the end, I expect
the ind here will be about 50.  However, it prints ind is: 3.  In other
words, the wrong index value.  This is a serious issue for me, because I
then use that index to look up information about that point.

What could be going on here?

Thanks,
Che
--
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/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] event.ind in point picking gives wrong number

2013-09-15 Thread C M
Just a follow-up on this problem...

I've found now that the index is only off if the plot is zoomed, and in the
following way.  When I zoom, the first point that is visible in the plot
window will have index = 0, the next point will have index = 1, and so
forth.  If I zoom another section of the points, the indices are "reset" in
this same way.

What's really bizarre is that this is only occurring on one plot.  When I
try to reproduce the problem on other plots (so far at least), I can't.

Any suggestions for how to chase this down would be very welcome.

Thanks.


On Sun, Sep 15, 2013 at 5:30 PM, C M  wrote:

> I have Matplotlib 1.1.0, and am doing point picking (using the OO approach
> to Matplotlib, and embedded in wxPython).  My relevant code is as follows:
>
> #connect the pick event to the pick event handler:
> self.cid = self.canvas.mpl_connect('pick_event', self.on_pick)
>
> #This is the relevant part of the pick event handler:
> def on_pick(self, event):
> if isinstance(event.artist, Line2D):
> ind = event.ind
> print 'ind is: ', str(ind)
>
> This had been working in some cases, but I've found a case in which it
> appears to be giving me a value for ind that doesn't make sense.  For
> example, I have a plot with two lines on it (and two y axes), each with
> over 50 points.  When I pick one of the points right near the end, I expect
> the ind here will be about 50.  However, it prints ind is: 3.  In other
> words, the wrong index value.  This is a serious issue for me, because I
> then use that index to look up information about that point.
>
> What could be going on here?
>
> Thanks,
> Che
>
--
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] colorbllind problem

2014-02-17 Thread C M
On Mon, Feb 17, 2014 at 1:15 PM, Gabriele Brambilla <
gb.gabrielebrambi...@gmail.com> wrote:

> Hi,
> I'm dealing with a guy that is colorblind.
> Have you got any suggestion on how could I show a plot like the one
> attached to him?
> Is there an option in pyplot that write little numbers near the curves
> instead of colors?
>

In addition to the other suggestions:  If this is a plot that is viewed on
his computer, you could also build in line picking, so that if the user
mouses over the line, information about that line is shown in the toolbar
or however you want.
--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] event.ind in point picking gives wrong number

2014-06-07 Thread C M
Hello again. This is follow-up on this 9 month old thread (I left this
issue for a while and am now returning to it).

I upgraded to the latest stable version of Matplotlib, 1.3.1, and tested
and I am still getting the exact same confusing problem.

Now I also have a small runnable test script that demonstrates this
problem, from IDLE using Python 2.7 and Matplotlib 1.3.1.

Attached is the script.  If you run it as is, it will show a plot. Click on
the last point (which is obviously higher than the rest) and note the index
number that is printed in the IDLE prompt.  It should say "index is:
[154]".  But now zoom the plot tightly around that last point, and click on
it again.  Now it will report that the index is much smaller (depending on
how tightly you zoomed), down to "index is:  [1]".  This is the problem.

What's critical to point out is:  this only occurs with *this* data.  To
show that, go to the script and comment out the line near the end that
starts with "plt.plot(bad_final_dates," and comment in the one below it,
that starts with "plt.plot(good_final_dates,".  Run the script again, and
repeat the process above.  You'll find that zooming does not affect the
index number--which is the correct behavior.

The contains_points() function was something I got on this mailing list
from Jae-Joon some years back, and it is above my level of understanding,
and it's possible I goofed something up in there.

I'm really puzzled why one set of data doesn't have this problem and
another one does. Any suggestions for what's wrong greatly appreciated.

Thanks,
Che


On Mon, Sep 16, 2013 at 9:15 AM, Benjamin Root  wrote:

>
>
>
> On Sun, Sep 15, 2013 at 11:59 PM, C M  wrote:
>
>> Just a follow-up on this problem...
>>
>> I've found now that the index is only off if the plot is zoomed, and in
>> the following way.  When I zoom, the first point that is visible in the
>> plot window will have index = 0, the next point will have index = 1, and so
>> forth.  If I zoom another section of the points, the indices are "reset" in
>> this same way.
>>
>> What's really bizarre is that this is only occurring on one plot.  When I
>> try to reproduce the problem on other plots (so far at least), I can't.
>>
>> Any suggestions for how to chase this down would be very welcome.
>>
>> Thanks.
>>
>>
> That is a very useful observation. I am not very familiar with the artist
> picking code, but if I have to guess, I would wonder if indices are being
> determined from a path created *after* clip_to_rect() is used internally.
> Given that you are having difficulties in reproducing this issue in other
> plots, I would suggest trying to pare down your badly behaving code as much
> as you can and post it here.  Furthermore, it would also be useful to
> determine if the issue still occurs in v1.3 or in the master branch.
>
> Cheers!
> Ben Root
>

import matplotlib.pyplot as plt
import numpy as np

def contains_points(line, mouseevent):
line.pickradius = 5
# Make sure we have data to plot
if line._invalidy or line._invalidx:
line.recache()

if len(line._xy)==0: return False,{}

# Convert points to pixels
if line._transformed_path is None:
   line._transform_path()
path, affine = line._transformed_path.get_transformed_points_and_affine()
path = affine.transform_path(path)
xy = path.vertices
xt = xy[:, 0]
yt = xy[:, 1]

pixels = line.figure.dpi/72. * line.pickradius

d = (xt-mouseevent.x)**2 + (yt-mouseevent.y)**2
ind, = np.nonzero(np.less_equal(d, pixels**2))

print 'index is: ', str(ind)

return len(ind)>0,dict(ind=ind)

bad_final_dates = [735079.1214674653, 735079.5, 735079.55647688662, 735079.60561398149, 735079.60901608795, 735079.61007837963, 735079.61141004635, 735079.61222394672, 735079.61267262732, 735079.61740547454, 735079.61793575226, 735079.61845732643, 735079.61902608792, 735079.68499270838, 735079.68542109954, 735079.68880315975, 735079.68926655094, 735079.68966354162, 735079.69596565969, 735079.701868125, 735079.70749983797, 735079.70960563654, 735079.71045478014, 735079.71102318284, 735079.71184613428, 735079.71230732638, 735079.71268356487, 735079.71303708339, 735079.71386268514, 735079.71445497684, 735079.715345, 735079.71684614581, 735079.7183792477, 735079.71955292823, 735079.72024780093, 735079.72192891198, 735079.72248410876, 735079.72560098383, 735079.72600572917, 735079.72638543986, 735079.72990056709, 735079.7316829, 735079.73226472223, 735079.73661531252, 735079.74144714116, 735079.74522572919, 735079.7468240856, 735079.74791210645, 735079.97846979171, 735079.98271479167, 735079.98447646992, 735080.12350728014, 735080.14091008098, 735080.55523804401, 735

Re: [Matplotlib-users] event.ind in point picking gives wrong number

2014-06-07 Thread C M
On Sat, Jun 7, 2014 at 4:02 PM, Benjamin Root  wrote:

> Thanks for the example script. I think I have a clue now what is happening.
>

Thank you for the quick reply.


> If one were to also print out the length of the "d" array, you will find
> that it is significantly shorter than when you aren't zoomed (I am getting
> a length of 7 when it should be 155). But it isn't truncated for the other
> dataset (which is of length 62). This makes me suspect that there is some
> threshold being triggered here (possibly around 128?).
>

I've tested it, and it seems that threshold number is 100.  If the dataset
has 100 points, the zooming doesn't affect the index.  If it has 101 or
more (I guess...I didn't test it in any comprehensive way), I get the
error.

I think at this point, you should definitely file a bug report.
>

 I have filed a bug report:

https://github.com/matplotlib/matplotlib/issues/3124

And I made it such that there is just the one data set and you can truncate
it to however many points you want, with the direction being to try 101
(which it is set to initially) and then try 100 or less.

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


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

2014-06-07 Thread C M
I had been using a custom function (written originally by Jae-Joon and
modified a little by me...quite a long time back now) that was working to
allow point picking of markers, but *not* the line connecting them.
However, I've now discovered with the help of this list that the function I
am using has the disadvantage that if there are more than 100 data points,
I can't get the correct index for the picked marker (turned out not to be a
mpl bug:  https://github.com/matplotlib/matplotlib/issues/3124).

So I can just use the default pick event, but then the user can pick
anywhere on the connecting line, which is meaningless in this use--so I
don't want them to be able to pick on the connecting line.

My goal is to have a custom function that will serve *both* purposes:
allow picking the markers only, not the line, of a set of data of any
length while returning the correct index of that marker/data point.  But
the code in the custom function is mostly above my head, was written for
mpl 0.99 or so, and I don't know how to modify it to get both purposes
achieved.

I attach the current sample again, with the problematic custom picker
function, "contains_points()".  Thanks for any suggestions or help.

Che

import matplotlib.pyplot as plt
import numpy as np

def contains_points(line, mouseevent):

line.pickradius = 5
# Make sure we have data to plot
if line._invalidy or line._invalidx:
line.recache()
if len(line._xy)==0: return False,{}
# Convert points to pixels
if line._transformed_path is None:
   line._transform_path()
path, affine = line._transformed_path.get_transformed_points_and_affine()
path = affine.transform_path(path)
xy = path.vertices
xt = xy[:, 0]
yt = xy[:, 1]

pixels = line.figure.dpi/72. * line.pickradius
d = (xt-mouseevent.x)**2 + (yt-mouseevent.y)**2
ind, = np.nonzero(np.less_equal(d, pixels**2))

print 'index is: ', str(ind)
return len(ind)>0,dict(ind=ind)

dates = [735079.1214674653, 735079.5, 735079.55647688662, 735079.60561398149, 735079.60901608795, 735079.61007837963, 735079.61141004635, 735079.61222394672, 735079.61267262732, 735079.61740547454, 735079.61793575226, 735079.61845732643, 735079.61902608792, 735079.68499270838, 735079.68542109954, 735079.68880315975, 735079.68926655094, 735079.68966354162, 735079.69596565969, 735079.701868125, 735079.70749983797, 735079.70960563654, 735079.71045478014, 735079.71102318284, 735079.71184613428, 735079.71230732638, 735079.71268356487, 735079.71303708339, 735079.71386268514, 735079.71445497684, 735079.715345, 735079.71684614581, 735079.7183792477, 735079.71955292823, 735079.72024780093, 735079.72192891198, 735079.72248410876, 735079.72560098383, 735079.72600572917, 735079.72638543986, 735079.72990056709, 735079.7316829, 735079.73226472223, 735079.73661531252, 735079.74144714116, 735079.74522572919, 735079.7468240856, 735079.74791210645, 735079.97846979171, 735079.98271479167, 735079.98447646992, 735080.12350728014, 735080.14091008098, 735080.55523804401, 735080.56125733792, 735080.63896374998, 735080.64021659724, 735080.64103072917, 735080.66268849536, 735080.7048011343, 735080.79961501155, 735080.86546409724, 735080.99817599542, 735081.0204026273, 735081.02133151621, 735081.02613285882, 735081.0271783449, 735081.0335956713, 735081.04115539347, 735081.04800446762, 735081.05008083337, 735081.05534546298, 735081.05918304401, 735081.06037712959, 735081.06172269676, 735081.06712594908, 735081.08196986106, 735081.62065618054, 735081.8688092361, 735081.86910491902, 735081.86998233793, 735081.99360535876, 735081.99586380785, 735082.00806468748, 735082.0098228819, 735082.01533834497, 735082.01674383099, 735082.02936186339, 735082.02976707171, 735082.03022675926, 735082.03069490741, 735082.03097482643, 735082.03125312505, 735082.03604334488, 735082.03765619209, 735082.05257208331, 735082.100969919, 735082.1024177199, 735082.10387097218, 735082.1388320023, 735082.337, 735082.53595807869, 735082.55833702546, 735082.56112760422, 735083.00588994217, 735083.007571875, 735113.50807679398, 735113.58693798608, 735114.03848809027, 735114.04119372682, 735115.5, 735119.8093059028, 735120.03856688656, 735253.07588778937, 735256.95615627314, 735258.69064364582, 735258.69268998841, 735258.69969299773, 735258.72694862273, 735259.62416826386, 735259.6248413, 735259.7361906945, 735259.75713817135, 735259.99948642356, 735260.00099298614, 735260.00174059032, 735260.00592855329, 735260.00680168986, 735260.00748263893, 735260.00827880786, 735260.00860694447, 735260.00958392362, 735260.02752453706, 735260.06593625003, 735260.07891475689, 735260.07907957176, 735260.07935114589, 735260.62010422454, 735260.62646800932, 735260.62662517361, 735260.66605687502, 735260.67675605323, 735260.68322124996, 735260.68342049769, 735260.68355356483, 735260.68561972224, 735260.68846386578, 735269.73599923612, 735285.60832390049, 735302.07172445604, 735304.07737268519, 735304.3925347,

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

2014-06-07 Thread C M
On Sat, Jun 7, 2014 at 10:18 PM, Eric Firing  wrote:

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

That is so simple, and I hadn't thought of it at all.  Thank you!  My only
concerns would be for slowness of plotting if there are a lot of points and
just code simplicity, and so if there could be some other way with a custom
function for the picker that would do this, I would probably prefer that.
But maybe neither of these are particularly important concerns.

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


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

2014-06-08 Thread C M
Great, thanks for all the help!


On Sun, Jun 8, 2014 at 12:09 AM, Eric Firing  wrote:

> On 2014/06/07, 5:03 PM, C M wrote:
> >
> >
> >
> > On Sat, Jun 7, 2014 at 10:18 PM, Eric Firing  > <mailto:efir...@hawaii.edu>> wrote:
> >
> > On 2014/06/07, 4:12 PM, C M wrote:
> >  > I had been using a custom function (written originally by
> > Jae-Joon and
> >  > modified a little by me...quite a long time back now) that was
> > working
> >  > to allow point picking of markers, but *not* the line connecting
> > them.
> >  > However, I've now discovered with the help of this list that the
> >  > function I am using has the disadvantage that if there are more
> > than 100
> >  > data points, I can't get the correct index for the picked marker
> > (turned
> >  > out not to be a mpl bug:
> >  > https://github.com/matplotlib/matplotlib/issues/3124).
> >  >
> >  > So I can just use the default pick event, but then the user can
> pick
> >  > anywhere on the connecting line, which is meaningless in this
> > use--so I
> >  > don't want them to be able to pick on the connecting line.
> >
> > Why not just execute plot twice, once with the markers, with picking
> > activated, and a second time with the line, with picking inactive
> (the
> > default).
> >
> > Eric
> >
> >
> > That is so simple, and I hadn't thought of it at all.  Thank you!  My
> > only concerns would be for slowness of plotting if there are a lot of
> > points and just code simplicity, and so if there could be some other way
> > with a custom function for the picker that would do this, I would
> > probably prefer that. But maybe neither of these are particularly
> > important concerns.
>
> I think you will find plotting two lines instead of one is not at all
> prohibitive with respect to speed; especially when you are zooming, so
> that the number of points being plotted is not so large.
>
> As for simplicity, two calls to a standard function with almost the same
> arguments beats an arcane special-purpose function!
>
> If you want to make your own picker, though, it looks like you could use
> a slight modification of Line2D.contains(); it would be just a matter of
> copying it and replacing this section
>
>  # Check for collision
>  if self._linestyle in ['None', None]:
>  # If no line, return the nearby point(s)
>  d = (xt - mouseevent.x) ** 2 + (yt - mouseevent.y) ** 2
>  ind, = np.nonzero(np.less_equal(d, pixels ** 2))
>  else:
>  # If line, return the nearby segment(s)
>  ind = segment_hits(mouseevent.x, mouseevent.y, xt, yt,
> pixels)
>
>
> with the code in the first option--that is, without checking the
> _linestyle.  You would also need to remove the first two lines after the
> docstring.
>
> Eric
>
> >
> > Che
> >
> >
> >
> >
> >
> >
> --
> > Learn Graph Databases - Download FREE O'Reilly Book
> > "Graph Databases" is the definitive new guide to graph databases and
> their
> > applications. Written by three acclaimed leaders in the field,
> > this first edition is now available. Download your free book today!
> > http://p.sf.net/sfu/NeoTech
> >
> >
> >
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] odd "singular matrix" error

2014-12-30 Thread C M
I have no idea what this is. If I create a certain plot first in an
application, it throws this error (edited to the key part):

Traceback (most recent call last):

  File "thescript.py", line 2147, in AddPatchBar
ax.add_patch(patch)
  File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 1471, in
add_patch
self._update_patch_limits(p)
  File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 1492, in
_update_patch_limits
self.transData.inverted())
  File "C:\Python25\lib\site-packages\matplotlib\transforms.py", line 1954,
in inverted
return CompositeGenericTransform(self._b.inverted(), self._a.inverted())
  File "C:\Python25\lib\site-packages\matplotlib\transforms.py", line 1448,
in inverted
self._inverted = Affine2D(inv(mtx))
  File "C:\Python25\lib\site-packages\numpy\linalg\linalg.py", line 445, in
inv
return wrap(solve(a, identity(a.shape[0], dtype=a.dtype)))
  File "C:\Python25\lib\site-packages\numpy\linalg\linalg.py", line 328, in
solve
raise LinAlgError, 'Singular matrix'
numpy.linalg.linalg.LinAlgError: Singular matrix

But, the odd part is that if I create a completely different and totally
separate plot *before* this one, and *then* I try to plot this one, I do
not get this error and this plot shows fine. That makes no sense to me. Or
also, if I plot this "patch" on a plot with a few other lines plotted, it
also works.

Does anyone have any idea what could be causing this?  Thanks.
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] odd "singular matrix" error

2014-12-31 Thread C M
On Wed, Dec 31, 2014 at 9:45 AM, Benjamin Root  wrote:

> What might be happening is that the patch being added has no area. The
> logic it is failing in is in the autoscaling section, I believe. This is
> why if there are other things already in the plot or with other patches,
> then the code works fine because the limits aren't identical.
>

If it is helpful, when I print the value of the patch, I get this:

 patch is:  Poly((735597, -12) ...)

What's weird though, is that the other plot I'm talking about is a
*different* plot entirely (different canvas instance), and can be closed
first and still "allow" the patch plot to be shown without errors.

>
> Still though, I thought we had enough logic checks to prevent this sort of
> error. I see you are using Python 2.5, which is older than what we
> currently support. Which version of matplotlib are you using?
>

I'm using matplotlib 1.1.0. I could try upgrading.



>
> Cheers!
> Ben Root
>
>
> On Wed, Dec 31, 2014 at 2:03 AM, C M  wrote:
>
>> I have no idea what this is. If I create a certain plot first in an
>> application, it throws this error (edited to the key part):
>>
>> Traceback (most recent call last):
>>
>>   File "thescript.py", line 2147, in AddPatchBar
>> ax.add_patch(patch)
>>   File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 1471, in
>> add_patch
>> self._update_patch_limits(p)
>>   File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 1492, in
>> _update_patch_limits
>> self.transData.inverted())
>>   File "C:\Python25\lib\site-packages\matplotlib\transforms.py", line
>> 1954, in inverted
>> return CompositeGenericTransform(self._b.inverted(),
>> self._a.inverted())
>>   File "C:\Python25\lib\site-packages\matplotlib\transforms.py", line
>> 1448, in inverted
>> self._inverted = Affine2D(inv(mtx))
>>   File "C:\Python25\lib\site-packages\numpy\linalg\linalg.py", line 445,
>> in inv
>> return wrap(solve(a, identity(a.shape[0], dtype=a.dtype)))
>>   File "C:\Python25\lib\site-packages\numpy\linalg\linalg.py", line 328,
>> in solve
>> raise LinAlgError, 'Singular matrix'
>> numpy.linalg.linalg.LinAlgError: Singular matrix
>>
>> But, the odd part is that if I create a completely different and totally
>> separate plot *before* this one, and *then* I try to plot this one, I do
>> not get this error and this plot shows fine. That makes no sense to me. Or
>> also, if I plot this "patch" on a plot with a few other lines plotted, it
>> also works.
>>
>> Does anyone have any idea what could be causing this?  Thanks.
>>
>>
>>
>> --
>> Dive into the World of Parallel Programming! The Go Parallel Website,
>> sponsored by Intel and developed in partnership with Slashdot Media, is
>> your
>> hub for all things parallel software development, from weekly thought
>> leadership blogs to news, videos, case studies, tutorials and more. Take a
>> look and join the conversation now. http://goparallel.sourceforge.net
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] odd "singular matrix" error

2015-01-02 Thread C M
Still though, I thought we had enough logic checks to prevent this sort of
>> error. I see you are using Python 2.5, which is older than what we
>> currently support. Which version of matplotlib are you using?
>>
>
> I'm using matplotlib 1.1.0. I could try upgrading.
>

Ben and others,

OK, I tried upgrading to Python 2.6 and Matplotlib 1.4.2. The problem with
the singular matrix goes away!  But...

...But now I have no patch shown on the plot. This is the function I am
using now to add a patch (editing to just keep the MPL relevant
stuff)...maybe this is no longer a good way?:

def AddPatch(self,):
ax = self.subplot
verts = [
(start, y-scaling_value), # left, bottom
(start, y+scaling_value), # left, top
(stop, y+scaling_value), # right, top
(stop, y-scaling_value), # right, bottom
(0., 0.), # ignored
]
codes = [Path.MOVETO,
 Path.LINETO,
 Path.LINETO,
 Path.LINETO,
 Path.CLOSEPOLY,
 ]

x = [start, stop]  # x range of box (in data
coordinates)
height = 12 # of box in device coords (pixels)
path = mpath.Path([[x[0], -height], [x[1], -height],
   [x[1], height],  [x[0], height],
   [x[0], -height]])

#USING THE NEW TRANSFORMS
fixed_pt_trans = FixedPointOffsetTransform(ax.transData,
(0, y))
xdata_yfixed =
mtrans.blended_transform_factory(ax.transData, fixed_pt_trans)

patch = patches.PathPatch(path, transform=xdata_yfixed,
facecolor=color,alpha=0.4, lw=1, edgecolor='grey')

ax.add_patch(patch)
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Include \hline on table inside figure

2015-01-23 Thread C M
On Fri, Jan 23, 2015 at 1:42 PM, Thomas Caswell  wrote:

> Have you looked at using the mpl tables?
> http://matplotlib.org/examples/pylab_examples/table_demo.html
>

Just pointing out:  the numbers in those tables and the words other than
"Quake" are slightly cut-off at the top in the demo.
--
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] WxWidget animation twinkling?

2009-07-09 Thread C M
On Thu, Jul 9, 2009 at 3:40 AM, guillaume ranquet wrote:

> Hi again.
>
> I found out that removing the resize handler of the wxpanel gives me a
> nice animated plot that works as expected (but with no resize :-/)
>
> def _SetSize(self):
>pixels = tuple(self.parent.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(),forward=True)
>
>
> I took that code from:
> http://www.scipy.org/Matplotlib_figure_in_a_wx_panel
> any hints on what to do from there?
>

I have run your code and I am not sure what your issue is.  What is wrong
with how it is behaving?  You say in the first post, "the resizing of the
window make the plot look terribly broken", but I am not seeing that.  And
what platform and version of wx and mpl are you using?

Che


>
> guillaume ranquet wrote:
> > Hi list (yes, me, again :D)
> >
> > I'm having difficulties with matplotlib svn (rev 7249) and animations.
> > I'm a bit lost on what I have to do to get my animation running smoothly?
> >
> > I had various attempts, It seems that the best result I can have is by
> > totally skipping the canvas.restore_region(self.background) shown in the
> > examples : the resizing of the window make the plot look terribly broken
> >
> > sorry for this question that seems well covered by documentation and
> > examples :S
> > I'm attaching a sample code that reproduces the behavior of my app, It's
> > a bit long but I hope there's some good things in it that can be usefull
> > to others :)
> >
> >
> > ===code snippet===
> > import wxversion
> > wxversion.ensureMinimal('2.8')
> >
> > import numpy as np
> > import matplotlib.pyplot as plt
> >
> > from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
> > FigureCanvas
> >
> > import wx
> > import wx.aui
> >
> > from matplotlib.figure import Figure
> > import sys
> > import getopt
> > from threading import *
> > from itertools import izip
> > import time
> >
> > class myplotData(Figure):
> > def __init__(self,name,width=5,height=4,dpi=60,x_axis=None):
> > Figure.__init__(self,figsize=(width, height),dpi=dpi)
> > self.name = name
> > self.ax = self.add_subplot(111,label=name,animated=True)
> > self.bg = None
> > self.mdirty = False
> >
> > def refreshbg(self):
> > self.bg = self.canvas.copy_from_bbox(self.ax.bbox)
> >
> > def feed(self,n):
> > timestamp = n[0]
> > self.n = 0
> > if self.bg == None:
> > self.canvas = self.ax.figure.canvas
> > self.canvas.draw()
> > self.bg = self.canvas.copy_from_bbox(self.ax.bbox)
> > for xs in n[1:]:
> > self.ax.plot([timestamp],[xs],animated=True)
> > return
> > #self.canvas.restore_region(self.bg)
> > mylines = self.ax.get_lines()
> > for xs,line in izip(n[1:],mylines):
> > x,y = line.get_data()
> > x = np.concatenate((x,[timestamp]))
> > y = np.concatenate((y,[xs]))
> > line.set_data([x,y])
> > self.ax.set_xlim(xmax=timestamp)
> > curyminlim,curymaxlim = self.ax.get_ylim()
> >
> > self.ax.set_ylim(ymin=min(xs,curyminlim),ymax=max(xs,curymaxlim))
> > self.ax.draw_artist(line)
> > self.mdirty = True
> > wx.WakeUpIdle()
> >
> > def blit(self):
> > if self.mdirty:
> > self.mdirty = False
> > self.canvas.blit(self.ax.get_figure().bbox)
> >
> > class CanvasPanel(wx.Panel):
> > def __init__(self,name,callback=None,parent=None):
> > wx.Panel.__init__(self, parent)
> > self.SetSize((120, 80))
> > self.figure = myplotData(name)
> > self.canvas = FigureCanvas(self,-1,self.figure)
> > self.parent = parent
> > self.callback = callback
> > color = (255,255,255)
> > self.SetColor(color)
> > self._SetSize()
> > self._resizeflag = False
> > self.Bind(wx.EVT_IDLE, self._onIdle)
> > self.Bind(wx.EVT_SIZE, self._onSize)
> >
> > def SetColor(self,rgbtuple=None):
> > """Set figure and canvas colours to be the same."""
> > if rgbtuple is None:
> > rgbtuple =
> > wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE).Get()
> > clr = [c/255. for c in rgbtuple]
> > self.figure.set_facecolor(clr)
> > self.figure.set_edgecolor(clr)
> > self.canvas.SetBackgroundColour(wx.Colour(*rgbtuple))
> >
> > def _onSize(self,event):
> > self._resizeflag = True
> >
> > def _onIdle(self,evt):
> > if self._resizeflag:
> > self._resizeflag = False
> > self._SetSize()
> > self.figure.blit()
> >
> > def _SetSize(self):
> > pixels = tuple(self.parent.GetClientSize())
> > self.SetSize(pixels)
> > self.can

[Matplotlib-users] limiting zoom range to reasonable values

2010-01-19 Thread C M
Hi,

I am using a date plot with the toolbar to allow panning/zooming of
the plot.  If the user (mischievously) zooms in or out an extreme
amount, there are some weird artifacts that I'd rather prevent so as
to keep the display looking right and prevent possible crashes and
lock-ups.

For zooming out, I can get the display to lock up after zooming out
something like more than 100 years (and the x axis is nearly solid
with scrunched-up dates).  For zooming in, I get this strange thing
where the date axes will either just say "Date" and have no markers or
then after a few more zooms in it will start giving a different year
than I was on.  Neither of these are real use cases--at all--but I
thought it might be nice to limit just how much one can zoom in or
out.

Any suggestions for a good way to think about this are welcome.  Thanks,

Che

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Transparent plot symbols

2010-01-22 Thread C M
On Fri, Jan 22, 2010 at 2:34 PM, Michael Cohen  wrote:
> Hi all,
> I am making a plot with circle symbols, so I have 'o' in the plot() command.
> How do I make those circles transparent?  I'd like the center of the
> circles to allow the catter plot underneath the circle location to show
> through.
>
> Cheers
> Michael

In your plot() command you can set the alpha value.  Try setting
mfc='b', for example, (marker face color = blue) and then alpha = .3.
and then you can try different values of alpha to see how transparent
you want it.

Che

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] position a wxPython frame near to a matplotlib point

2010-01-22 Thread C M
For those who you wxPython with matplotlib, does anyone know how to do
this or can point me in the right direction?

I would like to pick a point (that part is fine) and then place a
wxFrame near to that point.  I'm using something like:

#Note: self is a wxPanel that contains the matplotlib plot.
mouseLocation = wx.GetMousePosition()
pos = self.ScreenToClient(mouseLocation)
self.popup.Move(pos)

but this results in the frame being completely displaced from the
picked point.  I've tried a number of different approaches and am
stuck.  Any ideas would be appreciated.

Che

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] make autoscale_view even less tight?

2010-02-03 Thread C M
I'm using autoscale_view for the y axis, but find with a marker size >
about 10, it will autoscale the graphs such that some markers are
bisected by the edges of the frame.  I already have it set to:

self.subplot.autoscale_view(tight=False, scalex=False, scaley=True)

so I'd basically like "tight" here to be "even less tight".  For
example, for a graph of time in minutes along the y axis, I'd like the
bottom of the graph to actually be a bit below zero to catch events
that are 0.5 min, etc., without them being half-buried under the edge
of the graph.

Can autoscale_view be altered a bit to allow for a more generous view?

Thanks,
Che

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] help with view_limits

2010-02-08 Thread C M
I'd like to set the ticks on the y axis such that they do not display
anything lower than 0, even if part of the graph below 0 is visible.
I tried to do this with

ylocator = AutoLocator()
ylocator.view_limits(0, 100)
self.subplot.yaxis.set_major_locator(ylocator)

but it is not changing anything.  How can I do this?

Thank you,
Che

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How Does One Learn to Use MatPlotLib?

2010-02-09 Thread C M
 wrote:
> Subject is the question.
>
> As I see it, it's useful to know MatLab. A simple query with matplotlib
> tutorial shows a number of hits. The first, reference to v0.99.a
> documentation barely qualifies. Examples galore and a pretty minimal
> introduction. In the first 10 or so hits ther's a blog and mention of a
> video. The blog may appeal to some, but it seems unelementary. The video
> basically asks to sign in. Who knows where that goes? I've seen a few
> videos for MPL, but they all look tied into $$.
>
> I've made some reasonable progress on MPL, but am still far short of
> being confident of using it.  Too much try this and see.
>
> I know of exactly one book on MPL ( for scientists. sounds interesting).
> It was published recently by a foreign author. It is not yet widely
> distributed.
>
> Your turn. Comments?

Have you read the manual itself?  I found that quite helpful in getting started:

http://matplotlib.sourceforge.net/users/index.html

I've been satisfied with learning a bit here and there as I go.  It's
a big project, and I don't expect to understand it all at once.  But,
that said, even with a partial understanding I'm pleased at what it
can do for my needs.  What I find is first you should determine what
is the desired outcome you want, then Google around for mentions of
this in old threads or on the matplotlib site, then maybe try asking
for assistance on the list.

Che

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] x,y ticklabel too close

2010-02-11 Thread C M
On Thu, Feb 11, 2010 at 12:40 PM, Filipe Pires Alvarenga Fernandes
 wrote:
> Hello list,
>
> For the following plotI using a large font for the tick-label that causes
> the first x,y tick-labels to overlap
>
> http://yfrog.com/5zimageykp
>
> for now I'm padding spaces to "fix" the plot, like this:
>
> newtick = ["-10  ", "-5    ", "0   ", "5   ", "10 "]
> pos =[-10, -5, 0, 5, 10]
> yticks(pos, newtick)
>
> However I was wondering if there is any automatic way to avoid or fix this
> overlap.
>
> Thanks, Filipe

This is also not automatic, and maybe more work than it's worth, but
could it be helpful to use spines, as shown in the example down the
page a bit here:

http://matplotlib.sourceforge.net/users/whats_new.html

It seems there would be no way for the numbers to overlap if spines
were used this way.

Che

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Why do xticklabels and yticklabels always collide?

2010-02-12 Thread C M
> My biggest problem with matplotlib is that the smallest yticklabel and
> the smallest xticklabel always seem to lie on top of each other (or
> close to it).  See attachment for example.  Is there anyway to make it
> so these don't lie on top of each other?  How can I make this the
> default behavior?
>
> Thanks,
> Jeremy

This was just asked a day or two ago, and here's how that went:

http://old.nabble.com/x%2Cy-ticklabel-too-close-to27551389.html

I guess you could also change the LABELPAD value to bring the labels a
bit off the axes, so they can't collide, like:

axis.xaxis.LABELPAD = 8  #or however much you want

I don't know how you could make this default behavior, but making
matplotlib such that this was hard to do--instead of the
default--might be a useful improvement.

Che

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] make autoscale_view even less tight?

2010-02-12 Thread C M
On Fri, Feb 12, 2010 at 2:24 PM, Stan West  wrote:
>> From: C M [mailto:cmpyt...@gmail.com]
>> Sent: Wednesday, February 03, 2010 21:59
>>
>> I'm using autoscale_view for the y axis, but find with a marker size >
>> about 10, it will autoscale the graphs such that some markers are
>> bisected by the edges of the frame.  I already have it set to:
>>
>>     self.subplot.autoscale_view(tight=False, scalex=False,
>> scaley=True)
>>
>> so I'd basically like "tight" here to be "even less tight".  For
>> example, for a graph of time in minutes along the y axis, I'd like the
>> bottom of the graph to actually be a bit below zero to catch events
>> that are 0.5 min, etc., without them being half-buried under the edge
>> of the graph.
>>
>> Can autoscale_view be altered a bit to allow for a more generous view?
>
> For a similar requirement, I made the following custom locator:

Thank you.  I've been playing around with a way to do this, and may
have something working now from my attempt to modify the
autoscale_view function in axes.py.  My own re-write is below. It's
barely different from what is in the original function.  It just gets
the two edges of the bounding box that contains all the lines and
moves them out a bit.

I would like to understand your approach better.  So far, I can't get
your code to produce the "margins" indicated--but I'm probably
applying it wrongly.  I don't know how to force an autoscale, for
example.  Your code is tough for me to understand because there are a
number of things you make use of that I'm not familiar with yet. I
could ask a number of questions but don't want to burden the list with
that unless people are up for it.

Thanks,
Che

#  autoscale_view function that allows looser edges.

def loose_autoscale_view(self, subplot, margin, tight=False,
scalex=True, scaley=True):
"""
autoscale the view limits using the data limits. You can
selectively autoscale only a single axis, eg, the xaxis by
setting *scaley* to *False*.  The autoscaling preserves any
axis direction reversal that has already been done.

"""
# if image data only just use the datalim
if not self.subplot._autoscaleon: return
if scalex:
xshared = self.subplot._shared_x_axes.get_siblings(self.subplot)
dl = [ax.dataLim for ax in xshared]
bb = mtransforms.BboxBase.union(dl)
xdiff = bb.intervalx[1] - bb.intervalx[0]
x0 = bb.intervalx[0]-xdiff * margin
x1 = bb.intervalx[1]+xdiff * margin
if scaley:
yshared = self.subplot._shared_y_axes.get_siblings(self.subplot)
dl = [ax.dataLim for ax in yshared]
bb = mtransforms.BboxBase.union(dl)
y0 = bb.intervaly[0]-(bb.intervaly[1]* margin)
y1 = bb.intervaly[1]* (1+margin)

if (tight or (len(self.subplot.images)>0 and
  len(self.subplot.lines)==0 and
  len(self.subplot.patches)==0)):
if scalex:
self.subplot.set_xbound(x0, x1)
if scaley:
self.subplot.set_ybound(y0, y1)
return

if scalex:
XL = self.subplot.xaxis.get_major_locator().view_limits(x0, x1)
self.subplot.set_xbound(XL)
if scaley:
YL = self.subplot.yaxis.get_major_locator().view_limits(y0, y1)
self.subplot.set_ybound(YL)

#Then it would be called with:

self.loose_autoscale_view(self.subplot, 0.02, tight=False,
scalex=True, scaley=True)

#where self.subplot is my axes object.  (self is a panel class)

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] help with a custom formatter

2010-02-12 Thread C M
I would like a custom formatter that does 3 things:

1) Blanks out all the values less than 0.
2) Chooses appropriate major ticks when zoomed out.
3) Shows an integer when the zoom scale is revealing multiple
integers, but shows a decimal number when it is just showing within
one integer; i.e. if it is 1, 2, 3, 4  in first case but 1.1, 1.2,
1.3, 1.4 in the second.

So far I have needs (1) and (2) of this with this super-simple custom formatter:

class MyFormatter(ScalarFormatter):
def __call__(self, val, pos=None):
if val < 0:
return ''
else:
return int(val)

But how can I get need (3)?  I need to know what the view_interval is
to set a rule for this.  Something like:

if view_interval < 1:
return val   #this will be a decimal number
else:
return int(val)  #an integer

So how do I get the view_interval?  I'm not understanding how to get
that from matplotlib.ticker.TickHelper()--if that is even the right
way to do it--because get_view_interval() is not a method of
TickHelper but of "DummyAxis", and at that point I've lost the idea.

Any help is appreciated.  Thanks,
Che

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] help with a custom formatter

2010-02-13 Thread C M
On Sat, Feb 13, 2010 at 3:00 PM, Jae-Joon Lee  wrote:
> If you're happy with the default formatter  behavior (which seems to
> match with your #3 requirement), just reuse it.
>
> class MyFormatter(ScalarFormatter):
>   def __call__(self, val, pos=None):
>       if val < 0:
>           return ''
>       else:
>           return ScalarFormatter.__call__(self, val)
>
>
> -JJ

Thank you very much.  That is so simple and works beautifully.

Che

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] add to a canvas while preserving overall formatting

2010-02-16 Thread C M
I have a mpl graph embedded in wxPython, and I call a function,
customize_plot() to do a number of things to the plot:  adjust the
spacing around it, set the formatters, fontsizes, axis limits, set a
grid, etc.

Now I want to potentially highlight points (by adding semi-transparent
points on top of existing ones) or annotate points with user
interaction.  If I do that, it seems I need to call canvas.draw().
But when I do that, it redraws the whole canvas and ignores some of
the formatting I laid out in customize_plot(), specifically the view
limits, and that's not acceptable.

I want it to simply add the new points without changing any of the
features of the plot.  Is there a way to do that?  In Googling for
hints, I found this point from JDH from almost two years ago, which I
think is applicable to my need:

> If you call fig.canvas.draw, everything will be updated.  If you want
> to selectively draw certain artists, you can use the animated property
> w/ background copy/restore and the draw_artist method as described at

> http://www.scipy.org/Cookbook/Matplotlib/Animations

Is this still the case in the current version of matplotlib?  Or is
there a newer way to do it now?

Thank you for any suggestions,
Che

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] add to a canvas while preserving overall formatting

2010-02-16 Thread C M
On Tue, Feb 16, 2010 at 12:37 PM, John Hunter  wrote:
> On Tue, Feb 16, 2010 at 11:14 AM, C M  wrote:
>> I have a mpl graph embedded in wxPython, and I call a function,
>> customize_plot() to do a number of things to the plot:  adjust the
>> spacing around it, set the formatters, fontsizes, axis limits, set a
>> grid, etc.
>>
>> Now I want to potentially highlight points (by adding semi-transparent
>> points on top of existing ones) or annotate points with user
>> interaction.  If I do that, it seems I need to call canvas.draw().
>> But when I do that, it redraws the whole canvas and ignores some of
>> the formatting I laid out in customize_plot(), specifically the view
>> limits, and that's not acceptable.
>
> This isn't accurate -- calling draw will not change the view limits.
> In all likelihood what is happening is that when you add you your
> overlay markers, eg by calling "plot" the view limits are getting
> updated.  You can suppress this with
>
> ax.set_autoscale_on(False)
> ax.plot(overlay_markers)
> fig.canvas.draw()

Thank you, that's much easier than the animation option, which would
be more than I need to do.

Che

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hoe to update a plot

2010-02-23 Thread C M
On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates  wrote:
> Hi
> I am using gtk and displaying a plot in a FigureCanvas. In response to an
> event, I want to update the plot with new data.
>
> e.g.
> self.fig = Figure(figsize=(5,5), dpi=100)
> self.ax = fig.add_subplot(111)
> ax.plot(data[0,0:,0],
>
>
>
> canvas = FigureCanvas(fig)
> canvas.set_size_request(500,500)
>
> def on_some_signal(self,widget):
>     ?
>
>
> I've tried a number of different things. How do you do this?

I may be wrong here, but isn't it:

def on_some_signal(self,widget):
ax.plot(yournewdata)
canvas.draw()

Che

--
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] Using IDLE - program still running when graph window is closed

2010-02-24 Thread C M
On Wed, Feb 24, 2010 at 11:51 AM, AG  wrote:
> How does one ensure that once a graph has been produced by Matplotlib
> and that graph has been closed by the user that the program itself stops?
>
> What I am currently getting is that when I close the graph pop-up window
> and then close IDLE, I get a message that the program is still running
> and am I sure that I want to stop it.  Yes, I am sure, but I don't want
> to have to keep killing the IDLE interpreter window in order to do so,
> but if I don't, then I am seemingly unable to produce another graph
> pop-up window.
>
> How do I control this from within the script itself?  I am using Debian
> testing with Python 2.5.5

IDLE just doesn't work well with matplotlib (or GUI apps), as has been
recently discussed here (if you Google for matplotlib and IDLE you'll
find lots of posts about it).  You could use ipython instead, and now
there is also DreamPie (http://dreampie.sourceforge.net/), a new IDE
which claims to play well with matplotlib.  Those who embed their
matplotlib plots in a GUI app also don't face this concern.

Che

--
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] separate alpha for mfc and mec?

2010-02-28 Thread C M
Would it be possible to have a different alpha (transparency) value
for the marker face color and edge color for a single line?  (Either
currently or as a new feature of mpl).  It seems like by default alpha
applies to them both.

I ask because I am experimenting with getting a different look for the
markers by plotting the same points twice, once with a transparent
marker face color and then again with a fully opaque thin marker edge
and it is a nice effect (see attached image).  The problem is, I am
doing point picking, and the two-points-at-one-location seems to be
making the popup I create slower and occasionally mis-positioned.
Although I may be able to work that out, I thought it would be
"cleaner" to just have one set of points.

Thanks,
Che
<>--
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] embedding a plot function in existing wxapp GUI, problem replotting

2010-03-09 Thread C M
On Tue, Mar 9, 2010 at 2:23 PM, Chris Barker  wrote:
> Pribadi, Krishna wrote:
>> Based on what I’ve been reading regarding MPL, it seems that the
>> matplotlib show() function causes another instance of a GUI loop to
>> remain suspended.
>
> right --don't use show(), in fact, don't use pylab for the most part:
>
> http://www.scipy.org/Cookbook/Matplotlib/EmbeddingInWx
>
> and see the "embedding_in_wx" examples as well.

I would agree with Chris that you should bite the bullet and embed it.
 That you are new to Python shouldn't be too much of a problem if you
follow the recipe linked there.  Note that the top links on that page
are broken, but if you go to one of the last links:

http://www.scipy.org/Matplotlib_figure_in_a_wx_panel

...this works.  And if you need help getting it going, people can help
you.  Don't worry about all the fancy graphing stuff there, the draw
method could have just been:

def draw( self ):
"""Draw data."""
if not hasattr( self, 'subplot' ):
self.subplot = self.figure.add_subplot( 111 )

self.subplot.plot( [1,2,3])

and you could lose all the numpy geometry code and it would have been
a boring plot but a simpler block of code.  :D

Che

--
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] speed up imports?

2010-04-01 Thread C M
On Thu, Apr 1, 2010 at 7:17 PM, Eric Firing  wrote:
> Andrew Kelly wrote:
>> Has anyone had any success in speeding up the mpl imports?
>>
>> "import matplotlib.pyplot as plt"
>> ( or "from matplotlib.figure import Figure")
>>
>> takes 6 full seconds to load.  That seems excessive.  Any ideas?
>>
>> -Andy
>
> Andy,
>
> A couple replies came back directly to me (probably intended for the
> list, though), and both reported results similar to yours, on Windows
> machines only.  What OS and version are you running?

Sorry Eric, that was indeed intended for the list.  Just for the
list's sake, I'll repeat it:

It takes longer than any other Python module for me, too, about 5-6
seconds on a "cold" load (on Windows), though faster on a "warm" load.
 I am running it locally on a laptop that is 1.7 GHz Intel Pentium
laptop with 1Meg RAM.

And I should add:  I don't currently have Linux installed, but will
soon again I hope, and I will take note of how long it takes on Linux.

Thanks,
Che

--
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] install from svn on Linux not working for me

2010-04-18 Thread C M
My goal is to just get the lastest svn version of matplotlib, or, if
not that, just the 0.99 version, up and working on my Linux (Intrepid
Ibex) computer.  I checked it matplotlib out from svn fine, and then,
as per the webpage, did:

> cd matplotlib
> python setup.py install

and that resulted in a very large amount of errors.  I'll post them at
the bottom of this message, since there are many lines.

I previously had 0.98.x installed, via the Ubuntu repositories, but I
have uninstalled it.  My version is:
Linux ubuntu 2.6.27-7-generic #1 SMP Fri Oct 24 06:40:41 UTC 2008
x86_64 GNU/Linux

Any help is appreciated.  Thank you,
Che

Errors (starting from a few lines before):

creating build/temp.linux-x86_64-2.5/src
creating build/temp.linux-x86_64-2.5/CXX
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
-DPYCXX_ISO_CPP_LIB=1
-I/usr/lib/python2.5/site-packages/numpy/core/include
-I/usr/local/include -I/usr/include -I.
-I/usr/lib/python2.5/site-packages/numpy/core/include/freetype2
-I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2
-I/usr/include/python2.5 -c src/ft2font.cpp -o
build/temp.linux-x86_64-2.5/src/ft2font.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid
for Ada/C/ObjC but not for C++
In file included from ./CXX/Extensions.hxx:37,
 from src/ft2font.h:4,
 from src/ft2font.cpp:1:
./CXX/WrapPython.h:58:20: error: Python.h: No such file or directory
In file included from src/ft2font.cpp:1:
src/ft2font.h:13:22: error: ft2build.h: No such file or directory
src/ft2font.h:14:10: error: #include expects "FILENAME" or 
src/ft2font.h:15:10: error: #include expects "FILENAME" or 
src/ft2font.h:16:10: error: #include expects "FILENAME" or 
src/ft2font.h:17:10: error: #include expects "FILENAME" or 
src/ft2font.h:18:10: error: #include expects "FILENAME" or 
In file included from
/usr/lib/python2.5/site-packages/numpy/core/include/numpy/arrayobject.h:14,
 from src/ft2font.cpp:5:
/usr/lib/python2.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:100:2:
error: #error Must use Python with unicode enabled.
In file included from ./CXX/Python3/Exception.hxx:45,
 from ./CXX/Python3/Objects.hxx:45,
 from ./CXX/Python3/Extensions.hxx:52,
 from ./CXX/Extensions.hxx:42,
 from src/ft2font.h:4,
 from src/ft2font.cpp:1:
./CXX/Python3/IndirectPythonInterface.hxx:50: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:51: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:52: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:53: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:55: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:56: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:57: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:58: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:59: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:60: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:61: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:62: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:63: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:64: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:65: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:66: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:67: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:68: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:69: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:70: error: expected
constructor, destructor, or type conversion before ‘*’ token
./CXX/Python3/IndirectPythonInterface.hxx:7

[Matplotlib-users] Fwd: install from svn on Linux not working for me

2010-04-19 Thread C M
-- Forwarded message --
From: C M 
Date: Mon, Apr 19, 2010 at 1:02 PM
Subject: Re: [Matplotlib-users] install from svn on Linux not working for me
To: Darren Dale 


On Mon, Apr 19, 2010 at 8:02 AM, Darren Dale  wrote:
> On Mon, Apr 19, 2010 at 4:30 AM, LUK ShunTim  wrote:
>> On 04/19/2010 01:52 PM, C M wrote:
>>> My goal is to just get the lastest svn version of matplotlib, or, if
>>> not that, just the 0.99 version, up and working on my Linux (Intrepid
>>> Ibex) computer.  I checked it matplotlib out from svn fine, and then,
>>> as per the webpage, did:
>>>
>>>> cd matplotlib
>>>> python setup.py install
>>>
>>> and that resulted in a very large amount of errors.  I'll post them at
>>> the bottom of this message, since there are many lines.
>>>
>>> I previously had 0.98.x installed, via the Ubuntu repositories, but I
>>> have uninstalled it.  My version is:
>>> Linux ubuntu 2.6.27-7-generic #1 SMP Fri Oct 24 06:40:41 UTC 2008
>>> x86_64 GNU/Linux
>>>
>>> Any help is appreciated.  Thank you,
>>> Che
>>>
>>> Errors (starting from a few lines before):
>>>
>>> creating build/temp.linux-x86_64-2.5/src
>>> creating build/temp.linux-x86_64-2.5/CXX
>>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>>> -Wstrict-prototypes -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
>>> -DPYCXX_ISO_CPP_LIB=1
>>> -I/usr/lib/python2.5/site-packages/numpy/core/include
>>> -I/usr/local/include -I/usr/include -I.
>>> -I/usr/lib/python2.5/site-packages/numpy/core/include/freetype2
>>> -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2
>>> -I/usr/include/python2.5 -c src/ft2font.cpp -o
>>> build/temp.linux-x86_64-2.5/src/ft2font.o
>>> cc1plus: warning: command line option "-Wstrict-prototypes" is valid
>>> for Ada/C/ObjC but not for C++
>>> In file included from ./CXX/Extensions.hxx:37,
>>>                  from src/ft2font.h:4,
>>>                  from src/ft2font.cpp:1:
>>> ./CXX/WrapPython.h:58:20: error: Python.h: No such file or directory
>>
>> You seem not to have the development package of python installed.
>> Try "sudo apt-get install python-dev".
>
> It looks like you are need to install libfreetype6-dev. Any time you
> see missing .h files in your output, it means you need to install the
> development headers for that package.
>
> Darren

Thanks, but after installing libfreetype6-dev, I tried to install
matplotlib again and still get a lot of errors.  Listed below.

Che

Ouput of install:

basedirlist is: ['/usr/local', '/usr']

BUILDING MATPLOTLIB
           matplotlib: 1.0.svn
               python: 2.5.2 (r252:60911, Jan 20 2010, 23:33:04)  [GCC
                       4.3.2]
             platform: linux2

REQUIRED DEPENDENCIES
                numpy: 1.1.1
            freetype2: 9.18.3

OPTIONAL BACKEND DEPENDENCIES
               libpng: found, but unknown version (no pkg-config)
                       * Could not find 'libpng' headers in any of
                       * '/usr/local/include', '/usr/include', '.'
              Tkinter: no
                       * TKAgg requires Tkinter
             wxPython: 2.8.10.1
                       * WxAgg extension not required for wxPython >= 2.8
           pkg-config: looking for pygtk-2.0 gtk+-2.0
                       * Package pygtk-2.0 was not found in the pkg-config
                       * search path. Perhaps you should add the directory
                       * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH
                       * environment variable No package 'pygtk-2.0' found
                       * Package gtk+-2.0 was not found in the pkg-config
                       * search path. Perhaps you should add the directory
                       * containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH
                       * environment variable No package 'gtk+-2.0' found
                       * You may need to install 'dev' package(s) to
                       * provide header files.
                 Gtk+: no
                       * Could not find Gtk+ headers in any of
                       * '/usr/local/include', '/usr/include', '.'
      Mac OS X native: no
                   Qt: no
                  Qt4: no
                Cairo: 1.4.12

OPTIONAL DATE/TIMEZONE DEPENDENCIES
             datetime: present, version unknown
             dateutil: 1.4
                 pytz: 2008b

OPTIONAL

[Matplotlib-users] Fwd: install from svn on Linux not working for me

2010-04-19 Thread C M
-- Forwarded message --
From: C M 
Date: Mon, Apr 19, 2010 at 12:58 PM
Subject: Re: [Matplotlib-users] install from svn on Linux not working for me
To: LUK ShunTim 


On Mon, Apr 19, 2010 at 4:30 AM, LUK ShunTim  wrote:
> On 04/19/2010 01:52 PM, C M wrote:
>> My goal is to just get the lastest svn version of matplotlib, or, if
>> not that, just the 0.99 version, up and working on my Linux (Intrepid
>> Ibex) computer.  I checked it matplotlib out from svn fine, and then,
>> as per the webpage, did:
>>
>>> cd matplotlib
>>> python setup.py install
>>
>> and that resulted in a very large amount of errors.  I'll post them at
>> the bottom of this message, since there are many lines.
>>
>> I previously had 0.98.x installed, via the Ubuntu repositories, but I
>> have uninstalled it.  My version is:
>> Linux ubuntu 2.6.27-7-generic #1 SMP Fri Oct 24 06:40:41 UTC 2008
>> x86_64 GNU/Linux
>>
>> Any help is appreciated.  Thank you,
>> Che
>>
>> Errors (starting from a few lines before):
>>
>> creating build/temp.linux-x86_64-2.5/src
>> creating build/temp.linux-x86_64-2.5/CXX
>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>> -Wstrict-prototypes -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
>> -DPYCXX_ISO_CPP_LIB=1
>> -I/usr/lib/python2.5/site-packages/numpy/core/include
>> -I/usr/local/include -I/usr/include -I.
>> -I/usr/lib/python2.5/site-packages/numpy/core/include/freetype2
>> -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2
>> -I/usr/include/python2.5 -c src/ft2font.cpp -o
>> build/temp.linux-x86_64-2.5/src/ft2font.o
>> cc1plus: warning: command line option "-Wstrict-prototypes" is valid
>> for Ada/C/ObjC but not for C++
>> In file included from ./CXX/Extensions.hxx:37,
>>                  from src/ft2font.h:4,
>>                  from src/ft2font.cpp:1:
>> ./CXX/WrapPython.h:58:20: error: Python.h: No such file or directory
>
> You seem not to have the development package of python installed.
> Try "sudo apt-get install python-dev".
>
> Regards,
> ST

Well, I now did that and I still get lots of errors The full
output of the terminal is listed below.

Why is this so much more difficult than the website suggests?  Am I
going to need to take this all into account if I want to distribute a
packaged-up version of my application on Linux?  This is the first
time I've run into these problems.

Thanks,
Che

Terminal output:

basedirlist is: ['/usr/local', '/usr']

BUILDING MATPLOTLIB
           matplotlib: 1.0.svn
               python: 2.5.2 (r252:60911, Jan 20 2010, 23:33:04)  [GCC
                       4.3.2]
             platform: linux2

REQUIRED DEPENDENCIES
                numpy: 1.1.1
            freetype2: found, but unknown version (no pkg-config)
                       * WARNING: Could not find 'freetype2' headers in any
                       * of '/usr/local/include', '/usr/include', '.',
                       * '/usr/local/include/freetype2',
                       * '/usr/include/freetype2', './freetype2'.

OPTIONAL BACKEND DEPENDENCIES
               libpng: found, but unknown version (no pkg-config)
                       * Could not find 'libpng' headers in any of
                       * '/usr/local/include', '/usr/include', '.'
              Tkinter: no
                       * TKAgg requires Tkinter
             wxPython: 2.8.10.1
                       * WxAgg extension not required for wxPython >= 2.8
           pkg-config: looking for pygtk-2.0 gtk+-2.0
                       * Package pygtk-2.0 was not found in the pkg-config
                       * search path. Perhaps you should add the directory
                       * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH
                       * environment variable No package 'pygtk-2.0' found
                       * Package gtk+-2.0 was not found in the pkg-config
                       * search path. Perhaps you should add the directory
                       * containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH
                       * environment variable No package 'gtk+-2.0' found
                       * You may need to install 'dev' package(s) to
                       * provide header files.
                 Gtk+: no
                       * Could not find Gtk+ headers in any of
                       * '/usr/local/include', '/usr/include', '.'
      Mac OS X native: no
                   Qt: no
                  Q

Re: [Matplotlib-users] Fwd: install from svn on Linux not working for me

2010-04-19 Thread C M
On Mon, Apr 19, 2010 at 1:31 PM, Mauro Cavalcanti  wrote:
> As I posted before, I ran across precisely these same errors when
> upgrading my Ubuntu box and the Python interpreter. You will need to
> install other dependencies as the installation log shows (gtk-2.0+,
> pygtk), including its development versions.

Can someone explain why I was able to have matplotlib 0.99 installed
previously, and can easily have 0.98 installed through Synaptic/Ubuntu
repositories, and yet have to hunt down the additional dependencies
myself if I install from svn?  I can't recall if I installed 0.99
through a third party repository or how I got it, but the point is:
is the svn version going to be different than what one gets through a
repository?

Is this need to install dependencies usually the case when installing
from svn?--and if so, can I suggest that this be mentioned in the
online documentation? (perhaps it is and I didn't see it?).

> And yes, distributing a packaged Python application which uses
> Matplotlib (either for Linux or Windows) is *not* an easy and simple
> matter. But with patience, it is possible.

On Windows I've found it is close to  easy once you know to include
the matplotlib data files in your py2exe script (also, using GUI2Exe
helps with this a great deal).  What are the (basic) steps for doing
this on Linux?  I was thinking of using cx_freeze or something to
package everything up on Linux.

Thank you,
Che

--
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] Fwd: install from svn on Linux not working for me

2010-04-19 Thread C M
Michael and Darren (and others),

I've used svn before to download pure Python code, but never to get
anything that needed to be built.  I'm fairly out to sea here, so
thanks for the patience.

> When building from source, you also need the header files (*.h files) of all
> of matplotlib's dependencies.  When you install the matplotlib binary
> package (.deb file), these header files are not installed.  Debian, Ubuntu
> and most other Linux distros separate the compiled binary libraries and
> header files into separate packages.  The latter are usually named the same
> as the binary package but with a "-dev" suffix.

That's useful to know.

> The "apt-get build-dep" command is designed specifically to install all of
> the header files required to build a particular package.  Therefore "apt-get
> build-dep python-matplotlib" is a great shortcut to set up your machine for
> building matplotlib from source.

I did that, and then did the setup.py install and, yes, it now all
works for me (not that you don't know that).  I have mpl 1.0 installed
on that Ubuntu machine.  (btw, Mauro, thanks for the tip on
Jaunty...I've been having random crashes with Intrepid now and may try
to start anew with Lucid Lynx when it comes out in a couple of weeks).

>> Is this need to install dependencies usually the case when installing
>> from svn?--and if so, can I suggest that this be mentioned in the
>> online documentation? (perhaps it is and I didn't see it?).
>>
>
> It sure can -- it was overlooked because this requirement is true of any
> compiled piece of software, not just matplotlib.
> Would you like to contribute a paragraph or two?  I'd be happy to merge it 
> into the docs.

I can at least try; let me know if what follows is a good approach to
take.  The problem I've had today is that I didn't realize one has to
build matplotlib when getting it as source AND that there are a lot of
build requirements prior to installing.  All that actually IS on a web
page, but my problem is when I skipped to the "install from svn" link,
I was then on a new page that didn't mention it, and, being new to
building, didn't realize it.  And so, my suggestion would be that at
every place (1-3 places perhaps) where the docs mention doing the
following:

> cd matplotlib
> python setup.py build
> python setup.py install

(such as on the "install from svn" page) ...there can be a) a small
note reminding newbies that in order to build you need to have the
build requirements satisfied or else the build will fail with numerous
errors, and in that note b) a link back to the "Build requirements"
paragraph already on this page, here:

http://matplotlib.sourceforge.net/users/installing.html

...and maybe c) the shortcut that you mentioned for Linux users.  If
(c) doesn't belong there, it should at least be in the "Build
requirements" paragraph, something along the lines of this:

"Note:  if you are building matplotlib on Linux, instead of manually
installing all of the build requirements (dependencies), you can
simply run this command:

> apt-get build-dep python-matplotlib

It should take some time to finish, but you will then have built
matplotlib as well as everything needed to have it work.  Afterward,
all you need do is install it with:

> cd matplotlib
> python setup.py install"

I hope this makes sense.  I appreciate everyone's help here.

Che

--
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] place a wxPopupWindow based on pick event location

2008-09-23 Thread C M
I'm hoping to get help from matplotlib wxPython backend users...

I'm struggling to get what is described in the subject line to work correctly.
There was a sort of similar thread from 2006 here:

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg00945.html

I want to pick a point on a plot and use the x,y of that point to
place a wxPopupWindow
right near that point on the graph.  I am doing this in wxPython as an embedded
graph).  I have it working *somewhat* but there is still a major
problem with it.
I tried to base this off the wxPython demos wxPopupWindow code, but somehow
it is not working right.

Before I post any code or if I can get a runnable sample going, does anyone
have a pointer to a simple solution?  I can get x and y in pixel space on the
graph from event.mouseevent.x and event.mouseevent.y, but then when I try
to sort of add those to the position of the frame which contains the panel
(which contains the graph), I get some really weird behavior when I move that
frame to the left:  the location of the popupwindow jumps to the far right side
of the screen.

Any help is appreciated--Thanks!

-
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


[Matplotlib-users] sizing plot right when embedded in wxPython

2009-01-16 Thread C M
Hi, this is somewhat of a wxPython issue, maybe, but in the
end I think my confusion is in how the sizing of a mpl canvas vs.
a figure ought to work, and so I am trying here first.

The attached code (a wxPython frame which displays a mpl
graph...what most here would call a plot) shows my problem.
The bottom of the graph is cut off unless I resize the frame to
be very tall.  But one can see that this is wrong because you
can resize it to make it not so tall, but then resize it again but
not let go (don't let it go idle, so it won't yet call it's size method)
and there is plenty of room for the x axis label and such.  When
you do let go it resizes it to cut off the bottom again.

I think this is because in the _SetSize method of the PlotPanel
class, it is getting the parent's client size, but this is not taking
into account two ways in which some of that size is used up
Maybe.  Like:

- In the case of a panel with other objects on it (like the two buttons),
it doesn't subtract the height of those buttons.

- In the case of a wx.AUINotebook, it doesn't subtract the height of
the bar where the tabs are.

I have played around with it but have wound up confusing myself,
and I am unclear as to how the _SetSize method is working here,
or if it is right for all circumstances (I guess it isn't, since my x

I have a nagging sense that I just should RTFM more, but on the
other hand I just wanted a reality check that the way I am thinking
about this is about on target.

Thanks,
Che


embed_problem.py
Description: application/python
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] unfilled markers?

2009-01-25 Thread C M
Sorry this is a basic question but I can't figure out where
in the docs nor archives I could find this.

Is there a built in method for having unfilled markers?
(ones that match the line color).

I could set mfc (marker face color) to white and
mec (marker edge color) to the color of my line, but
what if I don't know the color (because it is generated
through the mpl color cycler)?

Thanks.

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] unfilled markers?

2009-01-25 Thread C M
>>> mfc="None" does the job. mec should then default to the line color.

>> Hmm, I just tried that and it doesn't default to the line color, it
>> instead makes a black edge color for the marker.  I am still using
>> version 0.90.1; is this a newer feature in the latest release? (yes, I
>> will upgrade, just been pokey about it since I was working on other
>> issues).

> I don't remember when I worked on this issue, but it may well be that it
was after
> 0.90.1

Well, I just upgraded matplotlib to the latest, 0.98.5.2, and it is still
not making the colors of the marker edges match the lines.  They're still
black, despite the various lines being red, blue, green...

This is with the wxAgg backend.  The line in my code is:

line = self.subplot.plot_date(dates,values,'-o',picker=5, lw=2,
 markersize=9, mfc="None")

(Also, since upgrading, now I have a number of things that have changed/are
not working in my app, will have to change, but that's probably for the
better since I know there are some nice new features in mpl)

Any ideas?

Thanks,
Che

>
> C M wrote:
>>
>> Sorry this is a basic question but I can't figure out where
>> in the docs nor archives I could find this.
>>
>> Is there a built in method for having unfilled markers?
>> (ones that match the line color).
>>
>> I could set mfc (marker face color) to white and
>> mec (marker edge color) to the color of my line, but
>> what if I don't know the color (because it is generated
>> through the mpl color cycler)?
>>
>> Thanks.
>>
>>
>>
--
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] unfilled markers?

2009-01-25 Thread C M
On Sun, Jan 25, 2009 at 6:44 PM, Norbert Nemec wrote:

> Sorry for my misleading words - I did not correctly recall my own work from
> back then...
>
> In fact, the code as it is does not change the mec automatically when the
> mfc of a filled_marker is set to "None" but leaves it black. I did consider
> adding an automation to change but decided against it. The logic would have
> become too complex and hard to predict.
>
> What you can do is setting the mec afterwards using get_color on the plot
> like
>
>   pl, = plot(x,y,"-o",mfc="None")
>   pl.set_mec(pl.get_color())
>
> Hope that helps?
>
>
Norbert,

It did, thank you!   One question, though:  when I originally tried
something like this, it didn't work, because it was treating pl as a list
and giving me the error of
"list object has no attribute 'set_mec()'"  Why does the addition of the
comma to pl allow it to see it as a line?
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting durations

2009-01-27 Thread C M
I don't think there is a built-in way to do this, but
I thought I'd check first.  Can matplotlib (somehow)
directly plot a duration of time, such as in the form:
0:01:39.983001  (h:m:s:microsec)

Thanks,
Che
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] datetutil issues

2009-02-02 Thread C M
I'm doing some date plotting and make use of dateutil.  The version
I have is given as 1.2-mpl and I believe it installed directly with the
latest matplotlib installation.

My problem is with dateutil's microsecond precision. An example:

>>> date = '2009-01-11 03:55:23.255000'
>>> d = dateutil.parser.parse(date)
>>> d
datetime.datetime(2009, 1, 11, 3, 55, 23, 254999)

Note the microseconds of the datetime object are 254999,
whereas the original date string given was 255000.  This matters
to me in that I am matching to a database and would prefer to
have the two values just match without further manipulation.

I thought maybe newer versions of dateutil would have had this
issue worked out.  I see there is a dateutil 1.4.1 available, here:
http://labix.org/python-dateutil

But I can't seem to install it.  If I go into its downloaded directory
and in the Win command line write "python setup.py install"
it complains "No module named setuptools".  (I can usually
install things in this way fine).

Can anyone help me out?  And can matplotlib include the
more updated version of dateutil in its future releases?

Thanks,
Che

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] title pad?

2009-02-08 Thread C M
Is there anything like a title pad, similar to the xaxis.LABELPAD?
I'd like to see if the plot would look better with the title a bit higher
off the plot.

Thanks,
Che

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] set color of a single point or bar

2009-02-09 Thread C M
Is it possible to set (and unset) the color of a single point
on a line, or an individual bar in a bar chart?

Thanks,
Che

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] pick the legend? pick a point but not a connecting line?

2009-02-21 Thread C M
Hi, I have two picking questions.  First, If I do this inside a pick
handler function:

def OnPick(self, event):
 if isinstance(event.artist, Line2D):
thisline = event.artist
xdata = thisline.get_xdata()
ydata = thisline.get_ydata()

I can grab the data from a line.  Fine.

Now I'd like to do two things:

1) WIthin this same pick handler function, have another if conditional,
but for the case when the user is picking the legend.  In other words, I
want to pick the legend artist, not a Line2D artist.

2) Modify the above so the user can pick only the actual points on a line,
but not the connecting line if I have plotted it like 'o-' style (connected
points).

I hope this is clear.  Any help is appreciated.  Thanks.
Che
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] offset in dragging a legend

2009-03-24 Thread C M
Using mpl 0.98.5.2 in OO mode with wxAgg backend.

I'm trying to make my legends draggable.  It works, but
there is a some inaccuracy with positioning.  As I drag it,
the cursor "outruns" the position of the legend, and that
error grows the further away from the initial starting point
the cursor has been moved.  It makes the feel of dragging
completely wrong.

The work of repositioning the legend is done in an
on_motion event.  self.figure here is a mpl Figure.
The motion event handler is:

#drag the legend
def on_motion(self, event):
height = float(self.figure.bbox.height)
width = float(self.figure.bbox.width)

dx = event.x/width
dy = event.y/height

if self.gotLegend == 1:  #it's picked up
self.legend._loc=(dx,dy)  #reposition it
self.canvas.draw()
self.parent.Refresh()

Any idea why this is wrong?  I cobbled this from
a few sources online and boiled it down to this.
I am confused as to why it should use dx and dy
instead of just the exact position of the mouse.

Any ideas are appreciated, and full runnable
sample is below.

Thanks,
Che


#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.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.gotLegend = 0  #to begin, legend is not picked.

self._SetInitialSize()

self.Bind(wx.EVT_SIZE, self._onSize)
self.state = 'Initial'
self.draw()

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,2,3],[4,5,6],'o',picker=5)
self.line_collections_list.append(line)

#Legend
self.legend = self.subplot.legend(self.line_collections_list,
['datum'], 'right',
   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:
self.gotLegend = 1

#drag the legend
#(This doesn't work well enough)
def on_motion(self, event):
height = float(self.figure.bbox.height)
width = float(self.figure.bbox.width)

dx = event.x/width
dy = event.y/height

if self.gotLegend == 1:
self.legend._loc=(dx,dy)
self.canvas.draw()
self.parent.Refresh()

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

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

parent.AddWindow(self.notebook1, 1, border=0, flag=wx.EXPAND)

def _init_sizers(self):
# generated method, don't edit
self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)

self._init_coll_boxSizer1_Items(self.boxSizer1)

self.panel1.SetSizer(self.boxSizer1)

def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
  pos=wx.Point(333, 202), size=wx.Size(592, 474),
  style=wx.DEFAULT_FRAME_STYLE,
  title='moving the legend accurately')
self.SetClientSize(wx.Size(584, 440))

self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self,
  pos=wx.Point(0, 0), size=wx.Size(584, 440),
  style=wx.TAB_TRAV

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
> The event.x and event.y is the position of the mouse, and often this
> would not be the position of the legend (lower left corner) you want.
> I guess a common practice is to calculate how much your mouse moved
> since you started dragging and adjust the position of the legend from
> its original position by the same amount. What I would do is, in the
> on_pick call, save the current location of the mouse and the current
> location of the legend. And, when on_motion is called, calculate the
> dx, dy of your current mouse position from the saved (original) mouse
> position, and set the location of the legend by adding the same amount
> to the original legend position. Of course, the coordinate need to be
> converted in a proper system.

This is what I have attempted to do below.  Here is the relevant part:

#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
self.legend_x = bbox.xmin  #get legend coordinates
at time of pick.
self.legend_y = bbox.ymin

self.gotLegend = 1  #indicates we picked up the legend.

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

#move the legend from its previous location by that same amount
self.legend._loc=(self.legend_x + mouse_diff_x,
self.legend_y + mouse_diff_y)
self.canvas.draw()
self.parent.Refresh()

Now when I run this, the legend just disappears (well, is moved to somewhere
off the screen).

For those with wx installed, runnable sample follows...

Thanks,
Che

#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.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.gotLegend = 0  #to begin, legend is not picked.

self._SetInitialSize()

self.Bind(wx.EVT_SIZE, self._onSize)
self.state = 'Initial'
self.draw()

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,2,3],[4,5,6],'o',picker=5)
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
self.legend_x = bbox.xmin  #get legend coordinates
at time of pick.
self.legend_y = bbox.ymin

self.gotLegend = 1  #indicates we picked up the legend.

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

#move the legend from its pr

Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
Ok, getting there.  When I print the various coordinates to stdout, it
SHOULD be working, but my legend is simply disappearing.  This
is the stdout on one pixel move with the mouse in the x:

mouse x position at pick time 489
mouse y position at pick time 349.0
Legend x position at pick time =  445.878125
Legend y position at pick time=  339.8
motion_event.x = 488
motion_event.y = 349.0
mouse moved x =  1
mouse moved y =  0.0
new legend location on move =  (446.8781249995, 339.81)
release

But what instead happens is the legend poofs out of existence.

At the end of the motion event, I am calling this:

self.canvas.draw()
self.parent.Refresh()

And wonder if I should be using some other way to redraw the legend?
Is it just not being redrawn this way?  I thought I should use self.draw(),
which is a method in my class which draws the line and the legend,
but using that does nothing at all.

Very stuck here.  Any help appreciated.
C

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


Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
On Wed, Mar 25, 2009 at 9:06 PM, Jae-Joon Lee  wrote:
> As I said in my previous email, the _loc attribute of the legend need
> to be in the normalized axes coordinate, i.e., the lower left corner
> of the axes being (0,0) and the upper-right corner being (1,1). Thus,
> it needs to be something like below.
>
>  loc_in_canvas = self.legend_x + mouse_diff_x, self.legend_y + mouse_diff_y
>  loc_in_norm_axes =
> self.legend.transAxes.inverted().transform_point(loc_in_canvas)
>  self.legend._loc = loc_in_norm_axes
>
> Note that it assumes that the parent of the legend is an Axes
> instance, which I think is your case.
> IHTH,
>
> -JJ

Thanks, but I am getting this error now:

AttributeError: 'Legend' object has no attribute 'transAxes'

My legend is created this way:

self.legend = self.subplot.legend(self.line_collections_list, ['1'],
numpoints=1)

And self.subplot is made this way:

self.figure = Figure(None, dpi)
self.subplot = self.figure.add_subplot(111)

I thought self.subplot is an Axes instance.  Is it not?

Thank you,
C

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


Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
On Wed, Mar 25, 2009 at 9:58 PM, Jae-Joon Lee  wrote:
> Ah, my bad.
>
> Try
>
>   self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas)
>
> legend.parent points to the parent axes.
>
> -JJ
>

That cleared up the error, thanks.  But it is still not actually moving the
legend.  The coordinates are changing as you described it:

loc position (JJ method) =  [ 0.89354419  0.91002415]
motion_event.x = 436
motion_event.y = 349.0
mouse moved x =  31
mouse moved y =  3.0
loc position (JJ method) =  [ 0.90698505  0.91002415]

but the legend doesn't move.

I have tried to different ways of doing the draw method.

1.  self.canvas.draw()
That gives this error and does not move the legend:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()

2. self.draw()  (this is a method which draws the lines and legend
originally in my class).
That just does nothing, though the output is as shown above.

What do I have to do to actually show the repositioned legend?

Thanks for your patience,
C

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


Re: [Matplotlib-users] offset in dragging a legend

2009-03-25 Thread C M
On Thu, Mar 26, 2009 at 12:19 AM, Jae-Joon Lee  wrote:
> Sorry, It's hard to track down what's wrong without actually running the code.

I really appreciate your patience.

> Change
>
>  self.legend._loc = loc_in_norm_axes
>
> to
>
>  self.legend._loc = tuple(loc_in_norm_axes)
>
> and see if it works.
>

That did it!  Thank you.

> You need to call canvas.draw. However, it will draw whole figure
> again. If you're concerned about speed, you may consider to use blit
> method.

> http://matplotlib.sourceforge.net/examples/animation/animation_blit_wx.html

I'll look into it.  For the time being, this is already a very good improvement.

Thanks so much for the help.  For the archives, the working runnable
sample (if you have wxPython) is attached.

Che


draggable_legend2.py
Description: Binary data
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] modifying the toolbar?

2009-03-26 Thread C M
Hi, I have just begun including the toolbar in an embedded (in wx)
use of mpl, and am really pleased with how easily it provides very
useful functions.  Once again, mpl shines.

But I would like to try to modify the toolbar for my application, e.g.
probably remove the "configure subplots" tool (n/a in my context)
and in fact add a number of my own application-specific tools to
that same toolbar.

I  didn't see any toolbar class within the widgets.py file in the
matplotlib directory.  So, a) where can I find it, and b) is there
anything I should be aware of regarding modifying the toolbar?

Thanks,
Che

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


Re: [Matplotlib-users] modifying the toolbar?

2009-03-27 Thread C M
On Fri, Mar 27, 2009 at 1:56 AM, Eric Firing  wrote:
> C M wrote:
>>
>> Hi, I have just begun including the toolbar in an embedded (in wx)
>> use of mpl, and am really pleased with how easily it provides very
>> useful functions.  Once again, mpl shines.
>>
>> But I would like to try to modify the toolbar for my application, e.g.
>> probably remove the "configure subplots" tool (n/a in my context)
>> and in fact add a number of my own application-specific tools to
>> that same toolbar.
>>
>> I  didn't see any toolbar class within the widgets.py file in the
>> matplotlib directory.  So, a) where can I find it, and b) is there
>> anything I should be aware of regarding modifying the toolbar?
>
> Toolbar functionality starts in backend_bases.py and continues in the
> individual toolkit-specific backends, like backends/backend_wx.py.
> Configurability has been on the wish list for a while.
>
> Have you looked at examples/user_interfaces/embedding_in_wx4.py?  It does
> modify the default toolbar.
>
> Eric

Perfect, thank you.

Che

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


[Matplotlib-users] grab more points from a database when panning?

2009-03-30 Thread C M
I've got the NavigationToolbar2 going nicely on my app
(OO, embedded in wx, mpl 0.98.5), and was wondering
how difficult it might be to change how the pan works,
in the following way...

Right now, when I show a plot, I am grabbing a subset
of data from the database.  Panning within that plot
allows exploration of *just that data*.  E.g., if I have
values between x = 100 and x = 200, I can pan past
either of these values, but there are no more data points
beyond that, because I didn't fetch those points when I
created the plot.

What would be nice is if, on panning, I could fetch
new points, namely those that are found in that part of
the x axis.  This would be just like Google Maps' ability
to allow one to pan the map over and see new land area,
because it fetches those land patches of the map.

I could of course just fetch all the data I have first
and set the x limits to show the requested subset
of data initially, but I thought maybe it would
be more efficient to only get what is requested and
then grab more data on pans.  I thought I'd ask if
anyone had done something like this already.

Thanks,
Che

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


[Matplotlib-users] change hour format in date plotting

2009-04-03 Thread C M
I am pretty happy with the default for how dates ticks
are updated with zooming the plot with the navigation
toolbar...until it gets down to the level of hours.

Hours are by default displayed in a format like:
"23:00:00 UTC".  How can I get it to display it in a
more common way, such as "11:00 pm", or better,
"11 pm, 3/15"?

Everything else should stay the same.

Thanks,
Che

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


[Matplotlib-users] preventing scaling view after updating plot

2009-04-08 Thread C M
(mpl 0.98.5 OO embedded in wx)

Hi, I'm trying to highlight a picked datapoint, such as is shown in
this thread:

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg05580.html

As John suggested there, I get the index of the picked point, and then
plot a marker on that point.  I am using the OO mpl form, so then
I call, to draw this new point on the canvas:

self.canvas.draw()
(self.canvas is a figure.canvas object).

But when I do this it *rescales the plot*, which I don't want.  In this thread:

http://www.nabble.com/Re%3A-Plotting-single-marker-point-at-zoomed-level-p17511209.html

I found someone mentioning this concern.  He said:

> Thanks for that, the canvas.draw() function redraws the graph.
> I had to add the "autoscale_on=False" to the add_subplot()
> to stop the graph from autoscaling.

I tried this, and it did stop autoscaling--but I do want y autoscaling.
What I want is y autoscaling but not y autoscaling (just setting xlims).
I tried adding either of these lines right before or right after when I plotted
the highlighted point:

self.subplot.set_autoscale_on(False)
self.subplot.autoscale_view(tight=False, scalex=False, scaley=True)

and it didn't help--the plot rescaled, both x and y.

Any ideas what I'm doing wrong?

Thanks,
Che

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] preventing scaling view after updating plot

2009-04-08 Thread C M
>
> I tried this, and it did stop autoscaling--but I do want y autoscaling.
> What I want is y autoscaling but not y autoscaling (just setting xlims).
> I tried adding either of these lines right before or right after when I 
> plotted
> the highlighted point:

Just to be clearer:  What I want is the plot to stay precisely the same
when I add the highlighted point.  But now I have either of two undesired
alternatives:

1) I do add_subplot(111,autoscale_on=False) when I create the
subplot and none of my plots have the y scaled (but I want them scaled).

2) I do add_subplot(111) and when I add a highlighted datapoint it
autoscales my plot (but I don't want that).

Thanks,
Che

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] preventing scaling view after updating plot

2009-04-09 Thread C M
On Thu, Apr 9, 2009 at 9:25 AM, Ryan May  wrote:
> On Thu, Apr 9, 2009 at 1:04 AM, C M  wrote:
>>
>> >
>> > I tried this, and it did stop autoscaling--but I do want y autoscaling.
>> > What I want is y autoscaling but not y autoscaling (just setting xlims).
>> > I tried adding either of these lines right before or right after when I
>> > plotted
>> > the highlighted point:
>>
>> Just to be clearer:  What I want is the plot to stay precisely the same
>> when I add the highlighted point.  But now I have either of two undesired
>> alternatives:
>>
>> 1) I do add_subplot(111,autoscale_on=False) when I create the
>> subplot and none of my plots have the y scaled (but I want them scaled).
>>
>> 2) I do add_subplot(111) and when I add a highlighted datapoint it
>> autoscales my plot (but I don't want that).
>
> If you upgrade to SVN head, it supports what you want.  You can use:
>
> add_subplot(111, autoscalex_on=False)
>
> I don't think this particular feature has made it into a release yet.
>
> Ryan
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma

Wow, thanks Ryan.  This is the beauty of an email list.  I'll try to
get it from SVN or back-burner this issue until the next release.

Che

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] tweaking automatic date formatting?

2009-04-13 Thread C M
Hi, I've asked this before but still am stuck.  I want to use
mpl's automatic tick locating and date formatting for a zoomable
date plot, OTHER THAN the hour formatting.  The default hour formatting
(when zoomed in on 1 day) is like "05:00:00 UTC", but I'd like to be
of the form something more readable for users, like: "5:00pm 12/03".

If I just use my own custom date formatter, then ALL the zoom levels
will have this format, but I'd only like it for when the plot is zoomed
down to the level of one day.  (So it is a rule of "if zoomed to one day,
use my custom dateformatter, otherwise, use the automatic one").

Why I'd like this:  for looking across weeks or months worth of data,
hours are irrelevant, but for looking at days, hours are relevant, but
users will not think in terms of UTC and they will want to see on the
x axis which day they are looking at.

Does anyone know how this can be done in mpl?  Thank you,
Che

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] tweaking automatic date formatting?

2009-04-14 Thread C M
Thanks, Ryan, John, and Pierre... I will try to change it at the
point John suggests, maybe inspired by scikits.timeseries
(or just using it).

btw, I think adding the ability to set the AutoDateFormat
formatting choices per scale would be a good small addition
to mpl.  (Maybe  that is what the commented lines in the
class are about, but I don't quite understand them).  Methods
like  .set_dayscale_format, .set_weekscale_format, etc.

Thanks,
Che

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Boxplots overlayed with plots

2009-05-10 Thread C M
On Mon, May 11, 2009 at 12:52 AM, Gökhan SEVER  wrote:
> And the answer is:
>
> axis(xmin=..., xmax=...)
>
> Probably, that was a very easy question and no one wanted to answer :)
>
> Gökhan
>
>
> On Sun, May 10, 2009 at 4:12 PM, Gökhan SEVER  wrote:
>>
>> Hello,
>>
>> I overlay bunch of boxplots with mean values shown as stars on each
>> corresponding boxplot instance. (As could be seen in this image:
>> http://img216.imageshack.us/img216/7528/boxplot.png.
>>
>> There is a minor thing that affects the appearance of the figure. That is
>> 1st and the last boxplots don't fit in the figure borders. How can I fix
>> this? Do you have any suggestions?
>>
>> Thank you.
>>
>> Gökhan

What is the difference between doing that or using something like:

axes.autoscale_view(tight=False, scalex=True, scaley=True)

I am under the impression that if tight=False, the plot does not
autoscale to precisely the xlims, but leaves some margin.  Is
that right?

Che

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Boxplots overlayed with plots

2009-05-11 Thread C M
On Mon, May 11, 2009 at 3:06 AM, Eric Firing  wrote:
> C M wrote:
>>
>> On Mon, May 11, 2009 at 12:52 AM, Gökhan SEVER 
>> wrote:
>>>
>>> And the answer is:
>>>
>>> axis(xmin=..., xmax=...)
>>>
>>> Probably, that was a very easy question and no one wanted to answer :)
>>>
>>> Gökhan
>>>
>>>
>>> On Sun, May 10, 2009 at 4:12 PM, Gökhan SEVER 
>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I overlay bunch of boxplots with mean values shown as stars on each
>>>> corresponding boxplot instance. (As could be seen in this image:
>>>> http://img216.imageshack.us/img216/7528/boxplot.png.
>>>>
>>>> There is a minor thing that affects the appearance of the figure. That
>>>> is
>>>> 1st and the last boxplots don't fit in the figure borders. How can I fix
>>>> this? Do you have any suggestions?
>>>>
>>>> Thank you.
>>>>
>>>> Gökhan
>>
>> What is the difference between doing that or using something like:
>>
>> axes.autoscale_view(tight=False, scalex=True, scaley=True)
>>
>> I am under the impression that if tight=False, the plot does not
>> autoscale to precisely the xlims, but leaves some margin.  Is
>> that right?
>
> Not necessarily--there is no guaranteed margin, although making such a
> margin a settable parameter has been in mind for a long time.  With
> tight=False, the autoscaling goes to the nearest ticks that include the data
> range, so depending on the data range and the tick intervals, there might be
> negligible margin.
>
> Eric

Useful to know, thanks.
Che

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] question about tight_layout()

2011-10-14 Thread C M
Just trying out the latest mpl 1.1.0 and the tight_layout() method.  I saw
the guide written about it, but am a unsure how to use this when using the
OO approach to using Matplotlib.

When using pyplot, the method is:  plt.tight_layout().  When using the OO
form of mpl, is it:  figure.tight_layout() ?

I assume it is, because I tried this and it didn't give me a name error, but
I did get an error:  ValueError: left cannot be >= right.

What am I doing wrong?

Thanks,
Che
--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about tight_layout()

2011-10-15 Thread C M
On Sat, Oct 15, 2011 at 10:15 AM, Jae-Joon Lee  wrote:

> Figure.tight_layout() is a correct way.
> Do you see that error only when you use Figure.tight_plot (and not
> when you use plt.tight_layout)?
>

Yes.


> What happen you try the script below.
>
> import matplotlib.pyplot as plt
> fig = plt.figure(1)ax = fig.add_subplot(111)fig.tight_layout()
>

That runs without error.

However, I can't get it to work correct with Figure.  I'm either getting
that same error or failure to adjust the Figure's size to accommodate the
axes' labels.  I attach a minimal runnable sample that demonstrates these
problems for those that embed in wxPython.

Thanks,
Che


testing_tight_layout.py
Description: Binary data
--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about tight_layout()

2011-10-16 Thread C M
> In your example code, do you see the error raised only when you
> include the tight_layout call?

Yes.  To see this (at least on my platform), you take the example code
and try two things:

1) Comment IN this line: self.panel.Layout().  Run it and you'll get the error.
3) Now comment OUT the tight_layout() call.  Run it and you won't get the error.

So you have to Layout() a parent panel (the one the canvas is sitting
on) for this error to occur, but that is a common thing to do in
wxPython when using sizers and shouldn't cause errors.  Here is the
traceback:

Traceback (most recent call last):
  File "C:\Documents and
Settings\user\Desktop\testing_tight_layout.py", line 35, in 
frame = Frame1(None)
  File "C:\Documents and
Settings\user\Desktop\testing_tight_layout.py", line 14, in __init__
self.Add_MPL_Plot()
  File "C:\Documents and
Settings\user\Desktop\testing_tight_layout.py", line 30, in
Add_MPL_Plot
self.figure.tight_layout()
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line
1393, in tight_layout
self.subplots_adjust(**kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line
1218, in subplots_adjust
self.subplotpars.update(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 183, in update
raise ValueError('left cannot be >= right')
ValueError: left cannot be >= right

I just don't understand what this means and why it would be thrown.

> Anyhow, your code runs fine in my installment, linux + python 2.7.2 +
> wxgtk 2.8.11.0 + mpl master branch.
> On which platform you're running this?

WinXP, Python 2.5, wxPython 2.8.10.1 (msw-unicode), mpl 1.1.0 as
downloaded from the site three days ago.

When you say the code runs fine, did you try steps (1) and (2) above?
Also, if you just run it without making those changes, does the
tight_layout() work to resize the plot such that it allows the axis
labels to be seen at all times?  (it doesn't for me).

So, to summarize:

- Error if I call self.panel.Layout() before I call tight_layout().
- If I don't do this, no error, but it still isn't doing a proper tight layout.

Thanks,
Che

--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about tight_layout()

2011-10-16 Thread C M
> So, it seems that the issue is platform-dependent.

OK.

> As for the error message, it seems that the subplot_params values
> (left, right, top, bottom, etc) calculated by the "tight_layout"
> routine is somehow corrupted.
> Why this happens is hard to track down unless I can reproduce the error.
> And I hope any other windows developer out there can take a look at this 
> issue.
>
> Meanwhile, can you play a little bit more with your script?
>
> 1) check the size of the figure (print self.figure.get_size_inches())
> before a tight_layout is called.

What it prints is this:
[ 8.  6.]


> 2) see if calling the draw method (self.canvas.draw()) before the
> tight_layout helps.

It didn't help.

> Also, please open a git issue on this so that others can take a look.

Sure.  It's issue #532.  (I tried to include the sample script but the
indenting got removed from the issue window, not sure how to fix
that).

Thanks,
Che

--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] data free margin

2011-11-22 Thread C M
What's the best way in Matplotlib to have a y axis that doesn't have
ticks/axis numbers near the bottom of the graph?  I don't know if it would
be specified as the bottom 1/10th of the graph or x amount of pixels or
inches or whatever...just need a bit of extra "y-less" space there to plot
values that have an x value but no y value.  I'm assuming this would be
done with a Formatter or Locator, but wasn't sure how to go about it.

See attached image

Thanks,
Che
<>--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] data free margin

2011-11-23 Thread C M
On Tue, Nov 22, 2011 at 3:09 PM, Nicolas Rougier
wrote:

>
> Is that what you want ?
>
> No ticks, no labels:
>
> import matplotlib.pyplot as plt
> plt.plot(np.arange(10), np.arange(10))
> plt.ylim(0,10)
> plt.yticks(np.linspace(3,10,8))
> plt.show()
>

Thanks.  That works in your example, but in my actual code, it seems to
override my custom formatter, and therefore messes up the axis formatting,
which isn't going to work.

Maybe I can integrate it into the formatter somehow.  If anyone has related
tips, please let me know.

Che
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] data free margin

2011-11-24 Thread C M
>
> I don't know if this will work for you, but in your situation I would
> probably just make another axis for the data with no y value. Like, a short
> squat axis directly below the main axis.
>

> -Jeff
>

Thanks.  That crossed my mind, but I never tried it yet.  I thought it
would take up too much vertical room in the display to have another axis
just for what would likely be 1-2 data points worth of y-less data.  I'd
really want to not display the x axis for that one and just align it with
the x axis of the main plot, but then the data points would be *below* the
axis, and that would seem visually odd.

I'll play with it in a sample app and see if I can get it to look good this
way.

 Che
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] help with custom formatter rules

2011-11-28 Thread C M
As related to another question(s) I've posted, can someone help with this
custom formatter?  This is for use in a FunctionFormatter to be used on the
y axis to format the ticks (in particular, to remove them when not
wanted).  Example:

def CustomFormatter(self,y,i):
if y < 0:
return ''

This says if the value of y < 0, put nothing on the axis tick.

QUESTION:  How can I implement the following two sorts of rules in
Matplotlib's (OO) API?

def CustomFormatter(self,y,i):
if y falls in the bottom 50 pixels' worth of height of this plot:
return ''

or

def CustomFormatter(self,y,i):
if y falls in the bottom 10% of the height of this plot:
return ''

Thanks,
Che
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Subplot x-tick labels overlap with each other and with titles

2012-01-29 Thread C M
On Wed, Jan 4, 2012 at 2:19 PM, Benjamin Root  wrote:

>
>
> On Wednesday, January 4, 2012, jeffsp  wrote:
> >
> > plt.tight_layout(), sweet
> >
> > it still makes the labels too close to read, even if they don't overlap.
> > that is, they're just a continuous string of numbers with no whitespace
> > between.
> >
> > it does clean up the rest of the plot really nicely, though, without
> having
> > to continually dick around with subplots_adjust
> >
> >
>
> Well, it is a new feature with plenty of room for improvements.  Maybe
> some sort of mindist parameter would be useful to establish a minimum
> distance between text objects?
>
> Ben Root
>
>
Something like that sounds good.  If there were a way to make it the
default that labels would never overlap (but that default could be toggled
for those who, somehow, want to not be able to read their labels?), that
strikes me as best.

In the meantime, what are other ways to do this?
--
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 leading 0 on times from DateFormatter

2012-01-29 Thread C M
If I use the DateFormatter, like this:

mydateformatter = DateFormatter("%b%d \n %I:%M%p", self._tz)

I'll get dates like (note the time part):

Nov 27 2011
 03:00 PM

Instead, I'd like to lose the zero on times, like:

Nov 27 2011
  3:00 PM

Is there a way to do that?

Thanks,
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] no leading 0 on times from DateFormatter

2012-01-30 Thread C M
On Mon, Jan 30, 2012 at 12:32 PM, Daryl Herzmann wrote:

> On Sun, Jan 29, 2012 at 10:10 PM, C M  wrote:
> > If I use the DateFormatter, like this:
> >
> > mydateformatter =
>
> >
> > I'll get dates like (note the time part):
> >
> > Nov 27 2011
> >  03:00 PM
> >
> > Instead, I'd like to lose the zero on times, like:
> >
> > Nov 27 2011
> >   3:00 PM
> >
> > Is there a way to do that?
>
> I believe if you put a '-' sign in there, it will work
>
> DateFormatter("%b%d \n %-I:%M%p", self._tz)
>
> daryl
>

Thanks, but that doesn't work.  If I use that, I get all times listed as
1:00 AM.

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


[Matplotlib-users] Show custom tool on NavToolbar staying pressed in

2012-02-01 Thread C M
The standard navigation toolbar has tools that press in and stay pressed to
put the interation into a "mode", like zoom mode or pan mode.  You press
the zoom tool, it stays shown as pressed in while it's in that mode.

I am trying to add a new custom tool to the toolbar, and want it to put
things into a mode as well, and therefore stay pressed in until pressed
again.  How do I do that?

This is using the wxAgg backend.  I searched through backend_wxagg and
backend_bases and couldn't figure it out.  Normally in wxPython you specify
the style of a tool as having, to quote its API, "wxITEM_CHECK for a
checkable tool (such tool stays pressed after it had been toggled) "  Here
I didn't see any option for that.

Thanks,
Che
--
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] Show custom tool on NavToolbar staying pressed in

2012-02-01 Thread C M
On Wed, Feb 1, 2012 at 5:25 PM, C M  wrote:

> The standard navigation toolbar has tools that press in and stay pressed
> to put the interation into a "mode", like zoom mode or pan mode.  You press
> the zoom tool, it stays shown as pressed in while it's in that mode.
>

CORRECTION:  My mistake, it's not really shown pressed,  more like
"selected," with a blue thin line highlighting its perimeter.  In any case,
it's a cue to the user that the UI is in that mode.  That's what I'd like
my custom tool to have.
--
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] 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


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


[Matplotlib-users] 2 possible bugs with make_axes_area_auto_adjustable

2012-02-09 Thread C M
Jae-Joon's code, make_axes_area_auto_adjustable has been a great help to
dynamically resizing my plots' axes area--such an improvement.  But there
are two bugs I've noticed that I wonder if has been identified/fixed yet:

1) When I point-pick on the plot, the plot area still "jumps" (expands
vertically a small amount).  It used to do this each time I point-picked,
but after upgrading MPL it now just does it the *first* time only.  But is
it possible it can be fixed so it doesn't jump at all?

2) I just noticed that if a plot is resized so that the window that the
plot is embedded in is *narrower than the title on the plot*, the resizing
of the axes area gets very messed up (it gets *much8 narrower than is
necessary to fit the available area).  I'm not sure what the best approach
to fixing this is, since it's not ideal to have a title not fit the
figure's area, either...is it possible to flow-wrap a plot title?

Thanks,
Che
--
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] 2 possible bugs with make_axes_area_auto_adjustable

2012-02-13 Thread C M
I noticed what is causing one of these issues:

1) When I point-pick on the plot, the plot area still "jumps" (expands
> vertically a small amount).  It used to do this each time I point-picked,
> but after upgrading MPL it now just does it the *first* time only.  But is
> it possible it can be fixed so it doesn't jump at all?
>

I see why this happens.  When I point pick, a popup window pops up and
covers the plot.  I think this triggers a redraw.  What causes the jump in
my case is that the plot's title is set, in y coordinate, to 1.04.  That
is, the line is this:

self.subplot.title.set_y(1.04)

This is interacting with the line in make_axes_area_auto_adjustable:

if self.title.get_visible():
artists.append(self.title)

Essentially, it is getting the bbox, taking into consideration the plot's
title and other artists.  But if the title is set to greater than 1.00,
when I point pick (and force a redraw?), it has to recalculate the plot's
axes areas and it adjusts things, so the user sees the small vertical
expansion ("jump").

The problem goes away if I set the plot's title to 1.00:

self.subplot.title.set_y(1.00)

*However, this puts the title too close to the top of the plot area for my
aesthetic liking.*  I'd prefer a little larger margin.

There should be a simple fix that allows for the title to be a bit higher
off the plot area and yet not cause this jump.  It would be in the code at
the end of this email, but i don't know enough about bbox to fix it
yet...any hints?

Thanks,
Che

def axes_get_tightbbox(self, renderer):
"""
return the tight bounding box of the axes.
The dimension of the Bbox in canvas coordinate.
"""

artists = []
bb = []

artists.append(self)

if self.title.get_visible():
artists.append(self.title)

if self.xaxis.get_visible():
artists.append(self.xaxis.label)
bbx1, bbx2 = axis_get_ticklabel_extents(self.xaxis, renderer, True)
bb.extend([bbx1, bbx2])
if self.yaxis.get_visible():
artists.append(self.yaxis.label)
bby1, bby2 = axis_get_ticklabel_extents(self.yaxis, renderer, True)
bb.extend([bby1, bby2])


bb.extend([c.get_window_extent(renderer) for c in artists if
c.get_visible()])

_bbox = mtransforms.Bbox.union([b for b in bb if b.width!=0 or
b.height!=0])

return _bbox
--
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] 2 possible bugs with make_axes_area_auto_adjustable

2012-02-15 Thread C M
On Mon, Feb 13, 2012 at 12:48 PM, C M  wrote:

> I noticed what is causing one of these issues:
>
> 1) When I point-pick on the plot, the plot area still "jumps" (expands
>> vertically a small amount).  It used to do this each time I point-picked,
>> but after upgrading MPL it now just does it the *first* time only.  But is
>> it possible it can be fixed so it doesn't jump at all?
>>
>
> I see why this happens.  When I point pick, a popup window pops up and
> covers the plot.  I think this triggers a redraw.  What causes the jump in
> my case is that the plot's title is set, in y coordinate, to 1.04.  That
> is, the line is this:
>
> self.subplot.title.set_y(1.04)
>
> This is interacting with the line in make_axes_area_auto_adjustable:
>
> if self.title.get_visible():
> artists.append(self.title)
>

I have a workaround for this, which is just using a tip from Jae Joon to
me* from 3 years ago (!).  Instead of setting the title offset as shown
above, I set it in this fashion:

self.subplot.titleOffsetTrans._t = (0., 20.0/72.)
self.subplot.titleOffsetTrans.invalidate()

And then this somehow doesn't interact with the make_axes_area_auto_
adjustable function.

One problem down.  (I hope it is OK that I am answering my own questions,
but didn't want to leave them out there and have others bother to work on
it).

-Che

*
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg10259.html
--
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


[Matplotlib-users] custom markers from images?

2012-02-29 Thread C M
I'd like to use, in one case, small loaded images (pngs) as markers on an
interactive matplotlib plot (using the OO approach).  I'd potentially like
to be able to point-pick these markers, too, as well as have them update
appropriately if the plot is resized.

The only example I've been to find of this is here:
http://stackoverflow.com/questions/2318288/how-to-use-custom-marker-with-plot

But that is from 2 years ago.  Is this way of doing it--which the author
describes as a "kludge"--still the state of things, or is there a better
approach now?  (And right now this way isn't working for me...the images
are down the bottom of the figure).

Thank you,
Che
--
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] custom markers from images?

2012-03-01 Thread C M
> Yeah, there are better ways to do that, somewhat.  The problem with the
> proposed solution is that it relies on non-public APIs, which are can be
> subject to change without deprecation.  Instead, I would have created the
> figimage object with a particular transform object that would have placed
> it at the appropriate data points.


Maybe your or someone from this list can help me understand more about
this.  So, if I take the code that I have adapted to my purposes, there are
questions I have about it:

# constants
dpi = 72; imageSize = (32,32)
# read in our png file
im = image.imread('redX_10.png')

So far, so good--just setting the dpi and getting the image.

fig = self.figure
ax = self.subplot
ax.get_frame().set_alpha(0)

Does the current version of Matplotlib require the frame be set to fully
transparent?  I need a white canvas, so I think I'd rather not do that.

# translate point positions to pixel positions
# figimage needs pixels not points
line = self.line_collections_list[0][0]

"line" here is my line of datapoints from elsewhere in my app.

line._transform_path()
path, affine =
line._transformed_path.get_transformed_points_and_affine()
path = affine.transform_path(path)

I have no understanding of the purpose of the previous three lines.  Can
someone give me a quick explanation?

for pixelPoint in path.vertices:
# place image at point, centering it

fig.figimage(im,pixelPoint[0]+80,pixelPoint[1]+180,origin="upper")

This is just a way to put the image somewhere on my canvas to see it, so
these offsets are just for this exercise.

I should state that if I do it this way, the images appear on the canvas
but are NOT repositioned in data coordinates (and they should be)--which is
probably just Ben's point, right?

Thanks,
Che
--
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] custom markers from images?

2012-03-02 Thread C M
> Right.  It should be technically feasible to just simply tell figimage to
> use a different transformation object, but this might have implications
> elsewhere.  I am very hazy in this part of mpl.
>

Hmm, I've simplified the figimage to just this line:

fig.figimage(im,100,100,origin="upper", transform=None)

And it puts the image 100 up and 100 px out from the lower right corner.  I
then tried setting the transform from None to all the various possible
transforms listed on this page:

http://matplotlib.sourceforge.net/users/transforms_tutorial.html

as well as their inverted() forms.  None of them allowed the image to be
updated with data coordinates when the plot was resized.

It really seems that figimage is a property of the figure only and not the
canvas, so whatever the axes do is irrelevant to its placement.

But I really don't know for sure.  So far, this isn't going to work this
way.

Thanks,
Che
--
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] custom markers from images?

2012-03-07 Thread C M
I've for now taken a different approach that means I won't need custom
markers from images.

But I'm just curious:  is there any wish/plans in Matplotlib to add support
for this?  I think it could do a lot to expand what's possible in terms of
the look and feel of plots (even without things drifing into USA Today
territory!).

Just my $0.02

Che
--
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


[Matplotlib-users] make a rectangle that doesn't change with zoom.

2012-03-20 Thread C M
I'm trying to make a rectangle that "highlights" a straight line of markers
such that:

1) it surrounds/contains the points, basically like:

--
|
  |
|   OO   O  O
 |
|
   |
|-

2) its height doesn't change with zoom.  (it should always be approximately
a little taller than the height of the markers' heights).

I can do (1) but so far not (2).  I'm pretty sure I need to use a blended
transform for this somehowand possibly TransformedPath, but I'm lost as
to how to do this.

Thanks,
Che
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] why does transform=None cause a patch not to be shown?

2012-03-21 Thread C M
For the following code, if I remove the transform=None a green patch is
shown.  If it is in, it is not shown.  I would think that transform=None
should have no effect.  Why is this?

Thanks,
Che


import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.path import Path

fig = plt.figure()
ax = fig.add_subplot(111)

start = 0.2
stop = .6

verts = [
(start, .2), # left, bottom
(start, .4), # left, top
(stop, .4), # right, top
(stop, .2), # right, bottom
(0., 0.), # ignored
]
codes = [Path.MOVETO,
 Path.LINETO,
 Path.LINETO,
 Path.LINETO,
 Path.CLOSEPOLY,
 ]

path = Path(verts, codes)

patch = patches.PathPatch(path, facecolor='g',
  lw=1, edgecolor='grey',transform=None )

ax.add_patch(patch)

plt.show()
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib for Mac OS 10.7 (Lion)

2012-04-20 Thread C M
Trying to help a Mac friend running OSX 10.7 (Lion) easily set up to test
scripts I send him, and have some questions:

1) Can Matplotlib 1.1 run on the Python 2.7.2 version that comes with
Lion?

2) When is there expected to be an installer for Matplotlib 1.1 for OSX
10.7?

Thanks,
Che
--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib for Mac OS 10.7 (Lion)

2012-04-24 Thread C M
> > Trying to help a Mac friend running OSX 10.7 (Lion) easily set up to test
> > scripts I send him, and have some questions:
> >
> > 1) Can Matplotlib 1.1 run on the Python 2.7.2 version that comes with
> > Lion?
>
> Yes. You can easily build it yoursef as long as you have XCode
> installed:
>
> - Edit setupext.py so that the list of values for "darwin" is
> ['/usr/local', '/usr', /usr/X11']
> (and for a really vanilla build leave out /usr/local). (I have a pull
> request for this to be part of the standard distro, but I don't know if
> or when it will go in since not a big issue.)
>
> Then do the usual:
> % python setup.py build
> % sudo python setup.py install

Where are you getting matplotlib 1.1 for Mac OSX 10.7 from to build it?


> > 2) When is there expected to be an installer for Matplotlib 1.1 for OSX
> > 10.7?
>
> There is one, but like all the matplotlib (and numpy and scipy) official
> binaries it uses python.org's python, not Apple's.
>
> To go this route install python.org's Python 2.7.2 for 10.6-and-later
> (which is 64-bit) and then install the official numpy and matpotlib
> binaries.

>From where?  I didn't see it.  I am talking about having a binary
installer on the Matplotlib downloads page,,. the last one I see there
is this, which is for OSX-10.6:

matplotlib-1.1.0-py2.7-python.org-macosx10.6.dmg2012-02-15

which is from about two month ago.

Thanks,
Che

--
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


[Matplotlib-users] wrapping y axis tick labels?

2012-07-20 Thread C M
How possible would it be to wrap y axis tick labels after a certain
text length?  I have a horizontal bar plot where some bars' labels are
too long and therefore cut off.  I can scrunch the width of the whole
plot to accommodate them, but I'd much rather wrap long text and allow
a little more space to accommodate two lines.  For examples:

I'd like to go from this:

   a short axis label |  ==

A very long axis label that gets cut off  |   =


To this:
   a short axis label |  ==

A very long axis label  |   =
that gets cut off


Is this possible or has it ever been done?

Thanks,
Che

--
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] matplotlib is slow

2012-12-31 Thread C M
Resurrecting an old thread here

On Tue, Mar 29, 2011 at 3:23 PM, David Kremer  wrote:

> > I would recommend running the import in the Python profiler to determine
> > where most of the time is going.  When I investigated this a few years
> > back, it was mainly due to loading the GUI toolkits, which are
> > understandably quite large.  You can avoid most of that by using the Agg
> > backend.  If you're using the Agg backend and still experiencing
> > slowness, it may be that load-up issues have crept back into matplotlib
> > since then -- but we need profiling data to figure out where and how.
>

Importing Matplotlib is very slow for me, too.  For a wxPython application
with embedded Matplotlib, I am getting "load" times of > 20 seconds when
"cold" importing matplotlib, with this (circa mid 2004) computer setup:
Windows XP, sp3, Intel Pentium, 1.70 Ghz, 1 GB RAM.

This is, by the way, an import well after Python and wxPython have already
been loaded into RAM, as it happens by a user action, so none of the time
involved here is due to loading Python or wxPython (they both load more
quickly--about 10 seconds to cold import them, my code, images, and some
other libraries).

First of all:  does that amount of time seem appropriate for that fast of a
system--or is that too long?  It definitely *feels* way too long from a
user perspective (for comparison Word or PowerPoint loads on this computer
in about 2.5 seconds).

Trying to improve it and following this old thread, I have switched to

matplotlib.use('Agg')

instead of

matplotlib.use('wxAgg')

as suggested to speed things up...but it is no faster.

I see, though, that I also have lines such as:

from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg

Would the presence of these imports obviate the fact that I switched to
using the Agg instead of the wxAgg?  If so, is there any way to use
something faster here (I suspect not but thought I'd ask).

Also, what else should I consider doing to reduce the import time
significantly?  (I have to learn how to use the profiler, so I haven't done
that yet).

Thanks,
Che

 >
> > Mike
>
> Thank you a lot for your answer.
>
> I noticed than _matplotlib.pyplot_ is longer to be imported the first time
> than
> if it has already been imported previously (maybe things are already
> loaded in
> ram memory), and we don't need to fetch it from the hard drive thanks to
> the
> kernel.
>
> As far I see, the function calls are the same for the two logs I obtained,
> except than the first took 6s instead of 1.4s.
>
>
>
>
> The two logs have been obtained using :
> 
> python -m cProfile temp.py
> 
>
> where temp.py consist of two lines :
>
> 
> #!/usr/bin/env python2
>
> import matplotlib.pyplot
> 
>
>
>
>
>
>
> --
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread C M
On Thu, Apr 18, 2013 at 11:03 PM, John Ladasky
wrote:

> .
> Reading more, I realize that the way I was getting GUI output previously
> (with Python 2.7 and Matplotlib 1.1) was through wxPython.
> Unfortunately, it appears that wxPython's star is fading, and a Python
> 3-compatible version will not be written.  In fact, wxPython hasn't
> released a new version in nine months.
>

wxPython is alive and well and the newest developmental version of it
("Phoenix") runs on Python 3. It should be released fairly soon.  One of
the wxPython list regulars mentioned getting his software to run with it,
with a few minor issues, just six days ago.  So you might want to give
Phoenix a try.

Che
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] time axis format

2013-06-10 Thread C M
On Mon, Jun 10, 2013 at 8:08 PM, Sudheer Joseph wrote:

>
> Thank you,
> So there is no way to get J F M A etc with out reducing font size?
>

I bet there a number of ways.  Offhand I don't know the one that, once I
hear about it, I will say, "D'oh, that's so easy" but I bet it exists.  But
you could modify the DateFormatter class.  It is set to return a strftime
result string.  Here is the function:

def __call__(self, x, pos=0):
if x==0:
raise ValueError('DateFormatter found a value of x=0, which is
an illegal date.  This usually occurs because you have not informed the
axis that it is plotting dates, eg with ax.xaxis_date()')
dt = num2date(x, self.tz)
return self.strftime(dt, self.fmt)

All you would have to do is change that last line to:

return self.strftime(dt, self.fmt)[0]

To slice just the first letter of the month.

So you could subclass DateFormatter to do this, since you probably don't
want to modify the actual DateFormatter class always in this way.

Also, aside from the J F M A approach, you could just rotate the month's
name, and that will reduce crowding while keeping the month a little
clearer (I think "JAN FEB MAR APR" is more intuitive and pleasant to read
on a graph).

Che




> We often need to make presentation in front of senior people who insist
> for bigger fonts.
> With best regards,
> Sudheer
>
>  --
> * From: * Paul Hobson ;
> * To: * Sudheer Joseph ;
> * Cc: * matplotlib-users@lists.sourceforge.net <
> matplotlib-users@lists.sourceforge.net>;
>  * Subject: * Re: [Matplotlib-users] time axis format
> * Sent: * Mon, Jun 10, 2013 8:08:18 PM
>
>   In that case, I would use ax.tick_params(...) to make the font smaller.
>
>
> On Sat, Jun 8, 2013 at 7:36 AM, Sudheer Joseph 
> wrote:
>
>> Dear Paul,
>>The issue I am facing is like in the attached plot where
>> the month naming get cluttered.
>> with best regards,
>> Sudheer
>>
>> ***
>> Sudheer Joseph
>> Indian National Centre for Ocean Information Services
>> Ministry of Earth Sciences, Govt. of India
>> POST BOX NO: 21, IDA Jeedeemetla P.O.
>> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
>> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
>> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
>> E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com
>> Web- http://oppamthadathil.tripod.com
>> ***
>>
>>   --
>>  *From:* Sudheer Joseph 
>> *To:* Paul Hobson 
>> *Cc:* "matplotlib-users@lists.sourceforge.net" <
>> matplotlib-users@lists.sourceforge.net>
>> *Sent:* Saturday, 8 June 2013 7:46 PM
>>
>> *Subject:* Re: [Matplotlib-users] time axis format
>>
>> Thank you Paul for the helping hand,
>>   However I was looking for slightly
>> different solution like in the attached plots. I used ferret to do this
>> based on the length of the time axis it chose the mode of labelling. for
>> example in case of 2 year plot it made month labeling as j f m etc and in
>> case of 1 year as there is enough space on x axis it made jan feb etc with
>> single label of year.
>>
>> In the attached python plot (ATser_RAMA_HYCOM_U_8n90e.png) every tick
>> point is lablled for year, which I wanted to avoid and get plots similar to
>> the first types thought it is not done automatically but at least manually.
>>
>>
>>
>> ***
>> Sudheer Joseph
>> Indian National Centre for Ocean Information Services
>> Ministry of Earth Sciences, Govt. of India
>> POST BOX NO: 21, IDA Jeedeemetla P.O.
>> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
>> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
>> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
>> E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com
>> Web- http://oppamthadathil.tripod.com
>> ***
>>
>>   --
>>  *From:* Paul Hobson 
>> *To:* Sudheer Joseph 
>> *Cc:* "matplotlib-users@lists.sourceforge.net" <
>> matplotlib-users@lists.sourceforge.net>
>> *Sent:* Friday, 7 June 2013 8:50 PM
>> *Subject:* Re: [Matplotlib-users] time axis format
>>
>>
>>
>>
>> On Thu, Jun 6, 2013 at 11:39 PM, Sudheer Joseph > > wrote:
>>
>> Dear Experts,
>> I have been experimenting with the plot_dates option of
>> matplotlib to plot time series data and have below questions
>>
>>  I have used
>> loc = mdates.AutoDateLocator()
>> ax.xaxis.set_major_locator(loc)
>> ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('%b\n %Y'))
>>
>>
>> and got the tick labels in attached plot
>>
>> However I feel the repeatd year labeling is not needed here and it is
>> required once in a year only , Also if I need to plot long time seris
>> insted of "MAR" "APR" I wanted to get them reduced to "M" "A" etc so that
>> the lave

Re: [Matplotlib-users] progress bar?

2010-06-28 Thread C M
On Mon, Jun 28, 2010 at 11:31 AM, Jim Vickroy  wrote:
> Carlos Grohmann wrote:
>
> I've been searching but coudn't find any example on how to add a
> progress bar to a wxpython+matplotlib app.
> I'd like my app to show a progress bar while some gridding and
> contouring are being done.

Or, if you don't want a separate dialog popping up, just use
wx.Gauge--it is a progress bar, and you can choose to put it near
(maybe under) your plot in the layout.

Che

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] py2exe and matplotlib - Fonts: do I need them all?

2010-09-16 Thread C M
On Thu, Sep 16, 2010 at 6:33 PM, Carlos Grohmann
 wrote:
> Hello all,
>
> I'm new to py2exe but I managed to create a binary executable of my
> program. Now I'm experiencing on how to make the final size of the
> binary smaller.
>
> I already managed to cut about 15Mb by removing calls to pyQt (I use
> Wxpython) and also to scipy.
> One thing that is still bothering me is the mpl_data directory that
> holds about 3.5 Mb of fonts.
>
> Is it OK to remove the fonts I don't use? (I use only sans-serif) By
> Ok I mean not only from the practical poin tof view (that is, will the
> app run?) but also from the _legal_ point of view (am I obliged to
> distribute all those fonts?)
>
> And what about all thos .afm files? Are they needed? What are they really?
>
> I hope to find some answers from your experience.

I think many would definitely benefit from knowing what can be left
out and how to do it, even beyond what you have mentioned.  I look
forward to seeing whatever responses you might get.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] another incorrectly clipped PNG in the gallery

2010-09-22 Thread C M
On Wed, Sep 22, 2010 at 6:16 PM, Eric Firing  wrote:
> On 09/22/2010 10:11 AM, Russell Owen wrote:
>> On Sep 22, 2010, at 11:16 AM, Benjamin Root wrote:
>>
>>> On Wed, Sep 22, 2010 at 12:04 PM, Russell E. Owen >> > wrote:
>>>
>>>     In article <4c935c08.1000...@gmail.com
>>>     >,
>>>     Alan G Isaac mailto:alan.is...@gmail.com>>
>>>     wrote:
>>>
>>>     >
>>>     
>>> http://matplotlib.sourceforge.net/examples/pylab_examples/accented_text.html
>>>
>>>     It's realistic, and that has a lot to be said for it.
>>>
>>>     One of my problems with matplotlib is that it is far too willing to
>>>     truncate axis labels and related information. I'd be much happier
>>>     with a
>>>     layout model that always showed the axis labels in full.
>>>
>>>
>>> Ditto on this. In addition, it would be useful to prevent axes labels
>>> from spilling over into another axes' area.
>>
>> I submitted bug report #3073546 on the issue of axis labels getting
>> truncated.
>> https://sourceforge.net/tracker/?func=detail&atid=560720&aid=3073546&group_id=80706
>> 
>>
>> You might want to add your suggestion about axis labels or submit a new
>> ticket.
>
> The problem is not a bug; it is inherent in the fundamental design.
> Therefore I moved the ticket over to feature requests.  I want to keep
> the bugs list for real bugs that we can realistically expect to solve
> fairly quickly.
>
> I don't know whether Andrew Straw's wx sizer-inspired code (mplsizer
> toolkit) solves the problem or not.  My impression is that it does
> not--I think it is working with the Axes positions, not with axis and
> tick labels, which are what cause most of the difficulties.
>
> Eric

Until a more permanent solution is figured out, can anyone recommend
any workarounds, even if they are a little clunky?  I'm embedding mpl
plots in wxPython and am also finding this issue suboptimal.

Che

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] simpler example of embedding in wx

2010-09-25 Thread C M
I'd like to offer a simplest possible example for embedding in
wxPython; significantly simpler and completely pared down compared to
either of the two that are shown here:

http://www.scipy.org/Matplotlib_figure_in_a_wx_panel

but I don't have access to modify the page.  Doesn't anyone on the
list have that access, and
would that be welcome?  My example is ~20 lines long.

Thanks,
Che

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] date plot with two y axes...and some other things

2010-11-18 Thread C M
Goals:  date plot with two y axes (plotting completely different things)
point picking and point labeling
As many lines as user wants, all colored differently.

Having some problems with this.  (matplotlib 0.98.5)

1) There is a known bug with twinx() and plot_date:

http://sourceforge.net/tracker/index.php?func=detail&aid=3046812&group_id=80706&atid=560720

But I can get it to work if I change ONE OF the plot_date() calls (the
one for the values plotted to the right-hand y axis) to just plot().

Is that going to introduce problems?  Is there a better workaround?
(The ones on that page don't work for me).

2) How can I get the lines belonging to different axes to cycle
through colors such that the same color is not used for any lines
shown in the plot?  (that is, I don't want to hard code a color to any
line, I want it to auto-cycle).

3) My point picking is not working with the two axes.  In my routine,
I label  the picked point and to do that I have to make reference to
its axis and call plot_date().  How can I know which axis the picked
point came from, so that I can label it appropriately?

Sorry this is a little stirred together, but hoping I can get some
hints to allow me to work it into shape.

Thanks,
Che

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] lines not shown within transparent marker?

2010-11-26 Thread C M
This is not important at all and unlikely to be supported, but just
out of curiosity:

Is it possible to set matplotlib such that, when using the 'o-' marker
style (marker
connected by lines) and partially transparent markers, the lines are not shown
within the transparent  marker?  That is, the lines would stop at the boundary
of the marker and pick up again at the other side.  This would produce a better
aesthetic effect, I think, than the lines being seen coursing through the marker
when the markers are transparent.

Thanks,
Che

--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] date plot with two y axes...and some other things

2010-11-26 Thread C M
On Thu, Nov 18, 2010 at 12:59 PM, C M  wrote:
> Goals:  date plot with two y axes (plotting completely different things)
>            point picking and point labeling
>            As many lines as user wants, all colored differently.
>
> Having some problems with this.  (matplotlib 0.98.5)
>
> 1) There is a known bug with twinx() and plot_date:
>
> http://sourceforge.net/tracker/index.php?func=detail&aid=3046812&group_id=80706&atid=560720
>
> But I can get it to work if I change ONE OF the plot_date() calls (the
> one for the values plotted to the right-hand y axis) to just plot().
>
> Is that going to introduce problems?  Is there a better workaround?
> (The ones on that page don't work for me).


So far, so good with this.  But for others working on it, I have found
that the *order* of plotting matters.

That is, I have two axes and I have to use plot() for one axis and
plot_date() for the other, but it must be plot() that is used first or
else I will get the error:  ValueError: ordinal must be >= 1.

I'm managing my lines and grouping them by axes, and then making sure
I plot all the lines on the axis that uses plot() first.  Seems to
work fine after that.

> 3) My point picking is not working with the two axes.  In my routine,
> I label  the picked point and to do that I have to make reference to
> its axis and call plot_date().  How can I know which axis the picked
> point came from, so that I can label it appropriately?

I should have just thought about that more.  Of course, there is the
method myline.get_axes() for that.

Che

--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


  1   2   >