Discussion:
[pyqtgraph] How to link two PlotWidget windows to show the same plot.
Trifon Trifonov
2018-11-21 08:40:09 UTC
Permalink
Dear All,

First, sorry for the long post, but I feel you may need some introduction
to the problem.

I am developing an orbital analysis tool using PyQT5 and pyqtgraph!

See:
https://github.com/3fon3fonov/trifon

My tool has a plotting area with ~15 plots shown in different tab windows,
which show different aspects of the data analysis.

The tool it self is assembled with the Designer-qt5, while the QGraphicView
widgets are promoted to pyqtgraphs's PlotWidgets
global p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,pe
p1 = self.graphicsView_timeseries_RV
p2 = self.graphicsView_timeseries_RV_o_c
p3 = self.graphicsView_timeseries_phot
p4 = self.graphicsView_timeseries_phot_o_c
p5 = self.graphicsView_timeseries_activity
p6 = self.graphicsView_timeseries_correlations
....

....
pe = self.graphicsView_extra_plot
.....
.....
etc.
so p1-p6 in this case are different PlotWidget objects on which I add
Items/Plot data, i.e. p1.plot(x,y), p1.addItem(), etc.


What I want is to link pe to any of p1-p6!. pe is an extra plot so the user
can choose from those already available/created.
Thus the user can select which plot he/she wants to see next to the main
plot.

Lets imagine that the ComboBox dropdown menu selects between p1-p6
objects, so

pe = p1, or later:
pe = p4

for example.

Is there any way this to be done with PyQtgraph?


I really tried all kind things in the last two weeks and nothing seems to
work.


I am aware of the

pe.setXLink(p1)
pe.setYLink(p2)

but this only links the axes not the plot object itself. It doesn't work
for me.




I hope you guys are willing to help!


All the best,
Trifon
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/371ab2eb-68aa-422e-99f4-d884b5e5888b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mikhail Terekhov
2018-11-30 01:28:16 UTC
Permalink
Have you considered QStackedWidget?
Post by Trifon Trifonov
Dear All,
First, sorry for the long post, but I feel you may need some introduction to the problem.
I am developing an orbital analysis tool using PyQT5 and pyqtgraph!
https://github.com/3fon3fonov/trifon
My tool has a plotting area with ~15 plots shown in different tab windows, which show different aspects of the data analysis.
The tool it self is assembled with the Designer-qt5, while the QGraphicView widgets are promoted to pyqtgraphs's PlotWidgets
global p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,pe
p1 = self.graphicsView_timeseries_RV
p2 = self.graphicsView_timeseries_RV_o_c
p3 = self.graphicsView_timeseries_phot
p4 = self.graphicsView_timeseries_phot_o_c
p5 = self.graphicsView_timeseries_activity
p6 = self.graphicsView_timeseries_correlations
....
....
pe = self.graphicsView_extra_plot
.....
.....
etc.
so p1-p6 in this case are different PlotWidget objects on which I add Items/Plot data, i.e. p1.plot(x,y), p1.addItem(), etc.
What I want is to link pe to any of p1-p6!. pe is an extra plot so the user can choose from those already available/created.
Thus the user can select which plot he/she wants to see next to the main plot.
Lets imagine that the ComboBox dropdown menu selects between p1-p6 objects, so
pe = p4
for example.
Is there any way this to be done with PyQtgraph?
I really tried all kind things in the last two weeks and nothing seems to work.
I am aware of the
pe.setXLink(p1)
pe.setYLink(p2)
but this only links the axes not the plot object itself. It doesn't work for me.
I hope you guys are willing to help!
All the best,
Trifon
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/371ab2eb-68aa-422e-99f4-d884b5e5888b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Mikhail Terekhov
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/CALCsMPQ%3Dq3s1V%3DtTeKgs3ZT4Sm4pXkwhJhwOmEeArOE7vqZQbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Patrick
2018-11-30 02:55:39 UTC
Permalink
Hi,

I have some multi-dimensional data which I slice in four plot windows. I
link the required axes manually by connecting to a signal emitted by a
ViewBox when its range is changed.

Code snippet below, hopefully will get you on track.

# Link axes of plots
self.overview.setYLink(self.t1slice)
self.overview.setXLink(self.t2slice)
self.t1slice.getViewBox().sigRangeChangedManually.connect(self.
_link_waxes_t1slice)
self.t2slice.getViewBox().sigRangeChangedManually.connect(self.
_link_waxes_t2slice)
self.spectrum.getViewBox().sigRangeChangedManually.connect(self.
_link_waxes_spectrum)


# Slot functions to react and change range of linked plots
def _link_waxes_t1slice(self, something):
self.t2slice.setYRange(*self.t1slice.getViewBox().viewRange()[0])
self.spectrum.setXRange(*self.t1slice.getViewBox().viewRange()[0])


def _link_waxes_t2slice(self, something):
self.t1slice.setXRange(*self.t2slice.getViewBox().viewRange()[1])
self.spectrum.setXRange(*self.t2slice.getViewBox().viewRange()[1])


def _link_waxes_spectrum(self, something):
self.t1slice.setXRange(*self.spectrum.getViewBox().viewRange()[0])
self.t2slice.setYRange(*self.spectrum.getViewBox().viewRange()[0])

Patrick
Post by Trifon Trifonov
Dear All,
First, sorry for the long post, but I feel you may need some introduction
to the problem.
I am developing an orbital analysis tool using PyQT5 and pyqtgraph!
https://github.com/3fon3fonov/trifon
My tool has a plotting area with ~15 plots shown in different tab windows,
which show different aspects of the data analysis.
The tool it self is assembled with the Designer-qt5, while the
QGraphicView widgets are promoted to pyqtgraphs's PlotWidgets
global p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,pe
p1 = self.graphicsView_timeseries_RV
p2 = self.graphicsView_timeseries_RV_o_c
p3 = self.graphicsView_timeseries_phot
p4 = self.graphicsView_timeseries_phot_o_c
p5 = self.graphicsView_timeseries_activity
p6 = self.graphicsView_timeseries_correlations
....
....
pe = self.graphicsView_extra_plot
.....
.....
etc.
so p1-p6 in this case are different PlotWidget objects on which I add
Items/Plot data, i.e. p1.plot(x,y), p1.addItem(), etc.
What I want is to link pe to any of p1-p6!. pe is an extra plot so the
user can choose from those already available/created.
Thus the user can select which plot he/she wants to see next to the main
plot.
Lets imagine that the ComboBox dropdown menu selects between p1-p6
objects, so
pe = p4
for example.
Is there any way this to be done with PyQtgraph?
I really tried all kind things in the last two weeks and nothing seems to
work.
I am aware of the
pe.setXLink(p1)
pe.setYLink(p2)
but this only links the axes not the plot object itself. It doesn't work
for me.
I hope you guys are willing to help!
All the best,
Trifon
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/eca2eda3-83cd-41be-a293-148cd371170f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Trifon Trifonov
2018-12-02 21:09:40 UTC
Permalink
Thanks a lot!

I am a but busy these days but as soon as I get some chance I will try it
out and will report!

Trifon
Post by Patrick
Hi,
I have some multi-dimensional data which I slice in four plot windows. I
link the required axes manually by connecting to a signal emitted by a
ViewBox when its range is changed.
Code snippet below, hopefully will get you on track.
# Link axes of plots
self.overview.setYLink(self.t1slice)
self.overview.setXLink(self.t2slice)
self.t1slice.getViewBox().sigRangeChangedManually.connect(self.
_link_waxes_t1slice)
self.t2slice.getViewBox().sigRangeChangedManually.connect(self.
_link_waxes_t2slice)
self.spectrum.getViewBox().sigRangeChangedManually.connect(self.
_link_waxes_spectrum)
# Slot functions to react and change range of linked plots
self.t2slice.setYRange(*self.t1slice.getViewBox().viewRange()[0])
self.spectrum.setXRange(*self.t1slice.getViewBox().viewRange()[0])
self.t1slice.setXRange(*self.t2slice.getViewBox().viewRange()[1])
self.spectrum.setXRange(*self.t2slice.getViewBox().viewRange()[1])
self.t1slice.setXRange(*self.spectrum.getViewBox().viewRange()[0])
self.t2slice.setYRange(*self.spectrum.getViewBox().viewRange()[0])
Patrick
Post by Trifon Trifonov
Dear All,
First, sorry for the long post, but I feel you may need some introduction
to the problem.
I am developing an orbital analysis tool using PyQT5 and pyqtgraph!
https://github.com/3fon3fonov/trifon
My tool has a plotting area with ~15 plots shown in different tab
windows, which show different aspects of the data analysis.
The tool it self is assembled with the Designer-qt5, while the
QGraphicView widgets are promoted to pyqtgraphs's PlotWidgets
global p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,pe
p1 = self.graphicsView_timeseries_RV
p2 = self.graphicsView_timeseries_RV_o_c
p3 = self.graphicsView_timeseries_phot
p4 = self.graphicsView_timeseries_phot_o_c
p5 = self.graphicsView_timeseries_activity
p6 = self.graphicsView_timeseries_correlations
....
....
pe = self.graphicsView_extra_plot
.....
.....
etc.
so p1-p6 in this case are different PlotWidget objects on which I add
Items/Plot data, i.e. p1.plot(x,y), p1.addItem(), etc.
What I want is to link pe to any of p1-p6!. pe is an extra plot so the
user can choose from those already available/created.
Thus the user can select which plot he/she wants to see next to the main
plot.
Lets imagine that the ComboBox dropdown menu selects between p1-p6
objects, so
pe = p4
for example.
Is there any way this to be done with PyQtgraph?
I really tried all kind things in the last two weeks and nothing seems to
work.
I am aware of the
pe.setXLink(p1)
pe.setYLink(p2)
but this only links the axes not the plot object itself. It doesn't work
for me.
I hope you guys are willing to help!
All the best,
Trifon
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/eca2eda3-83cd-41be-a293-148cd371170f%40googlegroups.com
<https://groups.google.com/d/msgid/pyqtgraph/eca2eda3-83cd-41be-a293-148cd371170f%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/CAB9SVJ1Cp%3DXukVR3XSFp2x5PKfHXmwppfLLwjaXOnoeof2RCBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...