Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

jupyterlab で matplotlib のプロット図に picker を設定するメモ

背景

jupyterlab + matplotlib でプロット図や画像から, マウス位置のピクセル値などを取得したい

方法

pick event を使います.

https://matplotlib.org/3.1.1/gallery/event_handling/pick_event_demo.html

pip などで ipympl を入れておきます.

https://stackoverflow.com/questions/50149562/jupyterlab-interactive-plot

を参考に, Jupyterlab の interactive widget 機能(?)を有効にします.

jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyter-matplotlib

jupyter nbextension enable --py widgetsnbextension
%matplitlib widget

を notebook の最初に記述しておきます.

サンプルコード

https://matplotlib.org/3.1.1/gallery/event_handling/pick_event_demo.html

を動かして, うまくいけば成功です!

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away