Skip to content

wrong x-position of marker with drawstyle='steps-xxx' #11031

@pierre-haessig

Description

@pierre-haessig

Bug report

Hello, as discussed on matplotlib-devel, there is a unexpected change in Matplotlib 2.2 when plotting lines and markers (e.g. style 'D-') combined with drawstyle='steps-post' (steps-pre' and 'steps-mid' as well).

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 6, 7)
y = np.sin(x)
plt.plot(x, y, 'D-', drawstyle='steps-post')

Actual outcome

In Matplotlib 2.2.2, markers are drawn at each "line break".

image

Running the same script with drawstyle='steps-mid' yields markers at half-integer positions (except for those at the end)

Expected outcome

In all previous Matplotlib versions, the marker was placed at the exact x-position of the input data (which is the left of each segment for drawstyle='steps-post'). I didn't do the bissection to know when the changed happen, but I suspect it's quite new (2.1 → 2.2 ?).

Matplotlib version

  • Matplotlib version: 2.2.2
  • Python version: 3.6

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy