Hello,I would like to fix the axes of a plot to some values. I tried something like:for col in xrange( 4 ):l = ledLayout.getItem(0, col)for row in xrange( 3 ):a = l.getItem(row + 1, 0).getAxis( "left" )a.setRange(-1, 1200)a.linkToView(l.getItem(row + 1, 0).getViewBox())but this does not work. In this example, I have a grid layout, and my attempt was to fix y-axis to (-1, 1200). I would also like (expect) that auto-scale sets this range when it get's pressed.
Another question is about aspect ration of a plot -- e.g. no matter how I zoom in/out, that the ratio of axes stays the same. I would like to extend the above code so that both x- and y-axis have fixed range (-1, 1200).
--To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/d60780a4-227e-4cd7-8673-50071560a19b%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "pyqtgraph" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyqtgraph/sVcLiXJeUuE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyqtgraph+...@googlegroups.com.
Hi Luke,
Thanx a lot for the answer! :) setXRange and setYRange solved one of the problems. I tried also setAspectLocked( False ) but it did not help :( I called this method in an instance of PlotItem class. Maybe I was not so clear last time but my point was that if I set the same range for x and y axis, I would like to always see a square-sized plot on the screen no matter how the window that holds the plot is sized/shaped...
One another thing. Is it possible to configure the "A" button to scale to some predefined values? -- in my case the same values I set with setXRange and setYRange.... I tried to find something in the docs, but w/o success.
On Fri, Feb 14, 2014 at 11:18 AM, Milan Vukov <mvu...@gmail.com> wrote:
Hi Luke,
Thanx a lot for the answer! :) setXRange and setYRange solved one of the problems. I tried also setAspectLocked( False ) but it did not help :( I called this method in an instance of PlotItem class. Maybe I was not so clear last time but my point was that if I set the same range for x and y axis, I would like to always see a square-sized plot on the screen no matter how the window that holds the plot is sized/shaped...
Sorry for delaying on this. I think I understand the question, but I'm not sure. You want to constrain the axes such that, no matter how you zoom or resize the image, (Xmax-Xmin) == (Ymax-Ymin) ? I think the simplest way would be to override ViewBox.moseDragEvent such that, when dragging with the right mouse button, it always sees (dx == dy). Alternatively, you could disable zooming with the right mouse button and allow only zoom with the wheel, which I think already has the result you expect..
One another thing. Is it possible to configure the "A" button to scale to some predefined values? -- in my case the same values I set with setXRange and setYRange.... I tried to find something in the docs, but w/o success.
For this, just override PlotItem.autoBtnClicked() either by subclassing or monkey-patch.
--
You received this message because you are subscribed to a topic in the Google Groups "pyqtgraph" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyqtgraph/sVcLiXJeUuE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/CACZXET-QZ%3DQO08eDV9RMOAV5auvJ%2B5-Woasci%3Dq%3DNOdxpbRbDA%40mail.gmail.com.