matplotlib / matplotlib/pytest-mpl
Margins removed in baseline
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 272
- Forks
- 53
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
When I run or save a modified README code in Jupyter, I get a different image than the generated baseline.
Example code run in a Jupyter cell:
#%%file test.py
%matplotlib inline
import matplotlib.pyplot as plt
import pytest
@pytest.mark.mpl_image_compare
def test_succeeds():
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot([1,2,3])
fig.savefig("test")
return fig
Running test_succeeds(); in Jupyter gives resulting image and saved test.png with margins:

Next, I generate a test.py file by uncommenting the first line, commenting the second line
and then running the cell
%%file test.py
#%matplotlib inline
...
From a command prompt, in the appropriate directory I run the following to generate the baseline image:
> py.test --mpl-generate-path=baseline test.py
In the baseline folder, a comparable image called test_succeeds.png is created without margins:

Aside from the difference in sizes, I notice the baseline image uses the classic mpl style. Perhaps this is the cause for the absence in margins. I report this as an issue as it is ideal that when testing the baseline image, it should be the same image as shown and saved by Jupyter.

I tested this with Anaconda 4.2.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce la discrepancia utilizando la celda de Jupyter y el comando py.test --mpl-generate-path=baseline test.py mostrados en el informe, comparando las imágenes guardadas con las imágenes baseline. Rastrea cómo pytest-mpl genera las baselines y cómo Jupyter aplica la configuración de Matplotlib; el trabajo estará terminado cuando las figuras equivalentes tengan márgenes y estilo coherentes en ambos flujos de trabajo.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- jupyter, matplotlib, python
- Área
- data-visualization, testing-qa
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100