Re: [Matplotlib-users] wxagg and cups printer

2009-08-04 Thread Janwillem

Sorry, had not yet noticed the option for more verbosity in matplotlibrc. The
problem seems to be that some component related to wxagg wants to create the
symbol "printer" which, because my printer was called "printer", apparently
already existed. Renaming the printer on my system solved the problem. The
same applies to PDF. If you install cupspdf the problem also appears and
after renaming it to e.g. CUPS_PDF disappears.
Cheers, Janwillem



Janwillem wrote:
> 
> Inspired by examples like
> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
> I added matplotlib.use('WXAgg') to my (wxPython) script in order to
> directly copy the matplotlib.backends.backend_wxagg.FigureCanvasWxAgg to a
> wx canvas.
> On my ubuntu 9.04 AMD64 PC it works fine, on my WindowsXP laptop it works
> as expected but on my Asus EEE 901 ubuntu 9.04 I get:
> GnomePrintCupsPlugin-Message: The ppd file for the CUPS printer printer
> could not be loaded.
> (the name of my network attached printer is "printer") The plot is shown
> correctly and the script does not seem to be affected. The message only
> appears once after the first plot (see my post aug 2nd).
> Versions of python (2.6.2), wx (2.8.9.1) and matplotlib (0.98.5.2) are the
> same on both ubuntu systems and I can't find a difference in cups
> installation. There are no errors reported in cups logs. The script does
> not need a printer. 
> 
> Any idea where I can look for a solution?
> 
> 

-- 
View this message in context: 
http://www.nabble.com/wxagg-and-cups-printeer-tp24797768p24803702.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread Johann Rohwer
Using the latest SVN matplotlib, the TkAgg backed does not get built 
even though all the libraries are installed (Linux 64-bit). The 
following error message occurs during the build:

Tkinter: no
 * Using default library and include directories for
 * Tcl and Tk because a Tk window failed to open.
 * You may need to define DISPLAY for Tk to work so
 * that setup can determine where your libraries are
 * located. Tkinter present, but header files are not
 * found. You may need to install development
 * packages.

This is even though lib64tk-devel and lib64tcl-devel are installed. 
Strangely enough, when I remove lib64tcl-devel, the script proceeds 
and picks up Tk, but it still can't determine the location of the 
libraries (complains about not finding tkConfig.sh) - the build proceeds 
but later fails because tcl.h is not found.

With both the tcl and tk headers installed, the only way actually to 
build the TkAgg backend is to force it by
[gui_support]
tkagg = True
in setup.cfg. I still get the Tkinter error message given above, but 
the backend builds successfully and I seem to be able to use it 
without errors. 

[...@blikbrein ~]$ locate tkConfig.sh
/usr/lib/tkConfig.sh
/usr/lib64/tkConfig.sh
/usr/lib64/tk8.6/tkConfig.sh
[...@blikbrein ~]$ locate tclConfig.sh
/usr/lib/tclConfig.sh
/usr/lib64/tclConfig.sh
/usr/lib64/tcl8.6/tclConfig.sh

System Info:

BUILDING MATPLOTLIB
matplotlib: 0.99.0.rc1
python: 2.6.1 (r261:67515, Apr 12 2009, 04:14:16)  
[GCC
4.3.2]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.3.0
 freetype2: 9.20.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.35
   Tkinter: no
* Using default library and include 
directories for
* Tcl and Tk because a Tk window failed to 
open.
* You may need to define DISPLAY for Tk to work 
so
* that setup can determine where your 
libraries are
* located. Tkinter present, but header files 
are not
* found. You may need to install development
* packages.
  wxPython: 2.8.9.2
* WxAgg extension not required for wxPython >= 
2.8
  Gtk+: gtk+: 2.16.1, glib: 2.20.1, pygtk: 2.14.1,
pygobject: 2.16.1
   Mac OS X native: no
Qt: no
   Qt4: Qt: 4.5.0, PyQt4: 4.4.4
 Cairo: 1.8.2

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  datetime: present, version unknown
  dateutil: 1.4.1
  pytz: 2008i

OPTIONAL USETEX DEPENDENCIES
dvipng: 1.9
   ghostscript: 8.64
 latex: 3.141592
   pdftops: 0.10.6


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Resolution of eps files

2009-08-04 Thread Maxim Khazimullin
Hi,

I have a very simple script::

x = linspace(0,1)
plot(x, sin(pi*x))

savefig("test-300.eps", dpi = 300)
savefig("test-600.eps", dpi = 600)

output of ll *.eps:

-rw--- 1 maxim maxim  10759 2009-08-03 20:27 test-300.eps
-rw--- 1 maxim maxim  10759 2009-08-03 20:27 test-600.eps

Is it normal for eps files (when files with different dpi have the same
sizes), or something wrong with matplotlib?

Best regards,
Maxim
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Resolution of eps files

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 4:22 AM, Maxim Khazimullin wrote:

> Is it normal for eps files (when files with different dpi have the same
> sizes), or something wrong with matplotlib?


PS is a vector drawing backend, so the concept of "dots per inch" does
not apply, unless you are explictly including a raster image int he
output.  So it is a feature, not a bug :-).  More detail on raster vs
vector backends here:

  http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting user defined color map as default

2009-08-04 Thread Philipp Lies
On Thu, 30 Jul 2009 09:41:43 -1000
Eric Firing  wrote:
> Jae-Joon Lee wrote:
> > I don't think there is any user-visible support for registering a
> > custom colormap.
> 
> Now there is: svn r7309.  Its use is illustrated via a modification of 
> examples/pylab_examples/custom_cmap.py.
Awesome, works just as I need it! Keep up the good work! 
Now I'm one step closer to abandoning matlab :-D

