matplotlib / matplotlib/pytest-mpl
Margins removed in baseline
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 272
- Forks
- 53
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere die Abweichung mithilfe der im Bericht gezeigten Jupyter-Zelle und des Befehls py.test --mpl-generate-path=baseline test.py, und vergleiche die gespeicherten Bilder mit den Baseline-Bildern. Verfolge, wie pytest-mpl Baselines erzeugt und wie Jupyter Matplotlib-Einstellungen anwendet; abgeschlossen ist die Aufgabe, wenn äquivalente Abbildungen in beiden Workflows konsistente Ränder und Stile haben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- jupyter, matplotlib, python
- Bereich
- data-visualization, testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100