Skip to content

Commit

Permalink
Remove use of local variable in data plotting routine
Browse files Browse the repository at this point in the history
  • Loading branch information
krzywon committed Dec 3, 2024
1 parent 66a1a77 commit a1532a7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/sas/qtgui/MainWindow/DataExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,10 +1199,11 @@ def plotData(self, plots, transform=True):
"""
# Call show on requested plots
# All same-type charts in one plot
new_plot = PlotterWidget(manager=self, parent=self)
new_plot.item = None
for item, plot_set in plots:
if isinstance(plot_set, Data1D):
if 'new_plot' not in locals():
new_plot = PlotterWidget(manager=self, parent=self)
if not new_plot.item:
new_plot.item = item
# Ensure new plots use the default transform, not the transform of any previous plots
new_plot.plot(plot_set, transform=transform)
Expand All @@ -1214,9 +1215,7 @@ def plotData(self, plots, transform=True):
msg = "Incorrect data type passed to Plotting"
raise AttributeError(msg)

if 'new_plot' in locals() and \
hasattr(new_plot, 'data') and \
isinstance(new_plot.data[0], Data1D):
if hasattr(new_plot, 'data') and isinstance(new_plot.data[0], Data1D):
self.addPlot(new_plot)

def newPlot(self):
Expand Down

0 comments on commit a1532a7

Please sign in to comment.