Philipp



> 
> With just a little more work, we could make it so that anything taking a 
> "cmap" kwarg will accept either a Colormap instance or the name of a 
> registered instance (including builtins).  Maybe I will do that later today.
> 
> Eric
> 
> 
> > However, it seems to me that adding the colormap to
> > matplotlib.cm.datad distionary is enough.
> > Note that the value need to be a dictionary of RGB specification, not
> > the actual colormap instance.
> > 
> > for example,
> > 
> > mycolormap = {'blue': ((0.0, 0.40002, 0.40002),
> >   (1.0, 0.40002, 0.40002)),
> >  'green': ((0.0, 0.5, 0.5), (1.0, 1.0, 1.0)),
> >  'red': ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))}
> > 
> > matplotlib.cm.datad["mycolormap"] = mycolormap
> > rcParams["image.cmap"]="mycolormap"
> > 
> > Having a function (like jet in pylab) would not be also difficult.
> > Take a look at the definition of "jet" function (for example) in the
> > pylab.py.
> > 
> > We may be better to have a proper way to register a custom colormap.
> > I'll try to take a more look later, but any patch will be appreciated.
> > 
> > Regards,
> > 
> > -JJ
> > 
> > 
> > 
> > On Thu, Jul 30, 2009 at 3:48 AM, Philipp
> > Lies wrote:
> >> Does no one have an idea? If not, this is a severe usability bug!
> >>
> >> Philipp Lies wrote:
> >>> Hi,
> >>>
> >>> I just created a hsv-like color map with gray levels only, now I'd like to
> >>> use this as default color map. But how? Calling it like hsv() does not
> >>> work and I did not find a hint in the documentation how to set a user
> >>> defined color map interactively as default color map.
> >>>
> >>> Cheers
> >>>
> >>> Philipp
> >>>
> >> --
> >> View this message in context: 
> >> http://www.nabble.com/setting-user-defined-color-map-as-default-tp24587528p24733739.html
> >> Sent from the matplotlib - users mailing list archive at Nabble.com.
> >>
> >>
> >> --
> >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> >> trial. Simplify your report design, integration and deployment - and focus 
> >> on
> >> what you do best, core application coding. Discover what's new with
> >> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> >> ___
> >> Matplotlib-users mailing list
> >> Matplotlib-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>
> > 
> > --
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> > trial. Simplify your report design, integration and deployment - and focus 
> > on 
> > what you do best, core application coding. Discover what's new with 
> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 


-- 
Philipp Lies

Max Planck Institute for Biological Cybernetics
Computational Vision & Neuroscience Group
Spemannstr. 41
D-72076 Tuebingen 
Germany

Phone:  +49-7071-601-1788
Fax:+49-7071-601-552
E-Mail: philipp.l...@tuebingen.mpg.de
http://www.kyb.mpg.de/bethgegroup

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Some questions about text

2009-08-04 Thread Pim Schellart
Hi Everyone,

I have been using matplotlib for quite some time now.
However I have a few questions regarding the handling of text in title
and axis labels.
When creating an image using subplot the title and axis label text
tends to overlap.
Is there an option to prevent this.
Of course one can do this manually but this requires inspection of the
image and adjustment.
It would be very helpful if this is done automatically (even better
when it would be the default option).
Furthermore the x-, y-axis ticks are automatically displayed with some
part stripped which is displayed separately as a number to be added.
I would really like to have the following options.
1. option to force display of the full number on each tick (with the
option to display the numbers at an angle to prevent overlapping).
2. option to specify the number to be subtracted manually (to make it
a round number).
3. option to specify the precision or scientific notation of both the
ticks and the number to be added.
Is this currently possible?
And if not would you be willing to add these options?
In my humble opinion the first option should at least be part of the
pyplot commands as it is needed often by me and my colleagues.

Kind regards,

Pim Schellart

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 3:52 AM, Johann Rohwer wrote:
> Using the latest SVN matplotlib, the TkAgg backed does not get built
> even though all the libraries are installed (Linux 64-bit). The
> following error message occurs during the build:
>
> Tkinter: no
>         * Using default library and include directories for
>         * Tcl and Tk because a Tk window failed to open.
>         * You may need to define DISPLAY for Tk to work so
>         * that setup can determine where your libraries are
>         * located. Tkinter present, but header files are not
>         * found. You may need to install development
>         * packages.


The message suggests you may not have access to the windowing system,
and the build process needs it to import tk.  Are you building on a
remote box, or as root who may not have access to your user desktop?
If so, you can solve these problems by ssh with -X or otherwise make
sure that you can launch an X window in your build environment.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 3:52 AM, Johann Rohwer wrote:
> Using the latest SVN matplotlib, the TkAgg backed does not get built
> even though all the libraries are installed (Linux 64-bit). The
> following error message occurs during the build:
>
> Tkinter: no
>         * Using default library and include directories for
>         * Tcl and Tk because a Tk window failed to open.
>         * You may need to define DISPLAY for Tk to work so
>         * that setup can determine where your libraries are
>         * located. Tkinter present, but header files are not
>         * found. You may need to install development
>         * packages.


The message suggests you may not have access to the windowing system,
and the build process needs it to import tk.  Are you building on a
remote box, or as root who may not have access to your user desktop?
If so, you can solve these problems by ssh with -X or otherwise make
sure that you can launch an X window in your build environment.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Some questions about text

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 8:16 AM, Pim
Schellart wrote:

