Open
Description
Bug report
Bug summary
I use %config InlineBackend.figure_format = 'retina'
for sharp images in matplotlib inline mode. However, animations produced with to_jshtml
are still using default dpi.
Code for reproduction
Thanks to @story645 for providing the template for this!
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
from IPython.display import HTML
signal = np.random.random((100,))
smoothed = np.convolve(signal, np.full((3,), 1/3), mode='valid')
fig, ax = plt.subplots(figsize=(6,3))
ax.plot(signal, label='signal')
line, = ax.plot(0, smoothed[0], linewidth=3,
color='C1', label='convolved')
ax.set_xticks(np.arange(0, 100, window_size))
ax.legend()
def animate(i):
line.set_data(np.arange(i), smoothed[:i])
return [line]
ani = animation.FuncAnimation(fig, animate, frames=98)
HTML(ani.to_jshtml())
Expected outcome
The animation plot should be as sharp as the image plot.
Matplotlib version
- Operating system: Ubuntu 18.04
- Matplotlib version: 3.0.3
- Matplotlib backend (
print(matplotlib.get_backend())
): 'module://ipykernel.pylab.backend_inline' - Python version: 3.6
- Jupyter version (if applicable): 4.4.0
- Other libraries:
mpl installed from pip, I think. ;)