Skip to content

Trying to set_ylim(bottom=0) on a log scaled axis changes plot #7733

Description

@dstansby
import matplotlib.pyplot as plt

fig, axs = plt.subplots(2, 1)

axs[0].scatter(range(0, 4), [0, 1, 2, 3])
axs[1].scatter(range(0, 4), [0, 1, 2, 3])

axs[0].set_yscale('log')
axs[1].set_yscale('log')

axs[1].set_ylim(bottom=0)

plt.show()

This raises

/home/dstansby/matplotlib/lib/matplotlib/axes/_base.py:3174: UserWarning: Attempted to set non-positive ylimits for log-scale axis; invalid limits will be ignored.
  'Attempted to set non-positive ylimits for log-scale axis; '

However, the 2nd plot is changed by the set_ylim(bottom=0) call, and no data is visible.

figure_1

This is present on master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions