Ich fand endlich Zeit, einige Experimente durchzuführen, um den Unterschied zwischen ihnen zu verstehen. Folgendes habe ich entdeckt:
logerlaubt nur positive Werte und lässt Sie wählen, wie mit negativen ( maskoder clip) umgegangen werden soll .
symlogbedeutet symmetrisches Protokoll und erlaubt positive und negative Werte.
symlog Ermöglicht das Festlegen eines Bereichs um Null innerhalb des Diagramms. Dies ist linear statt logarithmisch.
Ich denke, mit Grafiken und Beispielen wird alles viel einfacher zu verstehen sein. Probieren wir sie also aus:
import numpy
from matplotlib import pyplot
# Enable interactive mode
pyplot.ion()
# Draw the grid lines
pyplot.grid(True)
# Numbers from -50 to 50, with 0.1 as step
xdomain = numpy.arange(-50,50, 0.1)
# Plots a simple linear function 'f(x) = x'
pyplot.plot(xdomain, xdomain)
# Plots 'sin(x)'
pyplot.plot(xdomain, numpy.sin(xdomain))
# 'linear' is the default mode, so this next line is redundant:
pyplot.xscale('linear')

# How to treat negative values?
# 'mask' will treat negative values as invalid
# 'mask' is the default, so the next two lines are equivalent
pyplot.xscale('log')
pyplot.xscale('log', nonposx='mask')

# 'clip' will map all negative values a very small positive one
pyplot.xscale('log', nonposx='clip')

# 'symlog' scaling, however, handles negative values nicely
pyplot.xscale('symlog')

# And you can even set a linear range around zero
pyplot.xscale('symlog', linthreshx=20)

Der Vollständigkeit halber habe ich den folgenden Code verwendet, um jede Figur zu speichern:
# Default dpi is 80
pyplot.savefig('matplotlib_xscale_linear.png', dpi=50, bbox_inches='tight')
Denken Sie daran, dass Sie die Figurengröße ändern können, indem Sie:
fig = pyplot.gcf()
fig.set_size_inches([4., 3.])
# Default size: [8., 6.]
(Wenn Sie sich nicht sicher sind, ob ich meine eigene Frage beantworte, lesen Sie dies )