Plot Zoom Functionality

721 views
Skip to first unread message

Matt Muckle

unread,
Feb 27, 2014, 1:46:57 PM2/27/14
to pyqt...@googlegroups.com
I am using pyqtgraph in a piece of software and had a question or two on the zoom functionality.

The default option in the plot is the 3 button mouse control where you click hold and drag to zoom in and out/pan.  While I personally like this method, it is not intuitive for a new user used to operating scientific plotting software such as originlab, sigmaplot and matplotlib.

I have two stages I wanted to go through to accomplish this:

1. Activate the 1 button mouse mode.  This accomplishes a normal zoom feature, but I was curious if there is any method in place currently to "step" forward and backward zoom levels (i.e. if you zoom in twice, step back to the 1st zoom not the full view)?

2. I would actually like to implement more of a matplotlib method of clicking and selecting a zoom button.  How would i turn off the normal mouse interaction to the screen unless these buttons are selected? 

Luke Campagnola

unread,
Feb 27, 2014, 2:05:58 PM2/27/14
to pyqt...@googlegroups.com
On Thu, Feb 27, 2014 at 1:46 PM, Matt Muckle <diracde...@gmail.com> wrote:
I am using pyqtgraph in a piece of software and had a question or two on the zoom functionality.

The default option in the plot is the 3 button mouse control where you click hold and drag to zoom in and out/pan.  While I personally like this method, it is not intuitive for a new user used to operating scientific plotting software such as originlab, sigmaplot and matplotlib.

I have two stages I wanted to go through to accomplish this:

1. Activate the 1 button mouse mode.  This accomplishes a normal zoom feature, but I was curious if there is any method in place currently to "step" forward and backward zoom levels (i.e. if you zoom in twice, step back to the 1st zoom not the full view)?

There exists a little-known feature that is supposed to do exactly what you want: ViewBox.scaleHistory(n), where n is -1 to go back a step, 1 to go forward, etc.  I have not used this in years, but it appears to be still functional :)   Let me know if it needs work..
 

2. I would actually like to implement more of a matplotlib method of clicking and selecting a zoom button.  How would i turn off the normal mouse interaction to the screen unless these buttons are selected? 

Reply all
Reply to author
Forward
0 new messages