8000 First item not displayed with FixedFormatter · Issue #7122 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
First item not displayed with FixedFormatter #7122
Closed
@rougier

Description

@rougier

Tested on matplotib 1.5.1 on OSX, pip installation. Not sure about regression but I never noticed this behavior before.

Expected behavior:

plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.set_xlim(0, 2)
plt.show()

output-1

Bad: Extends the x limit for unknown reason

majors = ["0", "1", "2"]
plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors))
ax.set_xlim(0, 2)
plt.show()

output-2

Bad: First item is not displayed

majors = ["0", "1", "2"]
plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0))
ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors))
ax.set_xlim(0, 2)
plt.show()

output-3

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

      0