Re: [Matplotlib-users] Mysterious "ValueError: zero-size array..."

2010-03-06 Thread David Goldsmith
--- On Sat, 3/6/10, Friedrich Romstedt  wrote:

> Note, that this is private discussion now and no longer on
> the list
> (accidentally?).  If you want to put it back on the
> list, please feel
> free to do so.

Yeah, my email client (yahoo!) showed your example submission email as being 
directly to me, not the list, so I assumed that you were sending it directly to 
me because you saw that I had cross-posted to the numpy list.  Anyway, I'm 
returning this thread to this list, FWIW.

> d1 is a diagram_cl.Diagram instance, holding a

Sorry for being dense, but where do I get diagram_cl?

>>> from matplotlib import diagram_cl as dc
Traceback (most recent call last):
  File "", line 1, in 
ImportError: cannot import name diagram_cl

and http://matplotlib.sourceforge.net/search.html?q=diagram_cl yields:

Search Results

Your search did not match any documents.

DG

> matplotlib.figure.Figure instance and an
> matplotlib.axes.Axes instance
> of that figure.  I used it because I was too lazy to
> create them on my
> own.
> 
> fwiw, diagram_cl is used to plot single-axes
> diagrams.  There are also
> accompanying Layer2D (f(x) plots) and Layer3D
> (xy-colorplots) classes.
>  They hide the internals of matplotlib completely and
> provide a pure
> data-oriented interface.
> 
> Friedrich
>



  

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


Re: [Matplotlib-users] Change colorbar orientation once drawn

2010-03-06 Thread Jae-Joon Lee
Try

cb.orientation = "horizontal"
cb.update_bruteforce(cb.mappable)

it seems to work okay.
However, note that "update_bruteforce" clears the axes then redraws.
So, if you added some artists in the colorbar axes by yourself
(although this is not likely), they will be lost.

Regards,

-JJ



On Thu, Mar 4, 2010 at 8:48 PM, Thomas Robitaille
 wrote:
> Hi,
>
> I would like to change the orientation of a colorbar once it has already been 
> drawn. So for example if I create the colorbar with:
>
> cb = fig.colorbar(mappable=image, cax=cax, orientation='vertical')
>
> I would like to be able to do
>
> cb.set_orientation('horizontal')
>
> Is there a way to do this, since set_orientation does not exist?
>
> Thanks for any help,
>
> Thomas
>
>
>
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

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


Re: [Matplotlib-users] Mysterious "ValueError: zero-size array..."

2010-03-06 Thread Friedrich Romstedt
2010/3/6 David Goldsmith :
> Yeah, my email client (yahoo!) showed your example submission email as being 
> directly to me, not the list, so I assumed that you were sending it directly 
> to me because you saw that I had cross-posted to the numpy list.  Anyway, I'm 
> returning this thread to this list, FWIW.

Yeah, my e-mail client (gmail) chooses for e-mail from the
matplotlib-users list as default recipient of the answer always the
sender (maybe a misconfiguration?).  I have to click "Answer All", and
I sometimes fail to do so, and do not recognise.

>> d1 is a diagram_cl.Diagram instance, holding a
>
> Sorry for being dense, but where do I get diagram_cl?

All you tried won't work, diagram_cl is not included with matplotlib,
and as I think it never will.  Please clone or download from
http://github.com/friedrichromstedt/diagram_cl . See also
http://sourceforge.net/mailarchive/forum.php?thread_name=4B8443E2.9000506%40gmail.com&forum_name=matplotlib-users
. Do you need advice with installing the package?  I have not provided
an setup.py so far.

Friedrich

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


Re: [Matplotlib-users] Mysterious "ValueError: zero-size array..."

2010-03-06 Thread David Goldsmith
--- On Sat, 3/6/10, Friedrich Romstedt  wrote:

> >> d1 is a diagram_cl.Diagram instance, holding a
> >
> > Sorry for being dense, but where do I get diagram_cl?
> 
> All you tried won't work, diagram_cl is not included with
> matplotlib,
> and as I think it never will.  Please clone or
> download from
> http://github.com/friedrichromstedt/diagram_cl . See
> also
> http://sourceforge.net/mailarchive/forum.php?thread_name=4B8443E2.9000506%40gmail.com&forum_name=matplotlib-users
> . Do you need advice with installing the package?  I
> have not provided
> an setup.py so far.

