matplotlib / matplotlib/pytest-mpl
Margins removed in baseline
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 272
- Fork
- 53
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci la discrepanza utilizzando la cella Jupyter e il comando py.test --mpl-generate-path=baseline test.py mostrati nel report, confrontando le immagini salvate con le immagini baseline. Traccia il modo in cui pytest-mpl genera le baseline e il modo in cui Jupyter applica le impostazioni di Matplotlib; il lavoro è completo quando le figure equivalenti hanno margini e stile coerenti in entrambi i workflow.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- jupyter, matplotlib, python
- Ambito
- data-visualization, testing-qa
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100