@@ -1099,20 +1099,19 @@ def displayDataByName(self, name=None, is_data=True, id=None):
10991099 # Residuals get their own plot
11001100 if plot .plot_role in [DataRole .ROLE_RESIDUAL , DataRole .ROLE_STAND_ALONE ]:
11011101 plot .yscale = 'linear'
1102- self .plotData ([(item , plot )])
1102+ self .plotData ([(item , plot )], id )
11031103 else :
11041104 new_plots .append ((item , plot ))
11051105
11061106 if new_plots :
1107- self .plotData (new_plots )
1107+ self .plotData (new_plots , id )
11081108
1109- def displayData (self , data_list , id = None ):
1109+ def displayData (self , data_list , id ):
11101110 """
11111111 Forces display of charts for the given data set
11121112 """
1113- # data_list = [QStandardItem, [Axes] Data1D/Data2D]
1114- plots_to_show = data_list [2 :]
1115- tpw_ax = data_list [1 ]
1113+ # data_list = [QStandardItem, Data1D/Data2D]
1114+ plots_to_show = data_list [1 :]
11161115 plot_item = data_list [0 ]
11171116
11181117 # plots to show
@@ -1133,7 +1132,7 @@ def displayData(self, data_list, id=None):
11331132 if self .isPlotShown (main_data ):
11341133 self .active_plots [main_data .name ].showNormal ()
11351134 else :
1136- self .plotData ([(plot_item , tpw_ax , main_data )])
1135+ self .plotData ([(plot_item , main_data )], id )
11371136
11381137 append = False
11391138 plot_to_append_to = None
@@ -1159,7 +1158,7 @@ def displayData(self, data_list, id=None):
11591158 continue
11601159 elif role in stand_alone_types :
11611160 # Stand-alone plots should always be separate
1162- self .plotData ([(plot_item , tpw_ax , plot_to_show )])
1161+ self .plotData ([(plot_item , plot_to_show )], id )
11631162 elif append :
11641163 # Assume all other plots sent together should be on the same chart if a previous plot exists
11651164 if not plot_to_append_to :
@@ -1177,8 +1176,8 @@ def displayData(self, data_list, id=None):
11771176 and not isinstance (main_data , Data2D )
11781177 and role != DataRole .ROLE_SIZE_DISTRIBUTION
11791178 ):
1180- new_plots .append ((plot_item , tpw_ax , main_data ))
1181- new_plots .append ((plot_item , tpw_ax , plot_to_show ))
1179+ new_plots .append ((plot_item , main_data ))
1180+ new_plots .append ((plot_item , plot_to_show ))
11821181
11831182 if append :
11841183 # Append any plots handled in loop before an existing plot was found
@@ -1188,7 +1187,7 @@ def displayData(self, data_list, id=None):
11881187 new_plots = []
11891188
11901189 if new_plots :
1191- self .plotData (new_plots )
1190+ self .plotData (new_plots , id )
11921191
11931192 self .parent .tabbedPlotWidget .show_or_activate ()
11941193
@@ -1226,18 +1225,22 @@ def addDataPlot2D(self, plot_set, item):
12261225 # sv.show()
12271226 # ============================================
12281227
1229- def plotData (self , plots , transform = True ):
1228+ def plotData (self , plots , tab_id , transform = True ):
12301229 """
12311230 Takes 1D/2D data and generates a single plot (1D) or multiple plots (2D)
12321231 """
1232+ tab_index = self .parent .tabbedPlotWidget .tab_fitpage_dict [tab_id ]
1233+ print ("plotData" )
12331234 # Call show on requested plots
12341235 # All same-type charts in one plot
1235- for item , tpw_ax , plot_set in plots :
1236+ for item , plot_set in plots :
12361237 if isinstance (plot_set , Data1D ):
12371238 if 'new_plot' not in locals ():
12381239 # Create only one PlotterWidget(QWidget) for a number of datasets that are supposed to be shown in
12391240 # the same Widget
1240- print ("created PlotterWidget for:" , item )
1241+ self .parent .tabbedPlotWidget .widget (tab_index ).add_more_axes ()
1242+ tpw_ax = self .parent .tabbedPlotWidget .widget (tab_index ).last_axes ()
1243+
12411244 new_plot = PlotterWidget (manager = self , parent = self , tpw_ax = tpw_ax )
12421245 new_plot .item = item
12431246 # Ensure new plots use the default transform, not the transform of any previous plots the data were in
@@ -1264,7 +1267,6 @@ def plotData(self, plots, transform=True):
12641267 msg = "Incorrect data type passed to Plotting"
12651268 raise AttributeError (msg )
12661269
1267- print ("from DataExplorer.plotData: self.active_plots" , self .active_plots )
12681270
12691271 if 'new_plot' in locals () and \
12701272 hasattr (new_plot , 'data' ) and \
@@ -1340,6 +1342,7 @@ def appendPlot(self):
13401342 @staticmethod
13411343 def appendOrUpdatePlot (self , data , plot ):
13421344 name = data .name
1345+ print ("append or update plot" )
13431346 if isinstance (plot , Plotter2DWidget ) or name in plot .plot_dict .keys ():
13441347 plot .replacePlot (name , data )
13451348 else :
0 commit comments