@@ -1076,20 +1076,19 @@ def displayDataByName(self, name=None, is_data=True, id=None):
10761076 # Residuals get their own plot
10771077 if plot .plot_role in [DataRole .ROLE_RESIDUAL , DataRole .ROLE_STAND_ALONE ]:
10781078 plot .yscale = 'linear'
1079- self .plotData ([(item , plot )])
1079+ self .plotData ([(item , plot )], id )
10801080 else :
10811081 new_plots .append ((item , plot ))
10821082
10831083 if new_plots :
1084- self .plotData (new_plots )
1084+ self .plotData (new_plots , id )
10851085
1086- def displayData (self , data_list , id = None ):
1086+ def displayData (self , data_list , id ):
10871087 """
10881088 Forces display of charts for the given data set
10891089 """
1090- # data_list = [QStandardItem, [Axes] Data1D/Data2D]
1091- plots_to_show = data_list [2 :]
1092- tpw_ax = data_list [1 ]
1090+ # data_list = [QStandardItem, Data1D/Data2D]
1091+ plots_to_show = data_list [1 :]
10931092 plot_item = data_list [0 ]
10941093
10951094 # plots to show
@@ -1110,7 +1109,7 @@ def displayData(self, data_list, id=None):
11101109 if self .isPlotShown (main_data ):
11111110 self .active_plots [main_data .name ].showNormal ()
11121111 else :
1113- self .plotData ([(plot_item , tpw_ax , main_data )])
1112+ self .plotData ([(plot_item , main_data )], id )
11141113
11151114 append = False
11161115 plot_to_append_to = None
@@ -1135,7 +1134,7 @@ def displayData(self, data_list, id=None):
11351134 continue
11361135 elif role in stand_alone_types :
11371136 # Stand-alone plots should always be separate
1138- self .plotData ([(plot_item , tpw_ax , plot_to_show )])
1137+ self .plotData ([(plot_item , plot_to_show )], id )
11391138 elif append :
11401139 # Assume all other plots sent together should be on the same chart if a previous plot exists
11411140 if not plot_to_append_to :
@@ -1146,8 +1145,8 @@ def displayData(self, data_list, id=None):
11461145 # Plots with main data points on the same chart
11471146 # Get the main data plot unless data is 2D which is plotted earlier
11481147 if main_data is not None and not isinstance (main_data , Data2D ):
1149- new_plots .append ((plot_item , tpw_ax , main_data ))
1150- new_plots .append ((plot_item , tpw_ax , plot_to_show ))
1148+ new_plots .append ((plot_item , main_data ))
1149+ new_plots .append ((plot_item , plot_to_show ))
11511150
11521151 if append :
11531152 # Append any plots handled in loop before an existing plot was found
@@ -1157,7 +1156,7 @@ def displayData(self, data_list, id=None):
11571156 new_plots = []
11581157
11591158 if new_plots :
1160- self .plotData (new_plots )
1159+ self .plotData (new_plots , id )
11611160
11621161 self .parent .tabbedPlotWidget .show_or_activate ()
11631162
@@ -1195,18 +1194,22 @@ def addDataPlot2D(self, plot_set, item):
11951194 # sv.show()
11961195 # ============================================
11971196
1198- def plotData (self , plots , transform = True ):
1197+ def plotData (self , plots , tab_id , transform = True ):
11991198 """
12001199 Takes 1D/2D data and generates a single plot (1D) or multiple plots (2D)
12011200 """
1201+ tab_index = self .parent .tabbedPlotWidget .tab_fitpage_dict [tab_id ]
1202+ print ("plotData" )
12021203 # Call show on requested plots
12031204 # All same-type charts in one plot
1204- for item , tpw_ax , plot_set in plots :
1205+ for item , plot_set in plots :
12051206 if isinstance (plot_set , Data1D ):
12061207 if 'new_plot' not in locals ():
12071208 # Create only one PlotterWidget(QWidget) for a number of datasets that are supposed to be shown in
12081209 # the same Widget
1209- print ("created PlotterWidget for:" , item )
1210+ self .parent .tabbedPlotWidget .widget (tab_index ).add_more_axes ()
1211+ tpw_ax = self .parent .tabbedPlotWidget .widget (tab_index ).last_axes ()
1212+
12101213 new_plot = PlotterWidget (manager = self , parent = self , tpw_ax = tpw_ax )
12111214 new_plot .item = item
12121215 print ("plotted plot for:" , item )
@@ -1219,7 +1222,6 @@ def plotData(self, plots, transform=True):
12191222 msg = "Incorrect data type passed to Plotting"
12201223 raise AttributeError (msg )
12211224
1222- print ("from DataExplorer.plotData: self.active_plots" , self .active_plots )
12231225
12241226 if 'new_plot' in locals () and \
12251227 hasattr (new_plot , 'data' ) and \
@@ -1295,6 +1297,7 @@ def appendPlot(self):
12951297 @staticmethod
12961298 def appendOrUpdatePlot (self , data , plot ):
12971299 name = data .name
1300+ print ("append or update plot" )
12981301 if isinstance (plot , Plotter2DWidget ) or name in plot .plot_dict .keys ():
12991302 plot .replacePlot (name , data )
13001303 else :
0 commit comments