[Matplotlib-users] Line2D on multiple plots?

2009-08-17 Thread Ole Streicher
Hi,

I want to show the same data on multiple plots. Is it possible to re-use
the Line2D object for that? t.m., 

line = axes1.plot(xdata, ydata, ...)

...

axes2.lines.append(line)

Or is a Line2D bound to a certain axes instance?

Best regards

Ole




--
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] Resize error with Qt4 backend

2009-07-02 Thread Ole Streicher
Hi Brian,

I have also some layout problems with the Qt4 backend. The worst one is
a SegFault when adjusting the width.

Brian Zambrano bri...@gmail.com writes:
 vbox = QVBoxLayout()
 vbox.addWidget(self.canvas)
 self.setLayout(vbox)

Could you just try to add a second canvas to the layout?

vbox = QVBoxLayout()
vbox.addWidget(self.canvas1)
vbox.addWidget(self.canvas2)
self.setLayout(vbox)

and then try to adjust the size by moving the separator between the
central and right widget? In my code, I can reproduce a crash here on
Linux. Also, depending on the speed (content) of the canvases, the width
is not always ajusted correctly.

I am still not sure whether this is fault of Qt, PyQt, or matplotlib.

Thanks

Ole


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


Re: [Matplotlib-users] Resize error with Qt4 backend

2009-07-02 Thread Ole Streicher
Hello Darren,

Darren Dale dsdal...@gmail.com writes:
 I can't produce a segfault with the attached script. I have Qt-4.5.2,
 PyQt-4.5.1, and a checkout of the matplotlib trunk.

OK, in this context it seems to work.

I attach a script that shows the problem.

Run it, move the second diagram below the first, adjust their sizes so
that they take roughly the same size:

+---+---+
| Diagram 1 |   |
|   |   |
|   | Hello |
+---+ World |
| Diagram 2 |   |
|   |   |
|   |   |
+---+---+

(you will see that the Diagram 2 will not alway update properly :-( [*] )
and then move the slider between the diagrams and the Hello World
label. There is a good chance that the program will segfault. If it does
not, increase the number of points in the diagrams.

BTW,could you reproduce my last example with diagram and scrollbar? It
still remains unsolved (and is reproduced here [*]).

Versions (all 64 bit):

openSUSE 11.1:
Qt Open Source Edition 4.4.3
PyQt 4.4.3
Matplotlib 0.98.5.2

Kubuntu 9.04:
Qt Open Source Edition 4.5.0
PyQt 4.4.4
Matplotlib 0.98.5.2

Best regards

Ole
import random
import sys

from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure,SubplotParams

class AppForm(QtGui.QMainWindow):

def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)

self.create_dock_widgets()
self.resize(700, 600)

def create_dock_widgets(self):
self.setDockNestingEnabled(True)
w1 = QtGui.QDockWidget('Diagram 1', self)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea, w1)
w1.setWidget(InnerDiagramWidget(self))
w2 = QtGui.QDockWidget('Diagram 2', self)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea, w2)
w2.setWidget(InnerDiagramWidget(self))

w3 = QtGui.QDockWidget('Label', self)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea, w3)
w3.setWidget(QtGui.QLabel('Hello World'))

class InnerDiagramWidget(FigureCanvas):
def __init__(self, parent):
fig = Figure()
self.axes = fig.add_subplot(111)
# Increase this number to rise your chances for a segfault.
range = xrange(1000)
l = [ random.randint(-5, 5) for i in range ]
self.axes.plot(range, l, drawstyle='steps')
FigureCanvas.__init__(self, fig)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
   QtGui.QSizePolicy.Expanding,
   QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)

a = QtGui.QApplication(sys.argv)
w = AppForm()
w.show()
a.exec_()
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Resize error with Qt4 backend

2009-07-02 Thread Ole Streicher
Hello Darren,

Darren Dale dsdal...@gmail.com writes:
 I can't produce a segfault with the attached script. I have Qt-4.5.2,
 PyQt-4.5.1, and a checkout of the matplotlib trunk.

OK, in this context it seems to work.

I attach a script that shows the problem.

Run it, move the second diagram below the first, adjust their sizes so
that they take roughly the same size:

+---+---+
| Diagram 1 |   |
|   |   |
|   | Hello |
+---+ World |
| Diagram 2 |   |
|   |   |
|   |   |
+---+---+

(you will see that the Diagram 2 will not always update properly :-( [*] )
and then move the slider between the diagrams and the Hello World
label. There is a good chance that the program will segfault. If it does
not, increase the number of points in the diagrams.

BTW, could you reproduce my last example with diagram and scrollbar? It
still remains unsolved (and is reproduced here [*]).

Versions (all 64 bit):

openSUSE 11.1:
Qt Open Source Edition 4.4.3
PyQt 4.4.3
Matplotlib 0.98.5.2

Kubuntu 9.04:
Qt Open Source Edition 4.5.0
PyQt 4.4.4
Matplotlib 0.98.5.2

Best regards

Ole
8---
import random
import sys

from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure,SubplotParams

class AppForm(QtGui.QMainWindow):

def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)

self.create_dock_widgets()
self.resize(700, 600)

def create_dock_widgets(self):
self.setDockNestingEnabled(True)
w1 = QtGui.QDockWidget('Diagram 1', self)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea, w1)
w1.setWidget(InnerDiagramWidget(self))
w2 = QtGui.QDockWidget('Diagram 2', self)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea, w2)
w2.setWidget(InnerDiagramWidget(self))

w3 = QtGui.QDockWidget('Label', self)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea, w3)
w3.setWidget(QtGui.QLabel('Hello World'))

class InnerDiagramWidget(FigureCanvas):
def __init__(self, parent):
fig = Figure()
self.axes = fig.add_subplot(111)
# Increase this number to rise your chances for a segfault.
range = xrange(1000)
l = [ random.randint(-5, 5) for i in range ]
self.axes.plot(range, l, drawstyle='steps')
FigureCanvas.__init__(self, fig)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
   QtGui.QSizePolicy.Expanding,
   QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)

a = QtGui.QApplication(sys.argv)
w = AppForm()
w.show()
a.exec_()
8---


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


Re: [Matplotlib-users] Strange resize behaviour for qt backend

2009-06-23 Thread Ole Streicher
Hi,

could anyone reproduce this problem and/or has a solution for it? Is
there anything wrong with my code?

Best regards

Ole

Ole Streicher ole-usenet-s...@gmx.net writes:
 Hi Darren,

 Darren Dale dsdal...@gmail.com writes:
 I am really busy with other things, and can't offer suggestions unless
 you post a short, simple, standalone script that demonstrates the
 problem.

 Sure:
 8-
 import random
 import sys

 from PyQt4 import QtGui, QtCore
 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as 
 FigureCanvas
 from matplotlib.figure import Figure,SubplotParams

 class DiagramWidget(QtGui.QWidget):
 def __init__(self, parent):
 QtGui.QWidget.__init__(self, parent)
 layout = QtGui.QVBoxLayout(self)
 self.setLayout(layout)
 self.diagram = InnerDiagramWidget(self)
 self.scrollbar = QtGui.QScrollBar(QtCore.Qt.Horizontal, self)
 layout.addWidget(self.diagram)
 layout.addWidget(self.scrollbar)

 def resizeEvent(self, event):
 print 'figure resize to',  event.size()
 QtGui.QWidget.resizeEvent(self, event)

 class InnerDiagramWidget(FigureCanvas):
 def __init__(self, parent):
 fig = Figure()
 self.axes = fig.add_subplot(111)
 range = xrange(1)
 l = [ random.randint(-5, 5) for i in range ]
 self.axes.plot(range, l, drawstyle='steps')
 FigureCanvas.__init__(self, fig)
 self.setParent(parent)
 FigureCanvas.setSizePolicy(self,
QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
 FigureCanvas.updateGeometry(self)

 def resizeEvent(self, event):
 print 'scroll resize to',  event.size()
 FigureCanvas.resizeEvent(self, event)

 a = QtGui.QApplication(sys.argv)
 w = QtGui.QMainWindow()
 w.setCentralWidget(DiagramWidget(w))
 w.show()
 a.exec_()
 8-

 To see the problem undisturbed, you may remove the resizeEvent()
 functions.

 Best regards

 Ole


--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] updating changed diagram?

2009-06-10 Thread Ole Streicher
Hi,

I want to change the value of a line in an axes. What I tried is

myline = axes.plot(...)

xdata, ydata = myline.get_data()
for i in range(ydata.__len__()):
  ydata[i] += 50

to shift all y values up by 50.

But I dont see the change I made, even after a show(). How can I force
the diagram to show the changed value?

Regards

Ole


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] updating changed diagram?

2009-06-10 Thread Ole Streicher
Hi Mathias,

Matthias Michler matthiasmich...@gmx.net writes:
 you can reset the ydata using:
 ydata = myline.get_ydata()
 ydata += 50
 myline.set_ydata(ydata) # pass new data to line object
 Does this work for you?

Yes. Altough I dont understand why I have to set it again (the ydata
still belong to the curve)

Thanks,

Ole


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Removing picked line

2009-06-10 Thread Ole Streicher
Hi again,

