8000 Inconsistent behavior of markevery between semilogx and semilogy plots · Issue #8356 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Inconsistent behavior of markevery between semilogx and semilogy plots #8356
Closed
@Naereen

Description

@Naereen

Bug report

  • The markevery option for plot, semilogx, semilogy, and loglog plotting methods has a weird difference of behavior between plot / semilogy and semilogx / loglog, when using markevery = (float, float).

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

# Generate some data
X = np.linspace(-10, 10, 1000)
Y = np.sin(X)**2

# Specify markers
markers = ['o', 'v', '^', '<', '>']

def markevery(i):
    # I tried a *lot* of values here, none were working for the 4 plots
    return (i / 50., 0.1)

plt.figure()

# First plot in normal plot
plt.subplot(221)
for i in range(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 semilogx
plt.subplot(222)
for i in range(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 semilogy
plt.subplot(223)
for i in range(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 loglog
plt.subplot(224)
for i in range(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()

Actual outcome
bug_markevery

Expected outcome

  • One would expect the markers to be located in a similar fashion for each of the four plots method, plot, semilogx, semilogy, and loglog. 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 (here markevery = (i / 50., 0.1) for the various curves, with changing i 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 the semantic behind using markevery = (float, float), but as far as I can tell, this behavior is weird.
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0