Perhaps I should clarify seeing no responses yet. The key part I'm confused 
about is if it is possible to reference graphs across classes. In my class 
KinemWidget I have the following lines: 

          self.p1.setXLink(self.p2) 
          thermo=ThermoWidget() 
          self.p2.setXLink(thermo.p6)

The first line should be straightforward in that I am linking the x-axis of 
the first graph to the second graph. However, I would also like to link the 
x-axis of both of those graphs to a graph in another class (line 3). Is 
this possible? If so is that the correct syntax to accomplish that?

If it is not possible to xlink across classes, is there another creative 
way to xlink plots in two different tabs?


On Monday, July 11, 2016 at 6:01:05 PM UTC-5, Alex Schueth wrote:
>
> I am using the DockArea() functionality in pyqtgraph to plot different 
> graphs on different tabs. I am currently have all of the graphs on one dock 
> xlinked, however I would like to extend that functionality to the other 
> dock so all of the plots are xlinked. Is this possible? Here is a snippet 
> of my code to show what I am trying, but it doesn't seem to be working.
>
> class ThermoWidget(pg.GraphicsLayoutWidget):
>      def __init__(self,*args, **kwargs): 
>           super(ThermoWidget, self).__init__(*args, **kwargs) 
>
>           self.p1 = self.addPlot(axisItems = {'bottom': CAxisTime(
> orientation='bottom')}) 
>           self.p2 = self.addPlot(axisItems = {'bottom': CAxisTime(
> orientation='bottom')}) 
>
>           self.curve1 = self.p1.plot() 
>           self.curve2 = self.p2.plot() 
>
>           self.nextRow() 
>
>           self.p3 = self.addPlot(axisItems = {'bottom': CAxisTime(
> orientation='bottom')}) 
>           self.p4 = self.addPlot(axisItems = {'bottom': CAxisTime(
> orientation='bottom')}) 
>
>           self.curve3 = self.p3.plot() 
>           self.curve4 = self.p4.plot() 
>
>           self.nextRow() 
>
>           self.p5 = self.addPlot(axisItems = {'bottom': CAxisTime(
> orientation='bottom')}) 
>           self.p6 = self.addPlot(axisItems = {'bottom': CAxisTime(
> orientation='bottom')}) 
>
>           self.curve5 = self.p5.plot() 
>           self.curve6 = self.p6.plot() 
>
>           self.p1.setXLink(self.p2) 
>           self.p2.setXLink(self.p3) 
>           self.p3.setXLink(self.p4) 
>           self.p4.setXLink(self.p5) 
>           self.p5.setXLink(self.p6) 
>
>      def plot(self, data): 
>
>           self.curve1.setData(data) 
>           self.curve2.setData(data) 
>           self.curve3.setData(data) 
>           self.curve4.setData(data) 
>           self.curve5.setData(data) 
>           self.curve6.setData(data) 
>
>           pg.QtGui.QApplication.processEvents() 
>
>
> class KinemWidget(pg.GraphicsLayoutWidget): 
>      def __init__(self,*args, **kwargs): 
>           super(KinemWidget, self).__init__(*args, **kwargs) 
>
>           self.p1 = self.addPlot(axisItems = {'bottom': CAxisTime(
> orientation='bottom')}) 
>           self.p2 = self.addPlot(axisItems = {'bottom': CAxisTime(
> orientation='bottom')}) 
>
>           self.curve1 = self.p1.plot() 
>           self.curve2 = self.p2.plot() 
>
>           self.p1.setXLink(self.p2) 
>           thermo=ThermoWidget() 
>           self.p2.setXLink(thermo.p6) 
>
>
>      def plot(self, data): 
>
>           self.curve1.setData(data) 
>           self.curve2.setData(data) 
>           pg.QtGui.QApplication.processEvents()
>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/41ecee7a-f970-4464-81d9-11008b641ab5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to