> 1. option to force display of the full number on each tick (with the
> option to display the numbers at an angle to prevent overlapping).

This is controlled by the "set_scientific" method of the ScalarFormatter

  
http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.ScalarFormatter

For example::

In [101]: ax = gca()

In [102]: ax.plot(np.arange(10)*2e20)
Out[102]: []

In [103]: draw()

In [104]: formatter = ax.yaxis.get_major_formatter()

In [105]: formatter.set_scientific(False)

In [106]: draw()

> 2. option to specify the number to be subtracted manually (to make it
> a round number).

I don't think there is support for this, but it would be a nice feature::

  http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto

> 3. option to specify the precision or scientific notation of both the
> ticks and the number to be added.

You can control at what level the fallover to scientific notation
occurs with the set_power_limits method of the formatter::

  
http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.ScalarFormatter.set_powerlimits

This is also exposed as an rc param::

   axes.formatter.limits : -7, 7 # use scientific notation if log10
  # of the axis range is
smaller than the
  # first or larger than the second

See http://matplotlib.sourceforge.net/users/customizing.html

Hope this helps!
JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread Johann Rohwer
On Tuesday 04 August 2009, John Hunter wrote:
> On Tue, Aug 4, 2009 at 3:52 AM, Johann Rohwer wrote:
> > Using the latest SVN matplotlib, the TkAgg backed does not get
> > built even though all the libraries are installed (Linux 64-bit).
> > The following error message occurs during the build:
> >
> > Tkinter: no
> > * Using default library and include directories for
> > * Tcl and Tk because a Tk window failed to open.
> > * You may need to define DISPLAY for Tk to work so
> > * that setup can determine where your libraries are
> > * located. Tkinter present, but header files are not
> > * found. You may need to install development
> > * packages.
>
> The message suggests you may not have access to the windowing
> system, and the build process needs it to import tk.  Are you
> building on a remote box, or as root who may not have access to
> your user desktop? 

No, I'm building as a normal user on the local machine.

[...@blikbrein ~]$ echo $DISPLAY
:0.0

Furthermore I can create Tk objects:
[...@blikbrein ~]$ python
Python 2.6.1 (r261:67515, Apr 12 2009, 04:14:16)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> a=Tkinter.tkinter.create()

which creates a tk window on my desktop.

So really in the dark what's going on here
Johann


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 9:14 AM, Johann Rohwer wrote:

> Type "help", "copyright", "credits" or "license" for more information.
 import Tkinter
 a=Tkinter.tkinter.create()
>
> which creates a tk window on my desktop.
>
> So really in the dark what's going on here

Very odd.  I suggest opening up setupext.py and finding the function
"check_for_tk".  There are a series of test which ultimately set the
"gotit" variable to determine whether you have tk for building.
Insert a lot of debug print statements throughout the logic of that
function and find out where it is failing and let us know.

My guess is you will fail in  the "explanation = add_tk_flags(module)"
part of the code, so you may need to dive into there and repeat the
exercise to figure out what is failing and why.  If you can repeat the
steps that the build process is attempting in your python shell, you
may be able to hone into the point of failure

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread Michael Droettboom
What distro are you on?  It seems that Tcl/Tk moves the header files 
around on a regular basis while not providing a standard way to 
determine their location.  It's like a wild goose chase ;)  Perhaps 
you're running something new and blazing new territory here ;)

Mike

John Hunter wrote:
> On Tue, Aug 4, 2009 at 9:14 AM, Johann Rohwer wrote:
>
>   
>> Type "help", "copyright", "credits" or "license" for more information.
>> 
> import Tkinter
> a=Tkinter.tkinter.create()
>   
>> which creates a tk window on my desktop.
>>
>> So really in the dark what's going on here
>> 
>
> Very odd.  I suggest opening up setupext.py and finding the function
> "check_for_tk".  There are a series of test which ultimately set the
> "gotit" variable to determine whether you have tk for building.
> Insert a lot of debug print statements throughout the logic of that
> function and find out where it is failing and let us know.
>
> My guess is you will fail in  the "explanation = add_tk_flags(module)"
> part of the code, so you may need to dive into there and repeat the
> exercise to figure out what is failing and why.  If you can repeat the
> steps that the build process is attempting in your python shell, you
> may be able to hone into the point of failure
>
> JDH
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Change Font Properties of Annotations

2009-08-04 Thread Michael Droettboom
Can you add the following to the top of your script:

import matplotlib
matplotlib.rcParams['verbose.level'] = 'debug-annoying'

and send the output here?

Most likely the font matching is failing on some other property (e.g. 
Tahoma) and reverting to the default font, which is non-bold.  I don't 
have the Microsoft fonts installed here, so I can't test whether there's 
something in particular about them that is causing this failure.

Cheers,
Mike

Gewton Jhames wrote:
> I'm having problems to simply set 'bold' the font weight of some 
> annotations. Tryin'this:
> fig = plt.figure(frameon=False)
> ax = plt.gca()
>
> font = matplotlib.font_manager.FontProperties(family='Tahoma', 
> weight='extra bold', size=12)
>
> annotation_total = ax.annotate('Total:', xy=(0, -320), xycoords='axes 
> points', horizontalalignment='left', verticalalignment='top',
> fontproperties=font)
> The Family and Size work perfectly, only weight is ignored.
> 
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> 
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build problems with TkAgg backend

2009-08-04 Thread Johann Rohwer
Michael Droettboom wrote:
> What distro are you on?  It seems that Tcl/Tk moves the header files 
> around on a regular basis while not providing a standard way to 
> determine their location.  It's like a wild goose chase ;)  Perhaps 
> you're running something new and blazing new territory here ;)

