Skip to content

[Bug]: ax.plot(x,y) disappears after changing y_scale #25124

Closed
@sterinaldi

Description

@sterinaldi

Bug summary

The output of ax.plot(x,y) disappears while changing y_scale from 'log' (initial scale for the y axis) to 'linear'.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

samples = np.random.normal(size = 1000)
x = np.linspace(-5,5,1000)
fig, ax = plt.subplots()
ax.hist(samples, log = True, density = True)
ax.plot(x, np.exp(-x**2/2)/np.sqrt(2*np.pi))
fig.savefig('log.pdf')
ax.set_yscale('linear')
fig.savefig('lin.pdf')

Actual outcome

lin.pdf
log.pdf

Expected outcome

lin.pdf
log.pdf

Additional information

The expected outcome is generated with matplotlib==3.5.3
fill_between and hist are working fine.

Operating system

MacOSX

Matplotlib Version

3.6.3

Matplotlib Backend

MacOSX

Python version

3.9.13

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions