You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wrong x-position of marker with drawstyle='steps-xxx' #11031
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
importmatplotlib.pyplotaspltimportnumpyasnpx=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".
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 ?).
Activity
dstansby commentedon Apr 12, 2018
Bisects to 722f405, so quite a long time ago actually! ping @anntzer
anntzer commentedon Apr 12, 2018
Something like
fixes the issue, but that's pretty horrible from a performance point of view. Don't have the time to turn this into a proper PR right now.
pierre-haessig commentedon Jun 11, 2018
great, thanks!