Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Font properties not applied for log scale with negative exponent #15845

Closed
@Svdvoort

Description

@Svdvoort

Bug report

Bug summary

Font options do no apply correctly when using a logarithmic scale with numbers smaller than 1 (i.e. negative exponents). This issue seems related for positive exponents.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np

tick_size = 25

x = np.arange(1, 500)
y_small = np.power(x, -0.1)
y_large = np.power(x, 2)

plt.figure()
ax1 = plt.axes()
ax1.plot(x, y_large)
ax1.set_yscale("log")
ax1.tick_params(labelsize=tick_size)

plt.figure()
ax2 = plt.axes()
ax2.plot(x, y_small)
ax2.set_yscale("log")
ax2.tick_params(labelsize=tick_size)

plt.show()

Actual outcome

For log values with negative exponents, the font size is not correctly set:

Small_log_values

Expected outcome
Similar behavior as in the situation when working with a log scale with positive exponents:

Large_log_values

Matplotlib version

  • Operating system: Ubuntu 18.04
  • Matplotlib version: 3.1.2
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.6.9
  • Jupyter version (if applicable): N/A
  • Other libraries: Numpy version 1.17.0

All packages installed through pip in a virtual environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions