Skip to content

ticklabels on log axes sometimes adds overwritten labels on top of existing ones  #8622

Closed
@joezuntz

Description

@joezuntz

Bug report

For log axes setting the tick labels sometimes just adds new labels on top of the existing ones.

Code for reproduction

# Paste your code here
#Demonstration using the Agg backend, but this also happened for me with others.
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot as plt

# Some data I found that triggered this bug
x = [100,200,300,400,500,600,700,800,900,1000]
y = [ 1.7,  1.2,  0.98,  0.87,  0.76, 0.69,  0.62,  0.59,  0.56,  0.51]

#Only seems to happen for a log axis.  Same error if you do semilogy
plt.loglog(x, y)
#This does not seem to replace the old tick labels, just add new ones
plt.yticks([0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0], ["0.5", "0.6", "0.7", "0.8", "0.9", "1.0", "2.0"])
plt.savefig("test.png")

Actual outcome

test

Expected outcome
Removal of the old tick labels as well as adding the new ones.

Matplotlib version

  • Operating System: MacOS Sierra 10.12.4
  • Matplotlib Version: 2.0.2
  • Python Version: 2.7.13
  • Jupyter Version (if applicable): N/A
  • Other Libraries: N/a

I used pip to install matplotlib and it downloaded matplotlib-2.0.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions