Repository: pyqtgraph/pyqtgraph

Issue:
SI prefix does not work for log axis
It looks like there is a bug with the AutoSIPrefix functionality on an axis with Log mode enabled. 

The problem can be demonstrated with the following code: 
``` python
import sys

from PyQt5 import QtWidgets
from pyqtgraph import PlotWidget

app = QtWidgets.QApplication(sys.argv)

# noinspection PyArgumentList
container_widget = QtWidgets.QWidget()

# Normal plot without SI units
log0_si0_plot_widget = PlotWidget(container_widget)
log0_si0_plot = log0_si0_plot_widget.getPlotItem()
log0_si0_plot.showGrid(x=True, y=True)
log0_si0_plot.setLogMode(x=False, y=False)
log0_si0_plot.setLabel('left', 'Y')
log0_si0_plot.getAxis('left').enableAutoSIPrefix(False)
log0_si0_plot.setLabel('bottom', 'X')
log0_si0_plot.getAxis('bottom').enableAutoSIPrefix(False)
log0_si0_plot.setTitle('Normal plot without SI units')

# Normal plot with SI units
log0_si1_plot_widget = PlotWidget(container_widget)
log0_si1_plot = log0_si1_plot_widget.getPlotItem()
log0_si1_plot.showGrid(x=True, y=True)
log0_si1_plot.setLogMode(x=False, y=False)
log0_si1_plot.setLabel('left', 'Y', units='Y')
log0_si1_plot.getAxis('left').enableAutoSIPrefix(True)
log0_si1_plot.setLabel('bottom', 'X', units='X')
log0_si1_plot.getAxis('bottom').enableAutoSIPrefix(True)
log0_si1_plot.setTitle('Normal plot with SI units')

# Log plot without SI units
log1_si0_plot_widget = PlotWidget(container_widget)
log1_si0_plot = log1_si0_plot_widget.getPlotItem()
log1_si0_plot.showGrid(x=True, y=True)
log1_si0_plot.setLogMode(x=True, y=True)
log1_si0_plot.setLabel('left', 'Log Y', units='Y')
log1_si0_plot.getAxis('left').enableAutoSIPrefix(False)
log1_si0_plot.setLabel('bottom', 'Log X', units='X')
log1_si0_plot.getAxis('bottom').enableAutoSIPrefix(False)
log1_si0_plot.setTitle('Log plot without SI units')

# Log plot with SI units
log1_si1_plot_widget = PlotWidget(container_widget)
log1_si1_plot = log1_si1_plot_widget.getPlotItem()
log1_si1_plot.showGrid(x=True, y=True)
log1_si1_plot.setLogMode(x=True, y=True)
log1_si1_plot.setLabel('left', 'Log Y', units='Y')
log1_si1_plot.getAxis('left').enableAutoSIPrefix(True)
log1_si1_plot.setLabel('bottom', 'Log X', units='X')
log1_si1_plot.getAxis('bottom').enableAutoSIPrefix(True)
log1_si1_plot.setTitle('Log plot with SI units')

grid_layout = QtWidgets.QGridLayout()
# noinspection PyArgumentList
grid_layout.addWidget(log0_si0_plot_widget, 0, 0, 1, 1)
# noinspection PyArgumentList
grid_layout.addWidget(log0_si1_plot_widget, 0, 1, 1, 1)
# noinspection PyArgumentList
grid_layout.addWidget(log1_si0_plot_widget, 1, 0, 1, 1)
# noinspection PyArgumentList
grid_layout.addWidget(log1_si1_plot_widget, 1, 1, 1, 1)
container_widget.setLayout(grid_layout)

x = [0.001 * (x_ + 1) for x_ in range(7)]
y = [0.00001 * (x_ + 1) for x_ in range(7)]

log0_si0_plot.plot().setData(x=x, y=y)
log0_si1_plot.plot().setData(x=x, y=y)
log1_si0_plot.plot().setData(x=x, y=y)
log1_si1_plot.plot().setData(x=x, y=y)

container_widget.resize(1000, 600)
container_widget.show()
sys.exit(app.exec_())

```
This code generated the following image. 

![image](https://user-images.githubusercontent.com/34220817/52454821-30ca3d00-2b02-11e9-9b06-c80737d21e3c.png)


Note the X and Y axis labels for bottom left plot (Log plot with SI units) are not using SI notation while the top right plot (Normal plot with SI units) shows the correct SI labels.  

The problem has been reproduced on Win10 running Python 3.6.7, PyQt5 5.11.3, pyqtgraph 0.10.0


Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/AxisItem.py b/pyqtgraph/graphicsItems/AxisItem.py
--- a/pyqtgraph/graphicsItems/AxisItem.py
+++ b/pyqtgraph/graphicsItems/AxisItem.py
@@ -444,7 +444,11 @@ def enableAutoSIPrefix(self, enable=True):
 
     def updateAutoSIPrefix(self):
         if self.label.isVisible():
-            (scale, prefix) = fn.siScale(max(abs(self.range[0]*self.scale), abs(self.range[1]*self.scale)))
+            if self.logMode:
+                _range = 10**np.array(self.range)
+            else:
+                _range = self.range
+            (scale, prefix) = fn.siScale(max(abs(_range[0]*self.scale), abs(_range[1]*self.scale)))
             if self.labelUnits == '' and prefix in ['k', 'm']:  ## If we are not showing units, wait until 1e6 before scaling.
                 scale = 1.0
                 prefix = ''
@@ -771,7 +775,7 @@ def tickStrings(self, values, scale, spacing):
         return strings
 
     def logTickStrings(self, values, scale, spacing):
-        return ["%0.1g"%x for x in 10 ** np.array(values).astype(float)]
+        return ["%0.1g"%x for x in 10 ** np.array(values).astype(float) * np.array(scale)]
 
     def generateDrawSpecs(self, p):
         """


Test patch: