How is the dataindex from the datacursormode calculated?

1 回表示 (過去 30 日間)
Sion Jung
Sion Jung 2021 年 3 月 22 日
編集済み: Matt J 2021 年 3 月 22 日
I'm trying to convert a MATLAB code for a GUI into python pyqt5 GUI. It seems like python doesn't really have a datacursormode like that in MATALB.
What I would do in MATLAB is
  1. activate the datacursor mode
  2. pick a point from the plot
  3. obtain the dataindex
  4. update the plot based on that data index
I think I would have to figure out how the dataindex from datacursormode in MATLAB is calculated and make another code for that in python. Is there a documentation that explains how the dataindex is calculated or some other source that I could get some help?

回答 (1 件)

Matt J
Matt J 2021 年 3 月 22 日
編集済み: Matt J 2021 年 3 月 22 日
In a 2D plot, the dataindex i is almost certainly the one such that XData(i),YData(i) is closest to where you clicked.

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by