when right-clicking on one or more lines in a plot, I want to present
the user a context menu where he can select to remove these lines.

Preferrably I want to do this not with a 'pick_event' connection but
with the (Qt) backend methods since the context menu should contain more
options (which shall be shown also when right-clicking on the diagram
background).

Unfortunately, I have no idea, how to do this. At first, I found only
the pick_event() which responds to a left mouse click. Is there a way to
get the Line2D instances that would be picked by specifying the mouse
position?

At second, if I have a Line2D instance: how can I remove it from the
axes?

Best regards

Ole


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing picked line

2009-06-10 Thread Ole Streicher
Hi John,

John Hunter jdh2...@gmail.com writes:
 If for some reason the built in pick_event is unsuitable, you can
 create your own matplotlib.backend_bases.MouseEvent and call
 line.contains(event) for each line you want to hit test.

Thank you, that works for me. But for some reason, the y coordinate is
inversed in Qt and matplotlib? I have to specify

def get_lines_at_point(self, point):
mpl_event = MouseEvent('button_press_event', self, 
   point.x(), self.height() - point.y())
  #
ret = [ ]
for line in self.axes.get_lines():
picked, details = line.contains(mpl_event)
if picked:
ret.append(line)
return ret

The other question that now remains is: how can I remove a line from an
axes?

Best regards

Ole


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing picked line

2009-06-10 Thread Ole Streicher
Hi John,

John Hunter jdh2...@gmail.com writes:
 On Wed, Jun 10, 2009 at 9:11 AM, John Hunterjdh2...@gmail.com wrote:
  ax.lines.remove(someline)
  fig.canvas.draw()
 See also
 http://matplotlib.sourceforge.net/users/artists.html

Thank you very much, this helped a lot. (the manpages to artists and
axes are a bit complicated to use since they are far too long)

Best regards

Ole


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] qt4: Transforming to display coordinates

2009-06-04 Thread Ole Streicher
Hi,

I want to implement a cursor on a diagram using native Qt routines. For
this, I would need to transform data (axis) coordinates to display
coordinates.

The manual of matplotlib, API axes just jays that there are some
public attributes 'transData' and 'transAxis', but without an
explanation.

So, if I have something like

class DiagramWidget(FigureCanvas):
def __init__(self, parent):
fig = Figure()
self.axes = fig.add_subplot(111)
self.xlimits = (0, 4000)
FigureCanvas.__init__(self, fig)
self.setParent(parent)
self.mpl_connect('motion_notify_event', self.on_move)

def on_move(self, event)
mouse_pos_diag_x = ???(event.xdata)
mouse_pos_diag_y = ???(event.ydata)
lower_limit_diag_y = ???
upper_limit_diag_y = ???
...

where I would need to replace the ??? with some transformation from
event.xdata, event.ydata, and the min and max of the y axis. How could I
do that?

Cheers 

Ole


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Get coordinates at moouse position

2009-06-04 Thread Ole Streicher
Hi again,

when I scroll or zoom with the mouse wheel, the scaling of the x and y
axes are changed within the event. I would need now the new value of
these to update the status bar. How can I get them without waiting for a
new mouse event?

Cheers

Ole


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] qt4: Transforming to display coordinates

2009-06-04 Thread Ole Streicher
Hi John,

thank you four your helpful answer.

John Hunter jdh2...@gmail.com writes:
 On Thu, Jun 4, 2009 at 8:49 AM, Ole Streicher ole-usenet-s...@gmx.net wrote:
def on_move(self, event)
mouse_pos_diag_x = ???(event.xdata)
mouse_pos_diag_y = ???(event.ydata)
 where I would need to replace the ??? with some transformation from
 event.xdata, event.ydata, and the min and max of the y axis. How could I
 do that?

 The mouse event object already has display coords attached in the
 event.x and event.y attributes. 

My example was a bit simplified. What I want to do is to connect several
diagrams to show the same cursor. For the diagram with the mouse in it,
I can get ofcourse pixel coordinates, too. But for all other diagrams I
need to convert the cursor position to pixel coordinates.

 But to answer your question about matplotlib transforms.  You could do
   ax = event.inaxes   # the axes the event occurred in
   x, y = ax.transData.transform_point((event.xdata, event.ydata))

This is exactly what I need. Does the reverse transformation also exist?

Cheers

Ole


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Get coordinates at moouse position

2009-06-04 Thread Ole Streicher
Hi John,

John Hunter jdh2...@gmail.com writes:
 On Thu, Jun 4, 2009 at 9:00 AM, Ole Streicher ole-usenet-s...@gmx.net wrote:
 when I scroll or zoom with the mouse wheel, the scaling of the x and y
 axes are changed within the event. I would need now the new value of
 these to update the status bar. How can I get them without waiting for a
 new mouse event?

 Not sure I understand the question...  Could you be more specific,
 maybe post a code sample?

The point is that there may occure changes in the diagram axes that are
not connected to a mouse event. Example: I use the Qt backend, and
defined an QAction zoom in connected to the Ctrl-+ key.

At the same time, the status bar of my application shows the position of
the mouse in the diagram. Usually, the updates of the position is
connected to the motion_notify_event which returns the mouse position
on change.

When the mouse is not moved, but the zoom in action is triggered (via
hotkey in this example), I would need to update the status bar so that
it shows the coordinated that are under the mouse cursor *after* the
zoom was applied. 

Does this make my problem better understandable?

Cheers

Ole


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] button_press_event: Key presses not recognized?

2009-06-03 Thread Ole Streicher
Hi again,

I have another problem: I try to connect Control + mouse drag to some
zoom event. On mouse press, I need to check whether the Ctrol key is
pressed:

8
import random
import sys

from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure,SubplotParams

class InnerDiagramWidget(FigureCanvas):
def __init__(self, parent):
fig = Figure()
fig.add_subplot(111)
FigureCanvas.__init__(self, fig)
self.setParent(parent)
self.mpl_connect('button_press_event', self.on_button_press)

def on_button_press(self, event):
print event.key, event.button, event.xdata
if event.key == 'control':
print 'This should start the zoom but never happens'

a = QtGui.QApplication(sys.argv)
w = QtGui.QMainWindow()
w.setCentralWidget(InnerDiagramWidget(w))
w.show()
a.exec_()
8

The key returned here is always None. Why??? The API
(matplotlib.backend_bases.MouseEvent) says that it should return
control?

$ uname -a
Linux myos 2.6.27.21-0.1-default #1 SMP 2009-03-31 14:50:44 +0200 x86_64 x86_64 
x86_64 GNU/Linux

$ python -c import matplotlib; print matplotlib.__version__
0.98.5.2

I guess this is a bug in matplotlib? Can one confirm that?

Best regards

Ole


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Strange resize behaviour for qt backend

2009-05-29 Thread Ole Streicher
Hallo Theodore,

Drain, Theodore R
theodore.r.dr...@jpl.nasa.gov writes:
 Remember, this is not a multi-threaded system.  You can't receive a
 second repaint event while the drawing code is happening because the
 event loop is not in a separate thread.  

This is not my choice. If the user resizes the window, the events are created
in that manner. 

And I cannot prevent the user from resizing the window.

Best regards

Ole


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Strange resize behaviour for qt backend

2009-05-27 Thread Ole Streicher
Hi,

I am using matplotlib for some data vizualization. To ensure a
consistent user interface among the whole application, I do the
scrolling/zooming stuff myself. So, for a diagram, a horizontal
scrollbar is displayed below the diagram that enabled to shift along the
x axis. This is (part of) the code:

8---
from PyQt4 import QtGui, QtCore
from matplotlib.figure import Figure,SubplotParams

class DiagramWidget(QtGui.QWidget):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
layout = QtGui.QVBoxLayout(self)
self.diagram = InnerDiagramWidget(self)
self.scrollbar = QtGui.QScrollBar(QtCore.Qt.Horizontal, self)
self.connect(self.scrollbar, QtCore.SIGNAL('valueChanged(int)'),
 self.diagram.scroll_event)
layout.addWidget(self.diagram)
layout.addWidget(self.scrollbar)
# ...

class InnerDiagramWidget(FigureCanvas):
def __init__(self, parent):
fig = Figure(facecolor = 'w', 
 subplotpars = SubplotParams(left = 0.08, right=0.96, 
 bottom = 0.1, top=0.98))
self.axes = fig.add_subplot(111)
FigureCanvas.__init__(self, fig)
FigureCanvas.setParent(self, parent)
FigureCanvas.setSizePolicy(self,
   QtGui.QSizePolicy.Expanding,
   QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)

def scroll_event(self, x):
pass # here is real code ofcourse
# ...
8---

However, when I put this DiagramWidget into a window and try to resize
it vertically by mouse (with some data ... about 4000 points), the
scrollbar is not alwas shown correctly.

One can see that the diagram widget size does not change with every mouse
move, and the scrollbar sometimes goes out of the visible window, where
it is unusable.

The similar occurres in the horizontal direction: sometimes the
scrollbar gets not updated properly. This is the case when the Figure
canvas takes a long time for update.

If I put the scrollbar on top of the widget, everything is fine, except
that is the wrong place for a scrollbar :-)

Is this a bug in FigureCanvas, in Qt or in my code? How can I debug and
solve this?

Best regards

Ole


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users