Ah, ok, not right now (perhaps later): for the purpose of adding your code to 
the numpy bug ticket, I think it's best if I use something a little more 
ubiquitous. ;-)  But it looks useful, so I'll probably grab it and try it out 
myself; is it pure python, i.e., should I be able to just put it in a folder 
containing an init file in site-packages and then it should "just work"?

Thanks again,

DG

DG

> 
> Friedrich
> 


  

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


Re: [Matplotlib-users] Mysterious "ValueError: zero-size array..."

2010-03-06 Thread Friedrich Romstedt
David Goldsmith:
> Ah, ok, not right now (perhaps later): for the purpose of adding your code to 
> the numpy bug ticket, I think it's best if I use something a little more 
> ubiquitous. ;-)  But it looks useful, so I'll probably grab it and try it out 
> myself; is it pure python, i.e., should I be able to just put it in a folder 
> containing an init file in site-packages and then it should "just work"?

Yeah, simply have a look at diagram.py

And yes, it should work out-of-the-box.  The init file should be
already included.  Simply put it in a folder.  It's tiny.

Everything needed should be:

import matplotlib.figure

fig = matplotlib.figure.Figure()
ax = fig.add_axes((0.2, 0.2, 0.6, 0.6))
ax.imshow(...)

And would you mind if I put my opinion about the not-a-numpy-issue
character on the numpy list too?  I think it's a pure matplotlib
problem, in my opinion numpy is behaving well, although they told you
to fill in a ticket?

Friedrich

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


[Matplotlib-users] Fixing Figure Size

2010-03-06 Thread Bonnie Douglas

hello,

I am working in Python with TkAgg.  I have several plots that I would 
like to display on a single figure.  The problem is, when I set the 
figure size to 12in wide, 6in high (which is perfect for my laptop) the 
plots get scrunched up.  If I resize the window in which they're 
displayed then the plots scrunch up even further.  So it appears to me 
that the figure size is tied to the window size.


I would like to set the size of the initial window in which the plots 
appear and then fix the size of the canvas? frame? figure? (not sure 
what I need to fix).  I have created a scrollbar on the window to permit 
scrolling up and down.


I have attached the Navigation Toolbar to the bottom of the window, 
which is where I would like it to stay.  So, the plots should scroll up 
and down with the toolbar fixed.


My small sample program is attached.

I am using Tk (as opposed to another GUI) as I am generating these plots 
from data in SimPy and am using SimGUI to control the model execution 
and plotting.


I would greatly appreciate any help!
Regards,
Bonnie Douglas


#!/usr/bin/env python
# menu-example-4.py
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt



import Tkinter as Tk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, 
NavigationToolbar2TkAgg
from matplotlib.figure import Figure
from numpy import arange, sin, pi
import sys

# create toplevel window
tl=Tk.Toplevel(height='6i')
tl.title("storage")
print 'done toplevel'

# create frame
frame=Tk.Frame(master=tl, bd=2)
frame.grid_rowconfigure(0, weight=1)
frame.grid_columnconfigure(0, weight=1)
print 'frame done'

scroll = Tk.Scrollbar(frame)
scroll.grid(row=0, column=1, sticky=Tk.N+Tk.S)


# create figure
# this setting appears to control the toplevel window size as well!
# I want to set the toplevel window to 12in wide by 6 inches high
# I want to set the figure draw area to 12in wide by 18 inches high and
# let the scrollbar do the work.
# I want to keep the navigation toolbar positioned at the bottom of the 
toplevel window
fig=Figure(figsize=(12,6), dpi=100)

# create plots
a1 = fig.add_subplot(411)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)
a1.plot(t,s)

a2 = fig.add_subplot(412)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)
a2.plot(t,s)

a3 = fig.add_subplot(413)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)
a3.plot(t,s)

a4 = fig.add_subplot(414)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)
a4.plot(t,s)

# create canvas
canvas=FigureCanvasTkAgg(figure=fig, master=frame)
canvas.show()

c=canvas.get_tk_widget()

c.config(bd=0, scrollregion=(0, 0, 2000, 2000), yscrollcommand=scroll.set)
c.grid(row=0, column=0, sticky=Tk.N+Tk.S+Tk.E+Tk.W)

scroll.config(command=c.yview)

# problems with toolbar not showing solved by setting the master to
# the toplevel window, not the frame!!!
toolbar=NavigationToolbar2TkAgg(canvas, tl)
toolbar.update()
#

frame.pack()

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