[Matplotlib-users] symlog iffy when range max is below 1e0=1

Liang Wang frank0734 at gmail.com
Tue Sep 22 23:45:49 EDT 2020


Hi,

I have a problem using 'symlog' when the range maximum is below 1e0=1.
Perhaps I'm misusing it, possibly the linthresh option.

Example notebook:
https://gist.github.com/liangwang0734/fde9a033c3d8788075589e2f9fd87f0c

Sample code:
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

def test(start):
    linthresh = 10**(start+1)
    tmp = np.logspace(start, start + 3, 20)
    tmp = np.hstack((-tmp[::-1], tmp))

    fig, ax = plt.subplots()
    ax.plot(tmp, marker='o')
    ax.set_yscale('symlog', linthresh=linthresh)
    ax1 = ax.twinx()
    ax1.plot(tmp, c='orange', ls='--')

test(0)  # OK, linear scale and symlog scale look different
test(-3) # iffy, linear scale and symlog scale look the same

[image: image.png]

[image: image.png]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20200922/9b3edba3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 14506 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20200922/9b3edba3/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 11299 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20200922/9b3edba3/attachment-0003.png>


More information about the Matplotlib-users mailing list