8000 matplotlib.rc_file resets to default template before updating rcparams · Issue #12836 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
matplotlib.rc_file resets to default template before updating rcparams #12836
Closed
@JackCaster

Description

@JackCaster

Bug report

Bug summary
matplotlib.rc_file reverts to the default template before updating rcparams.

Code for reproduction

import matplotlib as mpl
import matplotlib.pyplot as plt

plt.style.use("seaborn-darkgrid")
mpl.rc_file('mpl_style.txt')
plt.plot(1)

where mpl_style.txt contains

font.size : 28

Actual outcome
image

Expected outcome
If instead we swap the order of the commands (first we update the rcfile and then we apply the style) then it works.

import matplotlib as mpl
import matplotlib.pyplot as plt

mpl.rc_file('mpl_style.txt')
plt.style.use("seaborn-darkgrid")

plt.plot(1)

image

The workaround, right now, is to use matplotlib.rcParams.update(matplotlib.rc_params_from_file('mpl_style.txt', use_default_template=False)). I guess an option like use_default_template=False should be included in matplotlib.rc_file as well.

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: matplotlib 3.0.2 (conda)
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.6.6

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