From 7fef1c13e2b70460a57a7a575825bb1886ceeae4 Mon Sep 17 00:00:00 2001 From: rozyczko Date: Wed, 20 Sep 2023 18:54:28 +0200 Subject: [PATCH] Added grid lines on Plot1D, similar to those on QuickPlot --- src/sas/qtgui/Plotting/Plotter.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sas/qtgui/Plotting/Plotter.py b/src/sas/qtgui/Plotting/Plotter.py index de24f82f58..dc18d9b915 100644 --- a/src/sas/qtgui/Plotting/Plotter.py +++ b/src/sas/qtgui/Plotting/Plotter.py @@ -170,6 +170,9 @@ def plot(self, data=None, color=None, marker=None, hide_error=False, transform=T if color is None: color = data.custom_color + # grid on/off, stored on self + ax.grid(self.grid_on) + color = PlotUtilities.getValidColor(color) data.custom_color = color @@ -317,9 +320,11 @@ def createContextMenu(self): self.actionAddText = self.contextMenu.addAction("Add Text") self.actionRemoveText = self.contextMenu.addAction("Remove Text") self.contextMenu.addSeparator() + self.actionToggleGrid = self.contextMenu.addAction("Toggle Grid On/Off") if self.show_legend: self.actionToggleLegend = self.contextMenu.addAction("Toggle Legend") self.contextMenu.addSeparator() + # Additional actions self.actionCustomizeLabel = self.contextMenu.addAction("Customize Labels") self.contextMenu.addSeparator() self.actionChangeScale = self.contextMenu.addAction("Change Scale") @@ -339,6 +344,7 @@ def createContextMenu(self): self.actionRemoveText.triggered.connect(self.onRemoveText) self.actionChangeScale.triggered.connect(self.onScaleChange) self.actionSetGraphRange.triggered.connect(self.onSetGraphRange) + self.actionToggleGrid.triggered.connect(self.onGridToggle) self.actionResetGraphRange.triggered.connect(self.onResetGraphRange) self.actionWindowTitle.triggered.connect(self.onWindowsTitle) self.actionToggleMenu.triggered.connect(self.onToggleMenu)