Mandriva 2009.1 (64-bit)

Although the header files seem to me to be in pretty standard locations:
[...@blikbrein ~]$ locate tcl.h
/usr/include/tcl.h
/usr/include/tcl8.6/generic/tcl.h
[...@blikbrein ~]$ ll /usr/include/tcl.h
-rw-r--r-- 1 root root 89652 2008-12-24 02:29 /usr/include/tcl.h
[...@blikbrein ~]$ ll /usr/include/tcl8.6/generic/tcl.h
-rw-r--r-- 1 root root 89652 2008-12-24 02:29 /usr/include/tcl8.6/generic/tcl.h
[...@blikbrein ~]$ diff /usr/include/tcl.h /usr/include/tcl8.6/generic/tcl.h
[...@blikbrein ~]


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread Josh Hemann

For this particular data set you might try simply using a log-scaled Y-axis.
As to the larger question of interactively adding/removing plot elements,
take a look at Enthought's Chaco toolkit. I think most people would agree
that its plotting features are not as rich as mpl, but with respect to
customizing interaction with graphical elements, it seems like the best path
out there. See
http://code.enthought.com/projects/chaco/docs/html/user_manual/faq.html

Josh



Gökhan SEVER-2 wrote:
> 
> Hello,
> 
> I was wondering if it is possible to hide some data on figures using a say
> right click option to any of the legend entry and make it temporarily
> hidden/visible to better analyse the rest of the data?
> 
> Check this screenshot for example:
> 
> http://img25.imageshack.us/img25/9427/datahiding.png
> 
> The red data clutters the rest of the figure, and I would like to be able
> to
> hide it temporarily so that I can investigate the other two relations more
> easily.
> 
> Any ideas? or alternative solutions?
> 
> Thanks.
> 
> -- 
> Gökhan
> 


-
Josh Hemann
Statistical Advisor 
http://www.vni.com/ Visual Numerics 
jhem...@vni.com | P 720.407.4214 | F 720.407.4199 

-- 
View this message in context: 
http://www.nabble.com/Hiding-data-via-legend-tp24802219p24811505.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] 0.99.0-RC1 and the animation_blit_gtk2 example

2009-08-04 Thread Christophe Dupre
Hello,

 

I've been playing with the animation_blit_gtk2 example (
http://matplotlib.sourceforge.net/examples/animation/animation_blit_gtk2
.html

) and the latest version of matplotlib version 0.99.0-RC1.

I've modified the example so that it displays candlesticks moving
towards the lelf. The example is attached if anybody is interested.

 

 

In my example, I'm using 1 minute bars and therefore I would like to
shift the graph by 1 minute instead of a few pixels. Is there a way to
convert a time difference into pixels?

 

Thanks,

 

Christophe

 

 



animation_blit_gtk2-2.py
Description: animation_blit_gtk2-2.py
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] bug in scatter?

2009-08-04 Thread Thomas Robitaille

Hi,

The following script produces a single point that is green and translucent:

import matplotlib.pyplot as mpl

fig = mpl.figure()
ax = fig.add_subplot(111)
ax.scatter([0.],[0.],c=1.,alpha=0.2,vmin=0,vmax=2.0,cmap=mpl.cm.jet)
fig.canvas.draw()

and the following script produces a single point that is red and definitely
not translucent, because the color defined by c= is above vmax.

import matplotlib.pyplot as mpl

fig = mpl.figure()
ax = fig.add_subplot(111)
ax.scatter([0.],[0.],c=1.,alpha=0.2,vmin=0,vmax=0.5,cmap=mpl.cm.jet)
fig.canvas.draw()

Whether this is intentional or not, I'm not sure, but I would have expected
that alpha overrides the fact the color is out of bounds. In any case, this
pops up sometimes if I am plotting multiple points with different colors
given by an array, because vmax and vmin are automatically computed, and
because of numerical accuracy sometimes the 'brightest' point loses it's
alpha. The following example illustrates this:

import matplotlib.pyplot as mpl

import numpy as np

np.random.seed(-12421412)

x = np.random.random(1)
y = np.random.random(1)
c = np.random.random(1)

fig = mpl.figure()
ax = fig.add_subplot(111)
ax.scatter(x,y,c=c,alpha=0.01,cmap=mpl.cm.jet)
fig.canvas.draw()

Is this a bug in the way the colormap/alpha is handled?

Thanks,

Thomas






-- 
View this message in context: 
http://www.nabble.com/bug-in-scatter--tp24811933p24811933.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread John Hunter
On Mon, Aug 3, 2009 at 11:38 PM, Gökhan Sever wrote:
> Hello,
>
> I was wondering if it is possible to hide some data on figures using a say
> right click option to any of the legend entry and make it temporarily
> hidden/visible to better analyse the rest of the data?
>
> Check this screenshot for example:
>
> http://img25.imageshack.us/img25/9427/datahiding.png
>
> The red data clutters the rest of the figure, and I would like to be able to
> hide it temporarily so that I can investigate the other two relations more
> easily.
>
> Any ideas? or alternative solutions?

It's a nice idea, and should be doable with the pick interface we have
for all mpl artists.  Unfortunately, there were a few problems in the
legend implementation which blocked the pick events from hitting the
proxy lines they contained.  I just made a few changes to mpl svn HEAD
to support this, and added a new example.

  examples/event_handling/legend_picking.py

which I'll include below.   JJ could you review the changes to legend.py?

Instructions for checking out svn are at::

  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn

Here is the example:

"""
Enable picking on the legend to toggle the legended line on and off
"""
import numpy as np
import matplotlib.pyplot as plt

t = np.arange(0.0, 0.2, 0.1)
y1 = 2*np.sin(2*np.pi*t)
y2 = 4*np.sin(2*np.pi*2*t)

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

line1, = ax.plot(t, y1, lw=2, color='red', label='1 hz')
line2, = ax.plot(t, y2, lw=2, color='blue', label='2 hz')

leg = ax.legend(loc='upper left', fancybox=True, shadow=True)
leg.get_frame().set_alpha(0.4)


lines = [line1, line2]
lined = dict()
for legline, realine in zip(leg.get_lines(), lines):
legline.set_picker(5)  # 5 pts tolerance
lined[legline] = realine

def onpick(event):
legline = event.artist
realline = lined[legline]
vis = realline.get_visible()
realline.set_visible(not vis)
fig.canvas.draw()

fig.canvas.mpl_connect('pick_event', onpick)

plt.show()

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug in scatter?

2009-08-04 Thread Thomas Robitaille

Just a quick note - the last script in my previous email is wrong. I don't
get the problem in that case, I get it if the arrays are 32-bit:

import matplotlib.pyplot as mpl

import numpy as np

np.random.seed(-12421412)

x = np.random.random(1).astype(np.float32)
y = np.random.random(1).astype(np.float32)
c = np.random.random(1).astype(np.float32)

fig = mpl.figure()
ax = fig.add_subplot(111)
ax.scatter(x,y,c=c,alpha=0.01,cmap=mpl.cm.jet)
fig.canvas.draw()

which explains why there is probably some small numerical inaccuracy in
deciding whether the color value is above the maximum of the range (if the
latter is calculated in 64-bit). However, the question of why alpha gets set
to 1 for color values above the maximum still holds.

Tom
-- 
View this message in context: 
http://www.nabble.com/bug-in-scatter--tp24811933p24812570.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Using spines and set_yscale

2009-08-04 Thread Nicolas Pinto
Hello,

In the following code (using matplotlib svn), I'm trying to set the left
(log) axis "outward" using spines. Subplots 222 and 223 have "weird"
behaviors. Am I using the API incorrectly? I got it to work by calling
ax.set_yscale('log') twice (subplot 224). Where should I start if I want to
contribute a patch?

import matplotlib.pyplot as plt

plt.rcParams["xtick.direction"] = "out"
plt.rcParams["ytick.direction"] = "out"

x = [.5, 111,68, 192, 340, 325]

fig = plt.figure()

ax = fig.add_subplot(221)
ax.set_yscale('log')
ax.bar(range(len(x)), x, align='center')

ax = fig.add_subplot(222)
ax.set_yscale('log')
ax.bar(range(len(x)), x, align='center')
ax.spines["left"].set_position(("outward", 10))

ax = fig.add_subplot(223)
ax.bar(range(len(x)), x, align='center')
ax.spines["left"].set_position(("outward", 10))
ax.set_yscale('log')

ax = fig.add_subplot(224)
ax.set_yscale('log')
ax.bar(range(len(x)), x, align='center')
ax.spines["left"].set_position(("outward", 10))
ax.set_yscale('log')

plt.show()
# EOF

Thanks for your help.

Best regards,

-- 
Nicolas Pinto
Ph.D. Candidate, Brain & Computer Sciences
Massachusetts Institute of Technology, USA
http://web.mit.edu/pinto
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread Ryan May
On Tue, Aug 4, 2009 at 11:50 AM, John Hunter  wrote:

> On Mon, Aug 3, 2009 at 11:38 PM, Gökhan Sever
> wrote:
> > Hello,
> >
> > I was wondering if it is possible to hide some data on figures using a
> say
> > right click option to any of the legend entry and make it temporarily
> > hidden/visible to better analyse the rest of the data?
> >
> > Check this screenshot for example:
> >
> > http://img25.imageshack.us/img25/9427/datahiding.png
> >
> > The red data clutters the rest of the figure, and I would like to be able
> to
> > hide it temporarily so that I can investigate the other two relations
> more
> > easily.
> >
> > Any ideas? or alternative solutions?
>
> It's a nice idea, and should be doable with the pick interface we have
> for all mpl artists.  Unfortunately, there were a few problems in the
> legend implementation which blocked the pick events from hitting the
> proxy lines they contained.  I just made a few changes to mpl svn HEAD
> to support this, and added a new example.
>
>  examples/event_handling/legend_picking.py


Awesome example.  I tweaked it to change the alpha of the lines in the
legend so that you know when you've turned off a line (making it more
chaco-like).

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread Gökhan Sever
On Tue, Aug 4, 2009 at 11:50 AM, John Hunter  wrote:

> On Mon, Aug 3, 2009 at 11:38 PM, Gökhan Sever
> wrote:
> > Hello,
> >
> > I was wondering if it is possible to hide some data on figures using a
> say
> > right click option to any of the legend entry and make it temporarily
> > hidden/visible to better analyse the rest of the data?
> >
> > Check this screenshot for example:
> >
> > http://img25.imageshack.us/img25/9427/datahiding.png
> >
> > The red data clutters the rest of the figure, and I would like to be able
> to
> > hide it temporarily so that I can investigate the other two relations
> more
> > easily.
> >
> > Any ideas? or alternative solutions?
>
> It's a nice idea, and should be doable with the pick interface we have
> for all mpl artists.  Unfortunately, there were a few problems in the
> legend implementation which blocked the pick events from hitting the
> proxy lines they contained.  I just made a few changes to mpl svn HEAD
> to support this, and added a new example.
>
>  examples/event_handling/legend_picking.py
>
> which I'll include below.   JJ could you review the changes to legend.py?
>
> Instructions for checking out svn are at::
>
>
> http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn
>
> Here is the example:
>
> """
> Enable picking on the legend to toggle the legended line on and off
> """
> import numpy as np
> import matplotlib.pyplot as plt
>
> t = np.arange(0.0, 0.2, 0.1)
> y1 = 2*np.sin(2*np.pi*t)
> y2 = 4*np.sin(2*np.pi*2*t)
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> line1, = ax.plot(t, y1, lw=2, color='red', label='1 hz')
> line2, = ax.plot(t, y2, lw=2, color='blue', label='2 hz')
>
> leg = ax.legend(loc='upper left', fancybox=True, shadow=True)
> leg.get_frame().set_alpha(0.4)
>
>
> lines = [line1, line2]
> lined = dict()
> for legline, realine in zip(leg.get_lines(), lines):
>legline.set_picker(5)  # 5 pts tolerance
>lined[legline] = realine
>
> def onpick(event):
>legline = event.artist
>realline = lined[legline]
>vis = realline.get_visible()
>realline.set_visible(not vis)
>fig.canvas.draw()
>
> fig.canvas.mpl_connect('pick_event', onpick)
>
> plt.show()
>


Excellent John. Right what I was seeking for. This will help me a lot to
view and analyze my crowded plots.

Thanks also Ryan for the additional correction.

I have a little question on the code:

What is the purpose of using "commas" after line1 and line2 names?

I see a little change when I typed them in Ipython, however not exactly sure
the real reasoning behind this.

In [4]: lines = ax.plot(t, y1, lw=2, color='red', label='1 hz')

In [5]: lines
Out[5]: []

In [6]: lines, = ax.plot(t, y1, lw=2, color='red', label='1 hz')

In [7]: lines
Out[7]: 



Thanks.


-- 
Gökhan
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Building current SVN trunk on Mac OS X 10.5

2009-08-04 Thread Uri Laserson
I was wondering if anyone had any possible suggestions to fix the build
problem I am having below.  I built libpng as a universal library as
described below.  MPL then builds without any complaints, but gives me an
import error related to libpng.  I'm not a unix expert, and I'm not sure how
to proceed.

Thanks!
Uri

On Thu, Jul 30, 2009 at 01:34, Uri Laserson  wrote:

> The first suggestion failed with the same error, while the same suggestion
> worked up through the last step (make installers) which fails with the same
> error.
>
> I decided to try Tommy's suggestion of just figuring out how to compile
> libpng as a universal binary.  The way I did it was to run the configuration
> script as:
>
> ./configure --disable-dependency-tracking
>
>
> and then to manually edit the Makefile.  To CPPFLAGS and LDFLAGS I added
>
> -arch i386 -arch ppc
>
> Running make and sudo make install successfully built a universal library
> for me.
>
> After deleting my old MPL egg, I import matplotlib successfully and the
> version number is as expected (0.98.6svn).
>
> However, when I try to import pyplot, I get the following exception
> traceback.  Any suggestions on how to fix this?
>
> Thanks again!
>
> In [4]: import matplotlib.pyplot as plt
> ---
> ImportError   Traceback (most recent call last)
>
> /usr/local/lib/ in ()
>
> /Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/pyplot.py
> in ()
>   4 from matplotlib import _pylab_helpers, interactive
>   5 from matplotlib.cbook import dedent, silent_list, is_string_like,
> is_numlike
> > 6 from matplotlib.figure import Figure, figaspect
>   7 from matplotlib.backend_bases import FigureCanvasBase
>   8 from matplotlib.image import imread as _imread
>
> /Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/figure.py
> in ()
>  17 import artist
>  18 from artist import Artist, allow_rasterization
> ---> 19 from axes import Axes, SubplotBase, subplot_class_factory
>  20 from cbook import flatten, allequal, Stack, iterable, dedent
>  21 import _image
>
> /Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/axes.py
> in ()
>  17 import matplotlib.dates as mdates
>  18 import matplotlib.font_manager as font_manager
> ---> 19 import matplotlib.image as mimage
>  20 import matplotlib.legend as mlegend
>  21 import matplotlib.lines as mlines
>
> /Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/image.py
> in ()
>  19 # For clarity, names from _image are given explicitly in this
> module:
>  20 import matplotlib._image as _image
> ---> 21 import matplotlib._png as _png
>  22
>  23 # For user convenience, the names from _image are also imported
> into
>
> ImportError:
> dlopen(/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/_png.so,
> 2): Symbol not found: _png_create_info_struct
>   Referenced from:
> /Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/_png.so
>   Expected in: /usr/local/lib/libpng12.0.dylib
>
>
>
>
> On Wed, Jul 29, 2009 at 21:46, John Hunter  wrote:
>
>> On Wed, Jul 29, 2009 at 4:34 PM, Uri Laserson wrote:
>> > Hi everyone,
>> >
>> > I am trying to build the latest svn trunk version of MPL on OS X 10.5.
>> I am
>> > getting the following error:
>>
>> Try
>>
>>  make build_osx105
>>  python setup.py install --prefix=~/somewhere
>>
>> If that doesn't work, try
>>
>>  cd release/osx
>>
>> read the readme there and follow the instructions.  This will build
>> mpl the way we do when making a release: fetch the dependencies (zlip,
>> png and freetype) and build them with the right flags, and then build
>> mpl explcitly linking to these libs.
>>
>> JDH
>>
>
>
>
> --
> Uri Laserson
> PhD Candidate, Biomedical Engineering
> Harvard Medical School (Genetics)
> Massachusetts Institute of Technology (Mathematics)
> phone +1 917 742 8019
> laser...@mit.edu
>



-- 
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
laser...@mit.edu
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread Michael Droettboom

Gökhan Sever wrote:
>
> I see a little change when I typed them in Ipython, however not 
> exactly sure the real reasoning behind this.
>
> In [4]: lines = ax.plot(t, y1, lw=2, color='red', label='1 hz')
>
> In [5]: lines
> Out[5]: []
Here the variable lines is a list with one element (a Line2D object).
>
> In [6]: lines, = ax.plot(t, y1, lw=2, color='red', label='1 hz')
>
> In [7]: lines
> Out[7]: 
Here lines is a Line2D object.

ax.plot always returns a list because it may plot more than one line.  
The choice of syntax for the caller of the function is just for 
convenience.  One could just as easily do:

lines = ax.plot(t, y1, lw=2, color='red', label='1 hz')
line = lines[0]

Cheers,
Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread Ryan May
On Tue, Aug 4, 2009 at 2:27 PM, Michael Droettboom  wrote:

>
> Gökhan Sever wrote:
>
>>
>> I see a little change when I typed them in Ipython, however not exactly
>> sure the real reasoning behind this.
>>
>> In [4]: lines = ax.plot(t, y1, lw=2, color='red', label='1 hz')
>>
>> In [5]: lines
>> Out[5]: []
>>
> Here the variable lines is a list with one element (a Line2D object).
>
>>
>> In [6]: lines, = ax.plot(t, y1, lw=2, color='red', label='1 hz')
>>
>> In [7]: lines
>> Out[7]: 
>>
> Here lines is a Line2D object.
>
> ax.plot always returns a list because it may plot more than one line.  The
> choice of syntax for the caller of the function is just for convenience.
>  One could just as easily do:


Yeah, it's a nice little feature of python:

t = (1,2,3)
x,y,z = t #Now: x=1, y=2, z=3

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] No legend using scatter function

2009-08-04 Thread Gökhan Sever
Hello,

Could not get a legend shown on scatter function used plot:

In [4]: a = rand(100)

In [5]: b = rand(100)

In [22]: scatter(a,b, c=a, s=b, label="")
Out[22]: 

In [23]: scatter(a,b, c=a*5, s=b*5, label="")
Out[23]: 

In [24]: legend()

at rev 7355.

with

Python 2.6 (r26:66714, Jun  8 2009)
IPython 0.10.bzr.r1163 -- An enhanced Interactive Python.

Any suggestions?


-- 
Gökhan
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] advice on time-series of histograms

2009-08-04 Thread Uri Laserson
Hi Everyone,

I need some advice on the best way to create a certain plot:  I have a
series of time points.  For each one, I have a collection of values for
which I'd like to display the distribution with a histogram.  On the x-axis
would be the time points, while at each time point there is a vertical line
that is the baseline for a horizontally-oriented histogram.  This is similar
to a series of boxplots, but rather than using a boxplot to represent a
distribution of points, I am using a histogram.  There is no reason to
represent the "counts" for each histogram, as the histograms would all be
normalized, and I am only interested in their shape.

Ideally, this plot would be created on a single Axes object, as there should
be only a single x-axis.  This would involve drawing lots of rectangles on a
single plot.  However, one alternative is to create a separate Axes for each
histogram, and play with their relative sizes on the canvas to get the
proper spacing of the timepoints.  I have browsed the list of examples but
was not able to find something similar.

Any suggestions are welcome...

Thanks!
Uri

-- 
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
laser...@mit.edu
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread Jae-Joon Lee
On Tue, Aug 4, 2009 at 12:50 PM, John Hunter wrote:
> On Mon, Aug 3, 2009 at 11:38 PM, Gökhan Sever wrote:
>> Hello,
>>
>> I was wondering if it is possible to hide some data on figures using a say
>> right click option to any of the legend entry and make it temporarily
>> hidden/visible to better analyse the rest of the data?
>>
>> Check this screenshot for example:
>>
>> http://img25.imageshack.us/img25/9427/datahiding.png
>>
>> The red data clutters the rest of the figure, and I would like to be able to
>> hide it temporarily so that I can investigate the other two relations more
>> easily.
>>
>> Any ideas? or alternative solutions?
>
> It's a nice idea, and should be doable with the pick interface we have
> for all mpl artists.  Unfortunately, there were a few problems in the
> legend implementation which blocked the pick events from hitting the
> proxy lines they contained.  I just made a few changes to mpl svn HEAD
> to support this, and added a new example.
>
>  examples/event_handling/legend_picking.py
>
> which I'll include below.   JJ could you review the changes to legend.py?

John,

This looks good.
I guess I have overlooked the importance of setting the children properly.

Regards,

-JJ


>
> Instructions for checking out svn are at::
>
>  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn
>
> Here is the example:
>
> """
> Enable picking on the legend to toggle the legended line on and off
> """
> import numpy as np
> import matplotlib.pyplot as plt
>
> t = np.arange(0.0, 0.2, 0.1)
> y1 = 2*np.sin(2*np.pi*t)
> y2 = 4*np.sin(2*np.pi*2*t)
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> line1, = ax.plot(t, y1, lw=2, color='red', label='1 hz')
> line2, = ax.plot(t, y2, lw=2, color='blue', label='2 hz')
>
> leg = ax.legend(loc='upper left', fancybox=True, shadow=True)
> leg.get_frame().set_alpha(0.4)
>
>
> lines = [line1, line2]
> lined = dict()
> for legline, realine in zip(leg.get_lines(), lines):
>    legline.set_picker(5)  # 5 pts tolerance
>    lined[legline] = realine
>
> def onpick(event):
>    legline = event.artist
>    realline = lined[legline]
>    vis = realline.get_visible()
>    realline.set_visible(not vis)
>    fig.canvas.draw()
>
> fig.canvas.mpl_connect('pick_event', onpick)
>
> plt.show()
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 0.99.0-RC1 and the animation_blit_gtk2 example

