Skip to content

Scatter plots with log scaling #15978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Phlya opened this issue Dec 19, 2019 · 2 comments
Closed

Scatter plots with log scaling #15978

Phlya opened this issue Dec 19, 2019 · 2 comments
Milestone

Comments

@Phlya
Copy link
Contributor

Phlya commented Dec 19, 2019

When using plt.scatter with log-scaled axes, order of calls is important: if axes are set to log scale before plt.scatter is called, margins of the plot are huge:

import matplotlib.pyplot as plt
import numpy as np
f, ax = plt.subplots()
ax.set_xscale('log')
ax.set_yscale('log')
ax.scatter(2**np.arange(10), 2**np.arange(10))

Actual outcome
image

Expected outcome
When plt.scatter is called before axes are set to log scale, it looks normal:

import matplotlib.pyplot as plt
import numpy as np
f, ax = plt.subplots()
ax.scatter(2**np.arange(10), 2**np.arange(10))
ax.set_xscale('log')
ax.set_yscale('log')

image

  • Operating system: Ubuntu 18.04
  • Matplotlib version: 3.1.1
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.8
  • Jupyter version (if applicable): Jupyter Lab 1.1.4

In some earlier version of matplotlib (or something else) it worked as expected with any order of calls, but now I am getting this problem.

@anntzer
Copy link
Contributor

anntzer commented Dec 19, 2019

This is fixed as of master, AFAICT.

@QuLogic
Copy link
Member

QuLogic commented Mar 8, 2020

This was fixed by #13642 and in 3.2.0.

@QuLogic QuLogic closed this as completed Mar 8, 2020
@QuLogic QuLogic added this to the v3.2.0 milestone Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants