Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Description
Bug report
- The
markevery
option forplot
,semilogx
,semilogy
, andloglog
plotting methods has a weird difference of behavior betweenplot / semilogy
andsemilogx / loglog
, when usingmarkevery = (float, float)
.
Code for reproduction
importnumpyasnpimportmatplotlib.pyplotasplt# Generate some dataX=np.linspace(-10,10,1000)Y=np.sin(X)**2# Specify markersmarkers= ['o','v','^','<','>']defmarkevery(i):# I tried a *lot* of values here, none were working for the 4 plotsreturn (i/50.,0.1)plt.figure()# First plot in normal plotplt.subplot(221)foriinrange(10):plt.plot(X,Y+i/10.,marker=markers[i%len(markers)],markevery=markevery(i),label=str(i))plt.legend()plt.title("plt.plot(): markers are here!")# Then plot in semilogxplt.subplot(222)foriinrange(10):plt.semilogx(X,Y+i/10.,marker=markers[i%len(markers)],markevery=markevery(i),label=str(i))plt.legend()plt.title("plt.semilogx(): markers are NOT here!")# And then semilogyplt.subplot(223)foriinrange(10):plt.semilogy(X,Y+i/10.,marker=markers[i%len(markers)],markevery=markevery(i),label=str(i))plt.legend()plt.title("plt.semilogy(): markers are here!")# Finally plot in loglogplt.subplot(224)foriinrange(10):plt.loglog(X,Y+i/10.,marker=markers[i%len(markers)],markevery=markevery(i),label=str(i))plt.legend()plt.title("plt.loglog(): markers are NOT here!")plt.suptitle("Weird behavior of markevery between plt.plot, plt.semilogx, plt.semilogy, plt.loglog")plt.show()
Expected outcome
- One would expect the markers to be located in asimilar fashion for each of the four plots method,
plot
,semilogx
,semilogy
, andloglog
. The two plots on the left have markers correctly located (well spacen, with a different starting point for the different curves), and the two plots on the right do not show markers. - Note that I tried a lot of different values for the
markevery
parameters (heremarkevery = (i / 50., 0.1)
for the various curves, with changingi
to change the starting point of the markers), and always encounter this inconsistency between left and right.
Matplotlib version
- Matplotlib version 2.0.0 (
2.0.0+3337.gc15694b
), with Python 3.5, on Ubuntu 16.10 - Python installed with apt, latest version of Matplotlib installed with
pip --upgrade
.
Maybe I don't understand thesemantic behind usingmarkevery = (float, float)
, but as far as I can tell, this behavior is weird.
Thanks in advance!