[Matplotlib-users] access to my underlying data from picker of pick_handler

2012-03-12 Thread gsal

I am trying to change the underlying data for my plot via a pick event,
except that the matplotlib examples for picking show a couple of functions
with predefined signatures and I can't seem to figure out how to modify my
data from within those functions...how to do it? 

Here is a minimal example of what I am trying to do:

[code]
import matplotlib.pyplot as plt

def pick_rlines(art,mouseevent):
   button = mouseevent.button
   key = mouseevent.key
   
   wsf.nnn = 4  # <-- how to modify wsf.nnn from here?
   print "wsf.nnn = ", wsf.nnn
   props = dict(nnn=wsf.nnn)
   return True, props 
   
def pick_handler(event):
   mouseevent = event.mouseevent
   button = mouseevent.button
   key = mouseevent.key
   art = event.artist
  
   wsf.nnn = event.nnn  # <-- or from here ?
  
class AAA():
   pass

class BBB(): 
   def __init__(self):
  pass
  
   wsf=AAA()# when it is defined here?
   wsf.nnn=0
   GR = [1.0, 2.0, 3.0, 4.0]

   fig = plt.figure()
   ax = fig.add_axes([0.1,0.1,0.75,0.75])
   ax.set_aspect(1) 
   rlines = ax.hlines(GR,0.0,4.0,picker=pick_rlines)   
   fig.canvas.mpl_connect('pick_event', pick_handler)
   plt.show()

if __name__ == '__main__':
   the = BBB()
   
[/code]

thanks in advance for any pointers.
-- 
View this message in context: 
http://old.nabble.com/access-to-my-underlying-data-from-picker-of-pick_handler-tp33492013p33492013.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] where is line after remove?

2012-03-12 Thread Federico Ariza
Hi

Working on my little experiment (backend with edition capabilities
https://github.com/fariza/MPL-Experimental-Backend)

I want to turn visibility on and off for lines.
I can not use the visible property, using it the autolimits "relim" keeps
considering the lines as being there.
As consequence the limits are wrong (if we think only on the visible lines).

So I resorted to remove the line from its axes by line.remove()

The question is:
If I do not want to use another variable to keep track of this line, how
can I find it again from the figure instance (or somewhere else)?
get_children gets me nowhere or maybe?

#
import matplotlib.pylab as plt

fig = plt.figure()
ax = fig.add_subplot(111)
line = ax.plot(range(100))

print line[0] in ax.lines
line[0].remove()
print line[0] in ax.lines
plt.show()
#


Thanks
Federico


-- 
Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?

-- Antonio Alducin --
--
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] open ascii grid data and plot

2012-03-12 Thread questions anon
Thanks for responding. I do think the error is with how I prepare the data
(importing as a numpy array) because I have used matplotlib a million time
with no problems.
Maybe I should be taking this question elsewhere about importing the data
but thought I would add some more info.
The data in the txt file looks like this when I open it in notepad:
ncols 886
nrows 691
xllcorner 111.975
yllcorner -44.525
cellsize  0.05
NODATA_value  -
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0

and some of the info I received with it:
General Category:Gridded daily data
Geographic Bounding Box
See Below
North Bounding Latitude
-9.975
South Bounding Latitude
-44.525
East Bounding Longitude
156.275
West Bounding Longitude
111.975
Stored Data Format
Arc/Info grids–all Australia
Available Format Type
ASCII row major

I am currently using:
f=N.genfromtxt(inputfile, skip_header=6,  dtype=float, names=True)
with the output looking like:

[ (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.

Is this how the data should look when it has been imported from an ascii to
a numpy array?

thanks


On Fri, Mar 9, 2012 at 5:27 PM, Benjamin Root  wrote:

>
>
> On Wednesday, March 7, 2012, questions anon 
> wrote:
> > Hi all,
> > I am still having a problem with the same code. I am not sure if maybe
> the problem is how I read the data in as numpy.genfromtxt
> > Is there a step I need to take to convert the data to numpy array to
> then read into matplotlib?
>
> Sorry for the delay.
>
> As far as I can tell, you are doing everything correctly.  The error you
> are getting would seem to indicate something wrong with your EPD install,
> or perhaps a conflict with another install on numpy or mpl.
>
> I would suggest completely clearing out your python and EPD install and
> reinstalling it fresh.
>
> Ben Root
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] python nltk plots are not showing up

2012-03-12 Thread Eric Firing
On 03/12/2012 10:57 AM, Gias Uddin wrote:
> If I understand, this should have given me "TkAgg".
> so, the backend is not working properly.

No, the backend is fine, it is just the wrong one. Most likely, when you 
built mpl, the libraries for the gui backends were not found.

Try:

sudo apt-get build-dep python-matplotlib

and then try building and installing mpl again.

Eric

>
> On Mon, Mar 12, 2012 at 4:49 PM, Gias Uddin  > wrote:
>
>  >>> plt.get_backend()
> 'agg'
>
>
>
> On Mon, Mar 12, 2012 at 4:00 PM, Goyo  > wrote:
>
> El día 12 de marzo de 2012 17:05, Gias Uddin  > escribió:
>  > I have posted the following message in StackOverflow about my
> problem with
>  > graph plotting using python nltk using Matplotlib and numpy.
>  > Advices will be tremendously helpful. Thanks in advance.
>  >
>  >
> 
> http://stackoverflow.com/questions/9661909/python-nltk-plots-are-not-showing-up
>
> This usually happens when you're using a non interactive backend.
> What's the output of plt.get_backend()?
>
> Goyo
>
>
>
>
>
> --
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users



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


Re: [Matplotlib-users] Segmentation fault in Pyqt

2012-03-12 Thread Sourabh Bajaj
It is a problem with the dialog, if you set the option DontUseNativeDialog.
then it works fine.
I guess that the problem is with Ubuntu 11.10.


On Mon, Mar 12, 2012 at 5:37 PM, Ray Osborn  wrote:

> I think that QtGui.QFileDialog.getSaveFileName returns a tuple, the first
> element of which is the file name. You can ignore the second element by
> using:
>
> fname, _ = QtGui.QFileDialog.getSaveFileName(self, 'Save file',
> '/home/untitled.png', 'Images (*.png *.xpm *.jpg)')
>
> Ray
>
> On Mar 12, 2012, at 4:24 PM, Darren Dale wrote:
>
> > On Mon, Mar 12, 2012 at 4:30 PM, Sourabh Bajaj  wrote:
> >> I am getting a segmentation fault when I try to declare a new image
> name. I
> >> can replace a existing image correctly. Why am I getting the error at
> the
> >> getSaveFileName dialog ??
> > [...]
> >> fname = QtGui.QFileDialog.getSaveFileName(self, 'Save file',
> >> '/home/untitled.png', 'Images (*.png *.xpm *.jpg)')
> >
> > Here is the call signature:
> >
> > QString getSaveFileName (QWidget parent = None, QString caption =
> > QString(), QString directory = QString(), QString filter = QString(),
> > Options options = 0)
> >
> > You are passing a file name to a function argument that is expecting a
> > directory. Maybe that has something to do with it. Although, I don't
> > know why that would cause a crash, unless there is a bug in Qt/PyQt.
> >
> > Darren
> >
> >
> --
> > 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
>
> --
> Ray Osborn
> Materials Science Division
> Argonne National Laboratory
> Argonne, IL 60439, USA
> Phone: +1 (630) 252-9011
> Email: rosb...@anl.gov
>
>
>
>
--
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] Segmentation fault in Pyqt

2012-03-12 Thread Ray Osborn
I think that QtGui.QFileDialog.getSaveFileName returns a tuple, the first 
element of which is the file name. You can ignore the second element by using:

fname, _ = QtGui.QFileDialog.getSaveFileName(self, 'Save file', 
'/home/untitled.png', 'Images (*.png *.xpm *.jpg)')

Ray

On Mar 12, 2012, at 4:24 PM, Darren Dale wrote:

> On Mon, Mar 12, 2012 at 4:30 PM, Sourabh Bajaj  wrote:
>> I am getting a segmentation fault when I try to declare a new image name. I
>> can replace a existing image correctly. Why am I getting the error at the
>> getSaveFileName dialog ??
> [...]
>> fname = QtGui.QFileDialog.getSaveFileName(self, 'Save file',
>> '/home/untitled.png', 'Images (*.png *.xpm *.jpg)')
> 
> Here is the call signature:
> 
> QString getSaveFileName (QWidget parent = None, QString caption =
> QString(), QString directory = QString(), QString filter = QString(),
> Options options = 0)
> 
> You are passing a file name to a function argument that is expecting a
> directory. Maybe that has something to do with it. Although, I don't
> know why that would cause a crash, unless there is a bug in Qt/PyQt.
> 
> Darren
> 
> --
> 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

-- 
Ray Osborn
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: rosb...@anl.gov




--
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] Segmentation fault in Pyqt

2012-03-12 Thread Darren Dale
On Mon, Mar 12, 2012 at 4:30 PM, Sourabh Bajaj  wrote:
> I am getting a segmentation fault when I try to declare a new image name. I
> can replace a existing image correctly. Why am I getting the error at the
> getSaveFileName dialog ??
[...]
> fname = QtGui.QFileDialog.getSaveFileName(self, 'Save file',
> '/home/untitled.png', 'Images (*.png *.xpm *.jpg)')

Here is the call signature:

QString getSaveFileName (QWidget parent = None, QString caption =
QString(), QString directory = QString(), QString filter = QString(),
Options options = 0)

You are passing a file name to a function argument that is expecting a
directory. Maybe that has something to do with it. Although, I don't
know why that would cause a crash, unless there is a bug in Qt/PyQt.

Darren

--
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] python nltk plots are not showing up

2012-03-12 Thread Gias Uddin
If I understand, this should have given me "TkAgg".
so, the backend is not working properly.

On Mon, Mar 12, 2012 at 4:49 PM, Gias Uddin  wrote:

> >>> plt.get_backend()
> 'agg'
>
>
>
> On Mon, Mar 12, 2012 at 4:00 PM, Goyo  wrote:
>
>> El día 12 de marzo de 2012 17:05, Gias Uddin  escribió:
>> > I have posted the following message in StackOverflow about my problem
>> with
>> > graph plotting using python nltk using Matplotlib and numpy.
>> > Advices will be tremendously helpful. Thanks in advance.
>> >
>> >
>> http://stackoverflow.com/questions/9661909/python-nltk-plots-are-not-showing-up
>>
>> This usually happens when you're using a non interactive backend.
>> What's the output of plt.get_backend()?
>>
>> Goyo
>>
>
>
--
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] Errorbars not drawn correctly in logarithmic scales

2012-03-12 Thread Benjamin Root
On Fri, Mar 9, 2012 at 1:14 PM, Wolfgang Draxinger <
wdraxinger.maill...@draxit.de> wrote:

> On Fri, 9 Mar 2012 11:19:15 -0600
> Benjamin Root  wrote:
>
> > Can I have the data you used to produce these errorbars so I can test
> > this bug?
>
> Here's the data
>
> #  Fluence -sigma Signal...  -sigma   area
>  1127  48.32  9.114  10.31 0.1318
>  1.127e+04  482.9  35.96  16.15 0.4994
>  1.127e+05   4829  231.2  101.1  2.568
>  1.127e+06  4.829e+04   4631   1689  12.22
>
>
Ah, finally figured it out.  The issue is that your y-value for that error
bar is 9.114, but you want to plot error bars that are +/-10.31.  That line
gets thrown out by matplotlib because you can't plot at negative values for
log scale.  There is a trick that might work.  The set_yscale method has a
kwarg "nonposy" which could be set to "clip".  You could also try setting
to the "symlog" scale which might let you get away with a negative value.

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


Re: [Matplotlib-users] python nltk plots are not showing up

2012-03-12 Thread Gias Uddin
>>> plt.get_backend()
'agg'



On Mon, Mar 12, 2012 at 4:00 PM, Goyo  wrote:

> El día 12 de marzo de 2012 17:05, Gias Uddin  escribió:
> > I have posted the following message in StackOverflow about my problem
> with
> > graph plotting using python nltk using Matplotlib and numpy.
> > Advices will be tremendously helpful. Thanks in advance.
> >
> >
> http://stackoverflow.com/questions/9661909/python-nltk-plots-are-not-showing-up
>
> This usually happens when you're using a non interactive backend.
> What's the output of plt.get_backend()?
>
> Goyo
>
--
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] python nltk plots are not showing up

2012-03-12 Thread Eric Firing
On 03/12/2012 06:05 AM, Gias Uddin wrote:
> I have posted the following message in StackOverflow about my problem
> with graph plotting using python nltk using Matplotlib and numpy.
> Advices will be tremendously helpful. Thanks in advance.
>
> http://stackoverflow.com/questions/9661909/python-nltk-plots-are-not-showing-up

What is the result of:

python -c "import matplotlib; print matplotlib.get_backend()"
python -c "import matplotlib; print matplotlib.matplotlib_fname()"

And when you run setup.py build, what is the first block of output 
showing all the libraries and dependencies?

For whatever reason, it sounds like your mpl backend is not an 
interactive backend.

Eric


--
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] python nltk plots are not showing up

2012-03-12 Thread Goyo
El día 12 de marzo de 2012 17:05, Gias Uddin  escribió:
> I have posted the following message in StackOverflow about my problem with
> graph plotting using python nltk using Matplotlib and numpy.
> Advices will be tremendously helpful. Thanks in advance.
>
> http://stackoverflow.com/questions/9661909/python-nltk-plots-are-not-showing-up

This usually happens when you're using a non interactive backend.
What's the output of plt.get_backend()?

Goyo

--
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] python nltk plots are not showing up

2012-03-12 Thread Gias Uddin
I have posted the following message in StackOverflow about my problem with
graph plotting using python nltk using Matplotlib and numpy.
Advices will be tremendously helpful. Thanks in advance.

http://stackoverflow.com/questions/9661909/python-nltk-plots-are-not-showing-up
--
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] error bars showing color maps

2012-03-12 Thread Alberto Domínguez Díaz
Dear matplotlib-users,

I was wondering if it is possible to plot with matplotlib an errorbar
figure using color maps. Basically, I want to get a similar plot to
scatter(x,y,c=z,cmap=cmap) where z is an array of numbers, but with
the error bars showing the same color than their data points. Any
idea, please?

Thanks a lot,
Alberto

--
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] Arrow with a dashed line

2012-03-12 Thread Tony Yu
On Sun, Mar 11, 2012 at 2:13 PM, Tony Yu  wrote:

> Is it possible to draw an arrow with a dashed line?
>
> I tried using a fancy arrow patch and set the linestyle:
>
> #~~~
> import matplotlib.pyplot as plt
>
> fix, ax = plt.subplots()
> ax.set_xlim((-1,5))
> ax.set_ylim((-5,3))
>
> ax.annotate('simple', xy=(2., -1),  xycoords='data',
> xytext=(100, 60), textcoords='offset points',
> size=20,
> arrowprops=dict(arrowstyle="simple",
> fc="0.6", ec="none", linestyle='dashed',
> connectionstyle="arc3,rad=0.3"),
> )
> plt.show()
> #~~~
>
> But the linestyle argument just gets ignored.
>
> Is there a way to grab the connection path object and then change that to
> a dashed line? Actually, I'm not even sure it's possible to set a linestyle
> for a Path (since dashed lines are normally Line2D). Suggestions?
>
> Thanks,
> -Tony
>


Nevermind: I though arrowstyle='simple' and arrowstyle='-|>' were the same
thing, but apparently not (I guess one draws the line as a patch, and the
other as a line). So the following works as expected:

#
import matplotlib.pyplot as plt

fix, ax = plt.subplots()
ax.set_xlim((-1,5))
ax.set_ylim((-5,3))

ax.annotate('simple', xy=(2., -1),  xycoords='data',
xytext=(100, 60), textcoords='offset points',
size=20,
arrowprops=dict(arrowstyle="-|>",
fc="k", ec="k", linestyle='dashed',
connectionstyle="arc3,rad=0.3"),
)
plt.show()
#~~~
--
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] About plotting...

2012-03-12 Thread Eric Firing
On 03/11/2012 05:06 AM, aa wrote:
> How to Get symmetric plotting in pylab
> i tried this code:
> # -*- coding: utf-8 -*-
>
> """
>
> Created on Sat Mar 10 20:33:32 2012
>
> @author: fajar
>
> """
>
> from numpy import linspace, meshgrid, array
>
> import matplotlib.pyplot as pl
>
> import matplotlib.ticker as tc
>
> from scipy.integrate import odeint
>
> # membuat vektor
>
> u = linspace(-5,5,25)
>
> v = linspace(-5,5,25)
>
> U,V = meshgrid(u,v)
>
> def fu(u,v): return 2*u-2*v
>
> def fv(u,v): return 2*u-3*v
>
> FU = fu(U,V)
>
> FV = fv(U,V)
>
> # sistem Persamaan:
>
> def g(x,t):
>
> y1 = 2*x[0]-1*x[1]
>
> y2 = 1*x[0]-2*x[1]
>
> return [y1, y2]
>
> time = linspace(-1,-.6,100)
>
> con = array([[1,2],[1.5,-3],[-1.5,3],[-1.5,-3]])
>
> pl.figure()
>
> Q = pl.quiver(U,V,FU,FV, units='height', hold=True)

Try using the pivot kwarg, which tells which part of the arrow will be 
at the specified position.  The default is "tail".  You can use "middle" 
to center the arrows, or "tip" to have the arrows end at your FU, FV points.

Eric

>
> #sol = odeint(g, con[0], time)
>
> #pl.plot(sol[:,0], sol[:,1], linewidth=2.1 , color='y')
>
> #
>
> #sol = odeint(g, con[1], time)
>
> #pl.plot(sol[:,0], sol[:,1], linewidth=2.1,color='b')
>
> #
>
> #sol = odeint(g, con[2], time)
>
> #pl.plot(sol[:,0], sol[:,1], linewidth=2.1 , color='m')
>
> #
>
> #sol = odeint(g, con[3], time)
>
> #pl.plot(sol[:,0], sol[:,1], linewidth=2.1 , color='r')
>
> #
>
> pl.autoscale(enable=True,axis='Both', tight=True)
>
> #tc.AutoLocator()
>
> tc.MaxNLocator(9,symmetric=True)
>
> #pl.xlabel('u', weight='bold')
>
> #pl.ylabel('v', weight='bold')
>
> #pl.title('u\'=u dan v\'=-2v',weight='bold')
>
> #pl.autoscale()z
>
> pl.show()
>
>
> ---
> but i get picture like in this attach... (aa.png)
> what i need is to Make side of figure stright... not oblique...
> like this attach (ab.png)...
> with coresponding code:
> # -*- coding: utf-8 -*-
>
> """
>
> Created on Sat Mar 10 20:33:32 2012
>
> @author: fajar
>
> """
>
> from numpy import linspace, meshgrid, array
>
> import pylab as pl
>
> from scipy.integrate import odeint
>
> # membuat vektor
>
> u = linspace(-5,5,21)
>
> v = linspace(-5,5,21)
>
> U,V = meshgrid(u,v)
>
> def fu(u,v):return u
>
> def fv(u,v):return -2*v
>
> FU = fu(U,V)
>
> FV = fv(U,V)
>
> # sistem Persamaan:
>
> def g(x,t):
>
> y1 = x[0]
>
> y2 = -2*x[1]
>
> return [y1, y2]
>
> time = linspace(0,1,100)
>
> con = array([[1.5,3],[1.5,-3],[-1.5,3],[-1.5,-3]])
>
> pl.figure()
>
> Q = pl.quiver(U,V,FU,FV, units='height', hold=True)
>
> sol = odeint(g, con[0], time)
>
> pl.plot(sol[:,0], sol[:,1], linewidth=2.1 , color='y')
>
> sol = odeint(g, con[1], time)
>
> pl.plot(sol[:,0], sol[:,1], linewidth=2.1,color='b')
>
> sol = odeint(g, con[2], time)
>
> pl.plot(sol[:,0], sol[:,1], linewidth=2.1 , color='m')
>
> sol = odeint(g, con[3], time)
>
> pl.plot(sol[:,0], sol[:,1], linewidth=2.1 , color='r')
>
> pl.autoscale(enable=True,axis='Both', tight =True)
>
> pl.xlabel('u', weight='bold')
>
> pl.ylabel('v', weight='bold')
>
> pl.title('u\'=u dan v\'=-2v',weight='bold')
>
> pl.show()
> --
> i'm sorry, i didn't well to speak english, but i guess you know what
> mean... thanks before :)
>
>
>
>
>
> --
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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


Re: [Matplotlib-users] PyQt4 FigureCanvasQTAgg Subclass segfaults with Matplotlib 1.1?

2012-03-12 Thread Darren Dale
Have you tried running with older checkouts on the master branch to
see when the problem was introduced? You can do something like:

git log --oneline --graph lib/matplotlib/backends/backend_qt4.py # or
backend_qt4agg.py

to see what commits were applied to master but not v1.0.x. Try
bisecting the commit history to find the commit that introduced the
problem (which you might want to describe in a little more detail.)

Darren

On Mon, Mar 12, 2012 at 10:13 AM, Keith Hughitt  wrote:
> *bump*
>
> Anyone else encountering this problem?
>
>
> On Tue, Mar 6, 2012 at 4:06 PM, Keith Hughitt 
> wrote:
>>
>> Hey all,
>>
>> Anyone know what has changed from Maplotlib 1.0.x to 1.1.x that might
>> cause a PyQt4 application to segfault?
>>
>> Here is the code I'm working
>> on: https://github.com/sunpy/sunpy/blob/master/doc/examples/rgb_composite/rgb_composite.py
>>
>> It works fine with earlier versions of Matplotlib (0.99 and 1.0.x) but
>> when I try and run the demo with Matplotlib 1.1 I get a segfault.
>>
>> Any ideas?
>>
>> Thanks,
>> Keith
>>
>
>
> --
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

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


Re: [Matplotlib-users] PyQt4 FigureCanvasQTAgg Subclass segfaults with Matplotlib 1.1?

2012-03-12 Thread Keith Hughitt
*bump*

Anyone else encountering this problem?

On Tue, Mar 6, 2012 at 4:06 PM, Keith Hughitt wrote:

> Hey all,
>
> Anyone know what has changed from Maplotlib 1.0.x to 1.1.x that might
> cause a PyQt4 application to segfault?
>
> Here is the code I'm working on:
> https://github.com/sunpy/sunpy/blob/master/doc/examples/rgb_composite/rgb_composite.py
>
> It works fine with earlier versions of Matplotlib (0.99 and 1.0.x) but
> when I try and run the demo with Matplotlib 1.1 I get a segfault.
>
> Any ideas?
>
> Thanks,
> Keith
>
>
--
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] resize a plot to make room

2012-03-12 Thread John Hunter
On Mon, Mar 12, 2012 at 8:04 AM, Neal Becker  wrote:

> I have a figure with a semilogy plot.  I need to make more room on the
> bottom to
> add a bunch of figtext, which is 4 lines of text.
>
> With the defaults, the text overprints the x-axis.
>
> What is a suggested way to fix this?  (Ideally, mpl would calculate the
> appropriate sizes for me so things don't overprint).
>
>
Set fig.tight_layout to automatically make room.  Note there is a bug in
the latest released matplotlib in which tight layout doesn't include all
text objects, but this is fixed in git v1.1.x branch and will be included
in the next release.

You can also use the "subplots_adjust" functionality to increase the
default spacing between your axes


http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.subplots_adjust

eg,

  fig.subplots_adjust(left=0.3, wspace=0.2)

JDH
--
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] resize a plot to make room

2012-03-12 Thread Neal Becker
I have a figure with a semilogy plot.  I need to make more room on the bottom 
to 
add a bunch of figtext, which is 4 lines of text.

With the defaults, the text overprints the x-axis.

What is a suggested way to fix this?  (Ideally, mpl would calculate the 
appropriate sizes for me so things don't overprint).


--
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] pdf file output name too restrictive?

2012-03-12 Thread Daniele Nicolodi
On 12/03/12 13:40, Neal Becker wrote:
> Using this code:
> 
> self.pdf = PdfPages('%s.%s.pdf' % (name, str(date.today(
> 
> Trying to output a pdf with the name 
> 
> "results.abs_aci=[10.0, nan, 10.0].rate=['2/3', '4/5', '2/3'].2012-03-12.pdf"
> 
> produces this error
> 
> IOError: [Errno 2] No such file or directory: "results.abs_aci=[10.0, nan, 
> 10.0].rate=['2/3', '4/5', '2/3'].2012-03-12.pdf"
> 
> Changing the file name to just 'test1.pdf' produces no error.

On Unix platforms the / character is invalid in file names, being the
path separator, along with the \0 character, for obvious reasons.

On Windows the allowed set of valid characters is further reduced,
depending on the filesystem.

Cheers,
-- 
Daniele

--
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] Scrolling window

2012-03-12 Thread stetogias

Not sure if this is the right place to post this...please instruct if wrong

I'm plotting some audio data, which can get big, and alongside I have
subplots of barcharts that represent onsets, RMS etc...
Since I have many onsets plotting the whole thing at once results in such
dense barcharts that the 
graph is useless.

So currently I am plotting 5 seconds of audio with the respective barcharts
and use forward/backward buttons to skim through the data. Show next 5
seconds etc. The whole thing is embedded in PyQt.

It works but I just learned about the ScrollArea widget so I thought why not
plot the whole thing and just use scroll to move around the plot.

My main question is which is the common practice for doing this sort of
thing?
I know the data beforehand so I don't need dynamic updating. Seems scrolling
should be the easiest way to do this but I haven't found example and my code
doesn't work yet.

Thanks
Stelios
-- 
View this message in context: 
http://old.nabble.com/Scrolling-window-tp33477938p33477938.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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] pdf file output name too restrictive?

2012-03-12 Thread Neal Becker
Using this code:

self.pdf = PdfPages('%s.%s.pdf' % (name, str(date.today(

Trying to output a pdf with the name 

"results.abs_aci=[10.0, nan, 10.0].rate=['2/3', '4/5', '2/3'].2012-03-12.pdf"

produces this error

IOError: [Errno 2] No such file or directory: "results.abs_aci=[10.0, nan, 
10.0].rate=['2/3', '4/5', '2/3'].2012-03-12.pdf"

Changing the file name to just 'test1.pdf' produces no error.


--
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] histogram and a line

2012-03-12 Thread Jerzy Karczmarczuk

Mic :
Thank you for your solutions. However, with my dataset it did not work 
out with the following code:



...

Please find attached the histogram. The dataset I am sending with
next email.

1. You haven'sent *in.small.txt*, but *in.txt*, 70 MB, several millions 
lines. Please, be gentle wrt people who want to help you and are obliged 
to test your stuff.


2. You file is buggy, last two lines generate an exception. They contain 
a text "mean ...".


3. I corrected them, the program works, and gives the picture you 
attached. You don't say WHAT is "not working". Is it the question of 
scaling, or something else?


4 If it is scaling, and IF IF ... you want to obtain something I attach, 
then use the code:


   *hst=axes.hist(data, bins=50, normed=True)
   mxh=max(hst[0])
   plt.plot([mean,mean],[0,mxh],'r',lw=2)
   *

5. Learn something about WHAT is a normed histogram in matplotlib, how 
to get into the plotted data, and to adjust the scales. Otherwise such 
problems will repeat.


6. Finally, in our civilized world people sign their messages. Anonymous 
letters are ugly.



Jerzy Karczmarczuk

--
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] Runtime error with matplotlib in IDLE

2012-03-12 Thread Catherine Thwaites
On Sun, Mar 11, 2012 at 11:27 PM, gsal  wrote:

>
> Don't have a solution; I was just wondering if you have tried something
> else,
> like using ipython instead of IDLE.  ipython may be better suited for
> threading and working with pylab, etc.
>
>
Thanks for the reply. I do like ipython might try the gui version.
--
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