[Matplotlib-users] TkAgg backend error message running within IPython

2010-10-01 Thread Wes McKinney
I'm getting the error:

can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"

With the latest matplotlib 1.0.0 on 64-bit Ubuntu 10.04 running the
following script within IPython 0.10 in pylab mode:

import matplotlib.pyplot as plt
import numpy as np

def test():
plt.figure(figsize=(10,5))
plt.plot(np.arange(1, 51), np.arange(1, 51), color='k')

def make_figs():
test()
plt.savefig('foo.pdf')
plt.close('all')

if __name__ == '__main__':
make_figs()

Here's the build information:

w...@wesm-desktop:~/code/repos/matplotlib$ sudo python setupegg.py develop
basedirlist is: ['/usr/local', '/usr']

BUILDING MATPLOTLIB
matplotlib: 1.0.0
python: 2.6.5 |EPD 6.2-2 (64-bit)| (r265:79063, Mar 22 2010,
17:32:05)  [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.4.0
 freetype2: 9.22.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.42
   Tkinter: Tkinter: 73770, Tk: 8.5, Tcl: 8.5
* Guessing the library and include directories for
* Tcl and Tk because the tclConfig.sh and
* tkConfig.sh could not be found and/or parsed.
  Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
   Mac OS X native: no
Qt: no
   Qt4: no
 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  datetime: present, version unknown
  dateutil: 1.5
  pytz: 2010h

OPTIONAL USETEX DEPENDENCIES
dvipng: 1.12
   ghostscript: 8.71
 latex: 3.1415926
   pdftops: 0.12.4

[Edit setup.cfg to suppress the above messages]

I checked that EPD 6.2.2 was built with tk8.5/tcl8.5 in case that was
causing a problem, does not seem to be.

I can switch to the WXAgg backend for now, but would help to know if
I'm doing something wrong by chance.

Note: I do not get this message running the script standalone outside
of IPython!

Thanks,
Wes

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


Re: [Matplotlib-users] imshow() and a transparent colormap?

2010-10-01 Thread Stan West
From: Nicolas Bigaouette [mailto:nbigaoue...@gmail.com] 
Sent: Thursday, September 30, 2010 18:00
 
What I would like to do it have a colormap which is transparent for lower
values of data and opaque for high values, so the blue on the figure would
appear white/transparent.

Would it suffice for the colormap to be light or white for low values but
still opaque? There are several built-in maps [1] with a light color at one
end; if it's light at the high end, append "_r" to the colormap name to get
the reversed version.

[1]
http://matplotlib.sourceforge.net/examples/pylab_examples/show_colormaps.html

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


Re: [Matplotlib-users] matplotlib import warning

2010-10-01 Thread Gökhan Sever
I temporarily fixed this by commenting the following lines in
pkg_resources.py folder in /site-packages/distribute.. folder.

issue_warning(
"Module %s was already imported from %s, but %s is being added"
" to sys.path" % (modname, fn, self.location),
)

Now, I don't get any dateutil imported messages each time I launch an
IPython session.

On Wed, Sep 8, 2010 at 1:26 PM, Gökhan Sever  wrote:
> It is clear with python -c "import matplotlib"
> I can't seem to find any "dateutil" phrase occurring within the IPython
> installation folder (/site-packages/IPython)
> Where else to look for?
>
> On Wed, Sep 8, 2010 at 12:35 PM, Aman Thakral 
> wrote:
>>
>> try this in the terminal:
>> python -c "import matplotlib"
>>
>> -Aman
>>
>> On Wed, Sep 8, 2010 at 12:17 PM, Gökhan Sever 
>> wrote:
>>>
>>> Hello,
>>> My usual ipython -pylab is giving me these warnings after I installed
>>> matplotlib from the source (matplotlib rev.8624 using python setupegg.py
>>> develop).
>>>
>>> /usr/lib/python2.6/site-packages/EPDLab-3.0.1.dev_r24658-py2.6.egg/enthought/__init__.py:7:
>>> UserWarning: Module dateutil was already imported from
>>> /home/user/Desktop/python-repo/matplotlib/lib/dateutil/__init__.pyc, but
>>> /usr/lib/python2.6/site-packages is being added to sys.path
>>>   __import__('pkg_resources').declare_namespace(__name__)
>>>
>>> Under /site-packages in easy-install.pth I moved
>>> the /home/user/Desktop/python-repo/matplotlib/lib line to the very bottom of
>>> the file but this doesn't make any change.
>>> Any ideas how to remove this warning?
>>> --
>>> Gökhan
>>>
>>>
>>> --
>>> This SF.net Dev2Dev email is sponsored by:
>>>
>>> Show off your parallel programming skills.
>>> Enter the Intel(R) Threading Challenge 2010.
>>> http://p.sf.net/sfu/intel-thread-sfd
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>>
>>
>> --
>> Aman Thakral
>> B.Eng & Biosci, M.Eng Design
>
>
>
> --
> Gökhan
>



-- 
Gökhan

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


Re: [Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Michael Droettboom
  On 10/01/2010 11:46 AM, Jason Grout wrote:
>On 10/01/2010 10:40 AM, Michael Droettboom wrote:
>> On 10/01/2010 11:31 AM, Jason Grout wrote:
>>> I'm working on updating matplotlib in Sage to 1.0.  We're running into
>>> a problem where it seems that the fontList.cache is not being updated.
>>> I've included an example session below.  The .matplotlib directory is
>>> accessible here:
>>> http://sage.math.washington.edu/home/jason/.matplotlib/  The problem
>>> seems to be that it is looking for a file that does not exist:
>>>
>>> [ja...@sage:/scratch/jason/sage-4.6.alpha2]$ ls
>>> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
>>> ls: cannot access
>>> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf:
>>> No such file or directory
>>>
>>>
>>> Does anyone have any idea what is going on?  Why is the fontList.cache
>>> file not being updated, instead of trying to access a path that doesn't
>>> exist?
>> There is a fix in SVN for this, but it has not yet been released.  When
>> a font file is not found, it rebuilds the entire font cache on the spot.
> Thanks.  Do you know the commit?  We'll apply it to the Sage matplotlib
> package.
>
>
It's r8712.
>>> A related question is: I see the variable USE_FONTCONFIG in
>>> font_manager.py.  It says it is experimental.  How stable is that code?
>>> It's tempting to switch to using fontconfig.
>> I use it as a matter of course on my Linux box and haven't had any
>> issues.  It's experimental because it's the kind of thing that is so
>> affected by external environmental issues and distro differences.  Just
>> because it "works for me", there's no guarantee it will work
>> everywhere.  But go ahead and give it a try and report back with the
>> distro you're using.
>>
> Well, with Sage, we're using it on a number of distros, flavors of OSX,
> Solaris, etc.  So maybe I'll stick with the home-grown caching
> solution.  At least until we've tested it a bit on different support
> platforms for Sage.
>
> I thought there was some sort of build bot for matplotlib that tested on
> a number of platforms.  Do you know how the fontconfig stuff does on
> that (if it exists...).
I don't think the buildbots are turning on fontconfig support.  And I 
believe all of the buildbots are some flavour of Ubuntu (the OS-X 
buildbot is not running), so there's not a lot of coverage.

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


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


Re: [Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Jason Grout
  On 10/01/2010 10:40 AM, Michael Droettboom wrote:
>On 10/01/2010 11:31 AM, Jason Grout wrote:
>> I'm working on updating matplotlib in Sage to 1.0.  We're running into
>> a problem where it seems that the fontList.cache is not being updated.
>> I've included an example session below.  The .matplotlib directory is
>> accessible here:
>> http://sage.math.washington.edu/home/jason/.matplotlib/  The problem
>> seems to be that it is looking for a file that does not exist:
>>
>> [ja...@sage:/scratch/jason/sage-4.6.alpha2]$ ls
>> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
>> ls: cannot access
>> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf:
>> No such file or directory
>>
>>
>> Does anyone have any idea what is going on?  Why is the fontList.cache
>> file not being updated, instead of trying to access a path that doesn't
>> exist?
> There is a fix in SVN for this, but it has not yet been released.  When
> a font file is not found, it rebuilds the entire font cache on the spot.

Thanks.  Do you know the commit?  We'll apply it to the Sage matplotlib 
package.


>> A related question is: I see the variable USE_FONTCONFIG in
>> font_manager.py.  It says it is experimental.  How stable is that code?
>> It's tempting to switch to using fontconfig.
> I use it as a matter of course on my Linux box and haven't had any
> issues.  It's experimental because it's the kind of thing that is so
> affected by external environmental issues and distro differences.  Just
> because it "works for me", there's no guarantee it will work
> everywhere.  But go ahead and give it a try and report back with the
> distro you're using.
>

Well, with Sage, we're using it on a number of distros, flavors of OSX, 
Solaris, etc.  So maybe I'll stick with the home-grown caching 
solution.  At least until we've tested it a bit on different support 
platforms for Sage.

I thought there was some sort of build bot for matplotlib that tested on 
a number of platforms.  Do you know how the fontconfig stuff does on 
that (if it exists...).

Thanks,

Jason


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


Re: [Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Michael Droettboom
  On 10/01/2010 11:31 AM, Jason Grout wrote:
> I'm working on updating matplotlib in Sage to 1.0.  We're running into
> a problem where it seems that the fontList.cache is not being updated.
> I've included an example session below.  The .matplotlib directory is
> accessible here:
> http://sage.math.washington.edu/home/jason/.matplotlib/  The problem
> seems to be that it is looking for a file that does not exist:
>
> [ja...@sage:/scratch/jason/sage-4.6.alpha2]$ ls
> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
> ls: cannot access
> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf:
> No such file or directory
>
>
> Does anyone have any idea what is going on?  Why is the fontList.cache
> file not being updated, instead of trying to access a path that doesn't
> exist?
There is a fix in SVN for this, but it has not yet been released.  When 
a font file is not found, it rebuilds the entire font cache on the spot.
> A related question is: I see the variable USE_FONTCONFIG in
> font_manager.py.  It says it is experimental.  How stable is that code?
> It's tempting to switch to using fontconfig.
I use it as a matter of course on my Linux box and haven't had any 
issues.  It's experimental because it's the kind of thing that is so 
affected by external environmental issues and distro differences.  Just 
because it "works for me", there's no guarantee it will work 
everywhere.  But go ahead and give it a try and report back with the 
distro you're using.

Mike
> Thanks,
>
> Jason
>
>
> Here is my example session:
>
> In [1]: from pylab import *
>
> In [2]: text(0.5, 0.5, 'text 0')
> Out[2]:
>
> In [3]: savefig('test.png')
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (532, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (643, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (10, 0))
>
> ---
> RuntimeError  Traceback (most recent call last)
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/  in()
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/pyplot.pyc
> in savefig(*args, **kwargs)
>   361 def savefig(*args, **kwargs):
>   362 fig = gcf()
> -->  363 return fig.savefig(*args, **kwargs)
>   364
>   365 @docstring.copy_dedent(Figure.ginput)
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/figure.pyc
> in savefig(self, *args, **kwargs)
>  1082 kwargs.setdefault('edgecolor',
> rcParams['savefig.edgecolor'])
>  1083
> ->  1084 self.canvas.print_figure(*args, **kwargs)
>  1085
>  1086 if transparent:
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backend_bases.pyc
> in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
> format, **kwargs)
>  1884 orientation=orientation,
>  1885 bbox_inches_restore=_bbox_inches_restore,
> ->  1886 **kwargs)
>  1887 finally:
>  1888 if bbox_inches and restore_bbox:
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
> in print_png(self, filename_or_obj, *args, **kwargs)
>   436
>   437 def print_png(self, filename_or_obj, *args, **kwargs):
> -->  438 FigureCanvasAgg.draw(self)
>   439 renderer = self.get_renderer()
>   440 original_dpi = renderer.dpi
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
> in draw(self)
>   392
>   393 self.renderer = self.get_renderer()
> -->  394 self.figure.draw(self.renderer)
>   395
>   396 def get_renderer(self):
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
> in draw_wrapper(artist, renderer, *args, **kwargs)
>53 def draw_wrapper(artist, renderer, *args, **kwargs):
>54 before(artist, renderer)
> --->  55 draw(artist, renderer, *args, **kwargs)
>56 after(artist, renderer)
>57
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/figure.pyc
> in draw(self, renderer)
>   796 dsu.sort(key=itemgetter(0))
>   797 for zorder, func, args in dsu:
> -->  798 func(*args)
>   799
>   800 renderer.close_group('

[Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Jason Grout
  I'm working on updating matplotlib in Sage to 1.0.  We're running into 
a problem where it seems that the fontList.cache is not being updated.  
I've included an example session below.  The .matplotlib directory is 
accessible here: 
http://sage.math.washington.edu/home/jason/.matplotlib/  The problem 
seems to be that it is looking for a file that does not exist:

[ja...@sage:/scratch/jason/sage-4.6.alpha2]$ ls 
/scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
ls: cannot access 
/scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf:
 
No such file or directory


Does anyone have any idea what is going on?  Why is the fontList.cache 
file not being updated, instead of trying to access a path that doesn't 
exist?

A related question is: I see the variable USE_FONTCONFIG in 
font_manager.py.  It says it is experimental.  How stable is that code?  
It's tempting to switch to using fontconfig.

Thanks,

Jason


Here is my example session:

In [1]: from pylab import *

In [2]: text(0.5, 0.5, 'text 0')
Out[2]: 

In [3]: savefig('test.png')
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (532, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (643, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (10, 0))

---
RuntimeError  Traceback (most recent call last)

/mnt/usb1/scratch/jason/sage-4.6.alpha2/ in ()

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/pyplot.pyc
 
in savefig(*args, **kwargs)
 361 def savefig(*args, **kwargs):
 362 fig = gcf()
--> 363 return fig.savefig(*args, **kwargs)
 364
 365 @docstring.copy_dedent(Figure.ginput)

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/figure.pyc
 
in savefig(self, *args, **kwargs)
1082 kwargs.setdefault('edgecolor', 
rcParams['savefig.edgecolor'])
1083
-> 1084 self.canvas.print_figure(*args, **kwargs)
1085
1086 if transparent:

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backend_bases.pyc
 
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, 
format, **kwargs)
1884 orientation=orientation,
1885 bbox_inches_restore=_bbox_inches_restore,
-> 1886 **kwargs)
1887 finally:
1888 if bbox_inches and restore_bbox:

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
 
in print_png(self, filename_or_obj, *args, **kwargs)
 436
 437 def print_png(self, filename_or_obj, *args, **kwargs):
--> 438 FigureCanvasAgg.draw(self)
 439 renderer = self.get_renderer()
 440 original_dpi = renderer.dpi

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
 
in draw(self)
 392
 393 self.renderer = self.get_renderer()
--> 394 self.figure.draw(self.renderer)
 395
 396 def get_renderer(self):

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
 
in draw_wrapper(artist, renderer, *args, **kwargs)
  53 def draw_wrapper(artist, renderer, *args, **kwargs):
  54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
  56 after(artist, renderer)
  57

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/figure.pyc
 
in draw(self, renderer)
 796 dsu.sort(key=itemgetter(0))
 797 for zorder, func, args in dsu:
--> 798 func(*args)
 799
 800 renderer.close_group('figure')

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
 
in draw_wrapper(artist, renderer, *args, **kwargs)
  53 def draw_wrapper(artist, renderer, *args, **kwargs):
  54 before(artist, renderer)
---> 55 draw(artist, renderer, *args, **kwargs)
  56 after(artist, renderer)
  57

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/axes.pyc
 
in draw(self, renderer, inframe)
1932
1933 for zorder, a in dsu:
-> 1934 a.draw(renderer)
1935
1936 renderer.close_group('axes')

/mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
 
in draw_wrap

Re: [Matplotlib-users] Combination of a box plot and a histogram

2010-10-01 Thread Tony S Yu
On Oct 1, 2010, at 9:40 AM, Benjamin Root wrote:On Thu, Sep 30, 2010 at 8:44 PM, Tony S Yu  wrote:

I'd like to make something in between a box plot [1] and a histogram. Each histogram would be represented by a single, tall, rectangular patch (like the box in a box plot), and the patch would be subdivided by the bin edges of the histogram. The face color of each sub-patch would replace the bar height in the histogram.



If any of that actually made sense:

* Does this type of plot have a name?

* Is there an easy way to do this in Matplotlib?

* If there isn't an easy way, what would be a good starting point? Initial ideas: 1) Use pcolor or imshow and embed this axes in a larger axes, 2) represent the sub-patches as a PolyCollection.

Thoughts?
-Tony

[1] e.g. http://matplotlib.sourceforge.net/examples/pylab_examples/boxplot_demo.htmlTony,

I am not quite sure I understand.  [snip]Or maybe something else in the gallery is more like what you want:

http://matplotlib.sourceforge.net/gallery.htmlBen Root
I've checked the gallery, but I don't see anything that appears similar. In any case, I ended up hacking together something that works. I've attached an image of what I had in mind (created with the code at the very bottom of this reply).I ended up using mpl Rectangle objects and stringing them together using a PatchCollection. Maybe there's a more efficient way to do this, but this approach worked well-enough.Best,-Tony"""First attempt at a histogram strip chart (made up name).if-main block taken from [1] except that I've replaced uniform distributionswith normal distributions.[1] http://matplotlib.sourceforge.net/examples/pylab_examples/boxplot_demo3.html"""import numpy as npimport matplotlib.pyplot as pltfrom matplotlib import collectionsNORM_TYPES = dict(max=max, sum=sum)class BinCollection(collections.PatchCollection):    def __init__(self, hist, bin_edges, x=0, width=1, cmap=plt.cm.gray_r,                  norm_type='max', **kwargs):        yy = (bin_edges[:-1] + bin_edges[1:])/2.        heights = np.diff(bin_edges)        bins = [plt.Rectangle((x, y), width, h) for y, h in zip(yy, heights)]        norm = NORM_TYPES[norm_type]        fc = cmap(np.asarray(hist, dtype=float)/norm(hist))        super(BinCollection, self).__init__(bins, facecolors=fc, **kwargs)def histstrip(x, positions=None, widths=None, ax=None):    if ax is None:        ax = plt.gca()    if positions is None:        positions = range(1, len(x) + 1)    if widths is None:        widths = np.min(np.diff(positions)) / 2. * np.ones(len(positions))    for data, x_pos, w in zip(x, positions, widths):        x_pos -= w/2.        hist, bin_edges = np.histogram(data)        bins = BinCollection(hist, bin_edges, width=w, x=x_pos)        ax.add_collection(bins, autolim=True)    ax.set_xticks(positions)    ax.autoscale_view()if __name__ == '__main__':    import matplotlib.pyplot as plt    import numpy as np    np.random.seed(2)    inc = 0.1    e1 = np.random.normal(0,1, size=(500,))    e2 = np.random.normal(0,1, size=(500,))    e3 = np.random.normal(0,1 + inc, size=(500,))    e4 = np.random.normal(0,1 + 2*inc, size=(500,))    treatments = [e1,e2,e3,e4]    fig, ax = plt.subplots()    pos = np.array(range(len(treatments)))+1    histstrip(treatments, ax=ax)    ax.set_xlabel('treatment')    ax.set_ylabel('response')    fig.subplots_adjust(right=0.99,top=0.99)    plt.show()--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combination of a box plot and a histogram

2010-10-01 Thread Benjamin Root
On Thu, Sep 30, 2010 at 8:44 PM, Tony S Yu  wrote:

> I'd like to make something in between a box plot [1] and a histogram. Each
> histogram would be represented by a single, tall, rectangular patch (like
> the box in a box plot), and the patch would be subdivided by the bin edges
> of the histogram. The face color of each sub-patch would replace the bar
> height in the histogram.
>
> If any of that actually made sense:
>
> * Does this type of plot have a name?
>
> * Is there an easy way to do this in Matplotlib?
>
> * If there isn't an easy way, what would be a good starting point? Initial
> ideas: 1) Use pcolor or imshow and embed this axes in a larger axes, 2)
> represent the sub-patches as a PolyCollection.
>
> Thoughts?
> -Tony
>
> [1] e.g.
> http://matplotlib.sourceforge.net/examples/pylab_examples/boxplot_demo.html
>

Tony,

I am not quite sure I understand.  Are you  looking for error bars on the
histogram, maybe?

http://matplotlib.sourceforge.net/users/screenshots.html#bar-charts

Or maybe something more like this:

http://matplotlib.sourceforge.net/examples/pylab_examples/bar_stacked.html

Or maybe something else in the gallery is more like what you want:

http://matplotlib.sourceforge.net/gallery.html

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


Re: [Matplotlib-users] segmentation fault..

2010-10-01 Thread Michael Droettboom
  Can you get us a gdb backtrace?

Type "gdb python" at the prompt, then at the gdb prompt, type "r 
/usr/bin/ipython -pylab".  After it segfaults, type "bt" to get a 
backtrace, and send the output to this list.

Mike

On 10/01/2010 07:04 AM, Eric Emsellem wrote:
> Hi
>
> I just upgraded to opensuse 11.3.
>
> And I get now:
>
> ipython -pylab:
>
> matplotlib version 1.0.0
> verbose.level helpful
> platform is  linux2
> *Segmentation fault*
>
>
> Any clue?
>
> I am using IPython 0.10, Python 2.6.5
>
> Eric
>
>
> --
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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


[Matplotlib-users] segmentation fault..

2010-10-01 Thread Eric Emsellem
Hi

I just upgraded to opensuse 11.3.

And I get now:

ipython -pylab:

matplotlib version 1.0.0
verbose.level helpful
platform is  linux2
*Segmentation fault*


Any clue?

I am using IPython 0.10, Python 2.6.5

Eric


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