Closed
Description
Bug report
Bug summary
With temporary styling, using colors with respect to the color cycle, like 'C0'
, is ignored if plt.show()
is called outside of the with
block. It only works properly if plt.show()
is called inside the block.
Code for reproduction
This reproduces the bug:
import matplotlib.pyplot as plt
with plt.style.context('seaborn'):
plt.axhline(0, color='C0')
plt.axhline(1, color='C1')
plt.axhline(2, color='C2')
plt.show()
This works fine and is the expected behavior:
import matplotlib.pyplot as plt
with plt.style.context('seaborn'):
plt.axhline(0, color='C0')
plt.axhline(1, color='C1')
plt.axhline(2, color='C2')
plt.show()
Actual outcome
Please note that other elements of the style are working fine, such as the grid.
Expected outcome
Matplotlib version
- Operating system: Solus Linux
- Matplotlib version: 2.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
): TkAgg - Python version: 3.6.5
Using matplotlib packaged by the linux distribution.