Skip to content

Scatter plots with log scaling #15978

Closed
Closed

Description

@Phlya

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.

Activity

  1. anntzer commented on Dec 19, 2019

    @anntzer
    Contributor

    This is fixed as of master, AFAICT.

  2. QuLogic commented on Mar 8, 2020

    @QuLogic
    Member

    This was fixed by #13642 and in 3.2.0.

  3. added this to the v3.2.0 milestone on Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions