Skip to content

linscalex/linscaley (for symlog) behaviour and documentation #10369

@gregcolyer

Description

@gregcolyer

According to the documentation linscalex/linscaley "is the number of decades to use for each half of the linear range." This may be correct for base 10* (incidentally the documentation does not specify that this is the default base) but with a general base b it seems not to be, nor for a 'b-ade' as opposed to a decade. Also, there is a natural value log(e)/log(b) for this scaling (relative to the 'b-ade') which makes the scale continuous at the threshold and hence does not introduce gradient jumps in smooth curves. This may be a better default than 1.

import matplotlib.pyplot as plt
import numpy as np

b = 2.  # Try 100. too
t = 1.

# Define some curves:
x = np.linspace(0.1,3.,100)
y1 = x
y2 = x**2
y3 = np.exp(x)/2.
y4 = np.log(x)*2.

plt.figure()

plt.subplot(1,3,1)
plt.title('base 10 default')
plt.ylim(-100,100)
plt.yscale('symlog',linthreshy=t)               # should set decade = half-linear
plt.plot(x,y1)
plt.plot(x,y2)
plt.plot(x,y3)
plt.plot(x,y4)

plt.subplot(1,3,2)
plt.title('base 10 smooth?')
plt.ylim(-100,100)
plt.yscale('symlog',linthreshy=t,linscaley=np.log10(np.e))      # smooth match?
plt.plot(x,y1)
plt.plot(x,y2)
plt.plot(x,y3)
plt.plot(x,y4)

plt.subplot(1,3,3)
plt.title('base %d default' % (b))
plt.ylim(-100,100)
plt.yscale('symlog',linthreshy=t,basey=b)       # doesn't set decade or b-ade = half-linear
plt.plot(x,y1)
plt.plot(x,y2)
plt.plot(x,y3)
plt.plot(x,y4)

plt.show()

Linux; matplotlib 2.0.0, python 2.7.12 via conda

*actually not; see below

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentationstatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy