Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Switch to using matplotlib's object-oriented API

Aperta
#367 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia in mumot/view.py e segui MuMoTview e MuMoTmultiView, in particolare init e gli utilizzi dello stato di pyplot come plt.gcf(), plt.gca(), plt.clf() e plt.cla(). Confronta la proprietà proposta di Figure/Axes con il comportamento esistente di _figureNum e determina come funzionerebbe un argomento Axes opzionale per entrambi i tipi di vista; l'issue è conclusa quando il design e i siti di chiamata interessati sono concordati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement question

Using the stateful API (functions and attributes of the matplotlib.pyplot module) correctly gets increasingly tricky as a libraries that depends on matplotlib grows larger.

MuMoT's use of matplotlib would be cleaner if something like the following were adoped:

  • For non-multi MuMoTview instances a Figure and Axes pair are instantiated in __init__() using plt.subplots() unless an Axes instance is passed as a param to __init__(), in which case a reference to the associated Figure can be found via the Axes ref. The references to the Figure and Axes are stored as instance attributes (e.g. as self._ax and self._fig).
  • Subsequent plotting and changing of aesthetics in other MuMoTview (or non-multi subclass) methods could be done by calling methods of self._ax or self._fig (rather than the stateful plt.plot/plt.gcf()/plt.gca()/plt.clf()/plt.cla() etc).

My knowledge of how the parts of mumot/view.py fit together is still rather shakey. What issues can others foresee with the above? Would a positive side-effect be that self._figureNum would be redundant? How would the above work with MuMoTmultiViews?

Lingua principale
Python
Stelle
24
Fork
5
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DiODeProject/MuMoT

Tutte le issue di DiODeProject/MuMoT

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.