Repository: silx-kit/silx
Issue: [plot] Right axis handling

Something has changed in current master. With silx0.8.0 and 0.9.0 taking a derivative with PyMca shows the derivative on the plot. With silx 0.10.0 the right axis is set but the curve is not seen. Most likely the right axis curve is hidden under the plot.

Changed files:
silx/gui/plot/backends/BackendMatplotlib.py

diff --git a/silx/gui/plot/backends/BackendMatplotlib.py b/silx/gui/plot/backends/BackendMatplotlib.py
index a79e6cdd5..726a83918 100644
--- a/silx/gui/plot/backends/BackendMatplotlib.py
+++ b/silx/gui/plot/backends/BackendMatplotlib.py
@@ -292,6 +292,8 @@ class BackendMatplotlib(BackendBase.BackendBase):
         self.ax = self.fig.add_axes([.15, .15, .75, .75], label="left")
         self.ax2 = self.ax.twinx()
         self.ax2.set_label("right")
+        # Make sure background of Axes is displayed
+        self.ax2.patch.set_visible(True)
 
         # disable the use of offsets
         try:
@@ -964,12 +966,12 @@ class BackendMatplotlib(BackendBase.BackendBase):
         else:
             dataBackgroundColor = backgroundColor
 
-        if self.ax.axison:
+        if self.ax2.axison:
             self.fig.patch.set_facecolor(backgroundColor)
             if self._matplotlibVersion < _parse_version('2'):
-                self.ax.set_axis_bgcolor(dataBackgroundColor)
+                self.ax2.set_axis_bgcolor(dataBackgroundColor)
             else:
-                self.ax.set_facecolor(dataBackgroundColor)
+                self.ax2.set_facecolor(dataBackgroundColor)
         else:
             self.fig.patch.set_facecolor(dataBackgroundColor)
 
@@ -982,23 +984,24 @@ class BackendMatplotlib(BackendBase.BackendBase):
         else:
             gridColor = foregroundColor
 
-        if self.ax.axison:
-            self.ax.spines['bottom'].set_color(foregroundColor)
-            self.ax.spines['top'].set_color(foregroundColor)
-            self.ax.spines['right'].set_color(foregroundColor)
-            self.ax.spines['left'].set_color(foregroundColor)
-            self.ax.tick_params(axis='x', colors=foregroundColor)
-            self.ax.tick_params(axis='y', colors=foregroundColor)
-            self.ax.yaxis.label.set_color(foregroundColor)
-            self.ax.xaxis.label.set_color(foregroundColor)
-            self.ax.title.set_color(foregroundColor)
-
-            for line in self.ax.get_xgridlines():
-                line.set_color(gridColor)
-
-            for line in self.ax.get_ygridlines():
-                line.set_color(gridColor)
-            # self.ax.grid().set_markeredgecolor(gridColor)
+        for axes in (self.ax, self.ax2):
+            if axes.axison:
+                axes.spines['bottom'].set_color(foregroundColor)
+                axes.spines['top'].set_color(foregroundColor)
+                axes.spines['right'].set_color(foregroundColor)
+                axes.spines['left'].set_color(foregroundColor)
+                axes.tick_params(axis='x', colors=foregroundColor)
+                axes.tick_params(axis='y', colors=foregroundColor)
+                axes.yaxis.label.set_color(foregroundColor)
+                axes.xaxis.label.set_color(foregroundColor)
+                axes.title.set_color(foregroundColor)
+
+                for line in axes.get_xgridlines():
+                    line.set_color(gridColor)
+
+                for line in axes.get_ygridlines():
+                    line.set_color(gridColor)
+                # axes.grid().set_markeredgecolor(gridColor)
 
 
 class BackendMatplotlibQt(FigureCanvasQTAgg, BackendMatplotlib):