"Transform()" returns bad coordinates with ipympl
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Inizia eseguendo l'esempio di trasformazione Matplotlib fornito nelle modalità inline e ipympl/widget, quindi confronta i risultati visualizzati e salvati. L'issue è completata quando la modalità widget produce le stesse coordinate e lo stesso posizionamento delle annotazioni della modalità inline.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the issue
I believe the "transform()" functions of Matplotlib do not behave well in ipympl or widget mode.
Code for reproduction
I simply use the matplotlib example published here:
https://matplotlib.org/3.1.1/tutorials/advanced/transforms_tutorial.html
I copy/paste the code for basic help :
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
x = np.arange(0, 10, 0.005)
y = np.exp(-x/2.) * np.sin(2*np.pi*x)
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_xlim(0, 10)
ax.set_ylim(-1, 1)
xdata, ydata = 5, 0
xdisplay, ydisplay = ax.transData.transform_point((xdata, ydata))
bbox = dict(boxstyle="round", fc="0.8")
arrowprops = dict(
arrowstyle="->",
connectionstyle="angle,angleA=0,angleB=90,rad=10")
offset = 72
ax.annotate('data = (%.1f, %.1f)' % (xdata, ydata),
(xdata, ydata), xytext=(-2*offset, offset), textcoords='offset points',
bbox=bbox, arrowprops=arrowprops)
disp = ax.annotate('display = (%.1f, %.1f)' % (xdisplay, ydisplay),
(xdisplay, ydisplay), xytext=(0.5*offset, -offset),
xycoords='figure pixels',
textcoords='offset points',
bbox=bbox, arrowprops=arrowprops)
plt.show()
Actual outcome
I get different results depending on the matplotlib mode :
- on one side, %matplotlib inline gives the result expected and displayed in the example, as below :

- on the other side, %matplotlib ipympl or %matplotlib widget give erroneous results, as below :
The result is the same if I download with the "floppy-disk" icon of the widget.
Expected outcome
The result with widget or ipympl mode should be the one of inline mode.
Versions
3.7.7 (default, Mar 26 2020, 10:32:53)
[Clang 4.0.1 (tags/RELEASE_401/final)]
ipympl version: 0.5.2
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.7.5
ipython : 7.16.1
ipykernel : 5.3.3
jupyter client : 6.1.6
jupyter lab : 1.2.6
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.7
traitlets : 4.3.3
Known nbextensions:
config dir: /Users/mmyara/.jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
config dir: /opt/miniconda3/etc/jupyter/nbconfig
notebook section
jupyter-matplotlib/extension enabled
- Validating: OK
plotlywidget/extension enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
tree section
ipyparallel/main enabled
- Validating: OK
JupyterLab v1.2.6
Known labextensions:
app dir: /opt/miniconda3/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v1.1.0 enabled OK
@jupyterlab/toc v2.0.0 enabled OK
@lckr/jupyterlab_variableinspector v0.4.0 enabled OK
jupyter-matplotlib v0.7.1 enabled OK
jupyterlab-plotly v4.9.0 enabled OK
plotlywidget v4.9.0 enabled OK```
- Lingua principale
- Jupyter Notebook
- Stelle
- 1.7k
- Fork
- 234
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
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.
Altre issue di matplotlib/ipympl
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
matplotlib/ipympl#623 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
matplotlib/ipympl#622 · 13 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
matplotlib/ipympl#612 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
matplotlib/ipympl#611 · 4 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
matplotlib/ipympl#609 · 7 commenti ·
Tutte le issue di matplotlib/ipympl
Issue simili
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
dennys-bd/agent-hive#184 ·
-
bug frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
cancervariants/metakb#902 ·
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Apertabug frontend maui-pilot
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Save States Menu Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100