8000 [Bug]: Setting `set_xscale("symlog")` has different behavior depending on value range · Issue #24549 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[Bug]: Setting set_xscale("symlog") has different behavior depending on value range #24549
Closed
@xapple

Description

@xapple

Bug summary

In this simple test I make two scatter plots. The first one has values drawn from a uniform distribution between 0 and 1000. The second plot is the same except that values are now drawn between 0 and 1 only.

Finally, I set set_xscale("symlog") and set_yscale("symlog") on both plots. The result is that the first plot responds correctly, while the second plot does not change, and the data points remain in the same linear display.

Code for reproduction

# Modules #
import random
from matplotlib import pyplot

# New graph #
fig, axes = pyplot.subplots()

# Constants #
upper_bound = 1.0 # try it with 1000.0 instead and it works

# Do it #
x = [random.uniform(0.0, upper_bound) for x in range(1000)]
y = [random.uniform(0.0, upper_bound) for x in range(1000)]
pyplot.plot(x, y, 'o')
axes.set_xscale("symlog")
axes.set_yscale("symlog")

Actual outcome

bug
With upper_bound = 1.0.

Expected outcome

expected
With upper_bound = 1000.0.

Additional information

This is quite a serious bug as it silently produces broken or miss-leading visualizations which then bias the interpretation of critical scientific data.

Operating system

macOS

Matplotlib Version

3.6.2

Matplotlib Backend

MacOSX

Python version

Python 3.10.8

Jupyter version

No response

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0