2009-08-04 Thread Jae-Joon Lee
On Tue, Aug 4, 2009 at 12:14 PM, Christophe
Dupre wrote:
> Hello,
>
>
>
> I've been playing with the animation_blit_gtk2 example
> (http://matplotlib.sourceforge.net/examples/animation/animation_blit_gtk2.html
>
> ) and the latest version of matplotlib version 0.99.0-RC1.
>
> I've modified the example so that it displays candlesticks moving towards
> the lelf. The example is attached if anybody is interested.
>
>
>
>
>
> In my example, I'm using 1 minute bars and therefore I would like to shift
> the graph by 1 minute instead of a few pixels. Is there a way to convert a
> time difference into pixels?
>

The "get_dx_data" method coverts a pixel offset to a data offset.
So, what you need is just to invert it.
This requires some knowledge of transformation, but I guess the code
is rather self-explanatory.

For example,  something like below will work (sorry, I haven't
actually tested the code)

def get_dx_pixel(self, dx_data):
tp = self.ax.transData.transform_point
x0, y0 = tp((0, 0))
x1, y1 = tp((dx_data, 0))
return (x1-x0)

Regards,

-JJ

>
>
> Thanks,
>
>
>
> Christophe
>
>
>
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Re peated calls to Specgram for animation, memory leaking

2009-08-04 Thread xianthax

Hello,

First thanks for the great library, recently came across it and seems quite
useful for what i'm doing.

What i'm trying to do is create an animated specgram().  I'm feeding in
audio data from a microphone at the moment, although the ultimate use is to
chart data that will be input via the line in audio port from an FMCW radar
front end for basic visualization.

I've attached simplified code below based from one of your animation
examples that shows my problem.  Initially i get fine performance given the
timeout i've set.  After about a second or two, performance goes down hill
and progressively gets worse and memory use continues to grow as if each
call to specgram creates a new instance in memory or worse is drawing a new
instance over the old.  Is there another way to call specgram to avoid this? 
It seems the other plot types generally give the ability to update the data
for an already created graph, i haven't seen a way to do this with specgram,
perhaps this is what i'm missing?  Ultimately i would like to get the graph
image out of specgram and append them properly to get a smoother scrolling
effect but i need to get the data out of specgram fast enough first.

thanks in advance for any pointers.

import gobject
import numpy as np
import matplotlib
import array
matplotlib.use('GTKAgg')

import matplotlib.pyplot as plt
import ossaudiodev as oss

audio = oss.open('/dev/dsp','r')

print audio.setfmt(oss.AFMT_S16_LE)
print audio.channels(1)
print audio.speed(44100)

fig = plt.figure()
ax = fig.add_subplot(111)
data = array.array('H',audio.read(5880))
img = ax.specgram(data, NFFT=1024,Fs=44100, Fc=0,noverlap=64)

def update():
data = array.array('H',audio.read(5880))
img = plt.specgram(data, NFFT=1024,Fs=44100, Fc=0,noverlap=64)  

fig.canvas.draw_idle()
return True  

gobject.timeout_add(100, update)  
plt.show()


-- 
View this message in context: 
http://www.nabble.com/Repeated-calls-to-Specgram-for-animation%2C-memory-leaking-tp24814391p24814391.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [ANN] IPython 0.10 is out.

2009-08-04 Thread Fernando Perez
Hi all,

on behalf of the IPython development team, I'm happy to announce that
we've just put out IPython 0.10 final.  Many thanks to all those who
contributed ideas, bug reports and code.

You can download it from the usual location:

- http://ipython.scipy.org/moin/Download: direct links to various formats
- http://ipython.scipy.org/dist: all files are stored here.

The official documentation for this release can be found at:

- http://ipython.scipy.org/doc/rel-0.10/html: as HTML pages.
- http://ipython.scipy.org/doc/rel-0.10/ipython.pdf: as a single PDF.

In brief, this release gathers all recent work and in a sense closes a
cycle of the current useful-but-internally-messy structure of the
IPython code.  We are now well into the work of a major internal
cleanup that will inevitably change some APIs and will  likely take
some time to stabilize, so the 0.10 release should be used for a while
until the dust settles on the development branch.

The 0.10 release fixes many bugs, including some very problematic ones
(a major memory leak with repeated %run is closed), and also brings a
number of new features, stability improvements and improved
documentation.  Some highlights:

- Improved WX-based ipythonx and ipython-wx tools, suitable for
embedding  into other applications and standalone use.

- Better interactive demos with the IPython.demo module.

- Refactored ipcluster with support for local execution, MPI, PBS and
systems with SSH key access preconfigured.

- Integration with the TextMate editor in the %edit command.

The full release notes are available here with all the details:

http://ipython.scipy.org/doc/rel-0.10/html/changes.html#release-0-10

We hope you enjoy it, please report any problems as usual either on
the mailing list, or by filing a bug report at our Launchpad tracker:

https://bugs.launchpad.net/ipython

Cheers,

The IPython team.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users