午夜视频免费看_日韩三级电影网站_国产精品久久一级_亚洲一级在线播放_人妻体内射精一区二区三区_91夜夜揉人人捏人人添红杏_91福利在线导航_国产又粗又猛又黄又爽无遮挡_欧美日韩一区在线播放_中文字幕一区二区三区四区不卡 _日日夜夜精品视频免费观看_欧美韩日一区二区三区

主頁 > 知識庫 > matplotlib交互式數據光標mpldatacursor的實現

matplotlib交互式數據光標mpldatacursor的實現

熱門標簽:滴滴地圖標注公司 江門智能電話機器人 智能電話機器人調研 地圖標注可以遠程操作嗎 天津塘沽區地圖標注 400電話在線如何申請 甘肅高頻外呼系統 杭州房產地圖標注 如何申請400電話代理

簡介

mpldatacursor包可以為matplotlib提供交互式的數據光標(彈出式注釋框)。
它的典型功能是:

  • 鼠標左鍵單擊圖表數據元素時會彈出文本框顯示最近的數據元素的坐標值。
  • 鼠標右鍵單擊文本框取消顯示數據光標。
  • d鍵時切換顯示\關閉數據光標。

 

安裝

如果matplotlib版本低于3.3可以直接使用pip安裝

pip install mpldatacursor

如果matplotlib版本高于3.3,雖然pip安裝成功,但是運行案例時會出現AttributeError: 'ScalarFormatter' object has no attribute 'pprint_val'錯誤。

通過查看源碼可知:

try:
  # Again, older versions of mpl
  return formatter.pprint_val(x)
except AttributeError:
  # 3.3.0 or later
  return formatter.format_data_short(x)

通過分析,預計是因為使用了國內pip源,mpldatacursor包還未修復該問題(pip 安裝的 mpldatacursor包版本號是0.7.1)。

因此,建議到https://github.com/joferkington/mpldatacursor

下載源碼,進行源碼安裝(源碼安裝的 mpldatacursor包版本號是0.7.dev0)。

python setup.py install

基本應用(官方實例)解析

應用流程

mpldatacursor包基本應用方式比較簡單:

  • mpldatacursor包中導入datacursor函數。
  • 應用datacursor函數。

 包結構

查看源碼可知,mpldatacursor包的結構如下:

mpldatacursor
   convenience.py
   datacursor.py
   pick_info.py
   __init__.py

datacursor函數定義在convenience.py中,datacursor函數的返回值是DataCursor類實例。
DataCursor類定義在datacursor.py中。
pick_info.py定義了一系列和彈出文本框相關的函數,供DataCursor類調用。

datacursor函數定義

datacursor函數定義可知:

  • datacursor函數可以不提供參數,這樣圖像內所有數據元素都會應用交互式數據光標。
  • datacursor函數可以指定哪些數據元素應用交互式數據光標。
def datacursor(artists=None, axes=None, **kwargs):
  """
  Create an interactive data cursor for the specified artists or specified
  axes. The data cursor displays information about a selected artist in a
  "popup" annotation box.

  If a specific sequence of artists is given, only the specified artists will
  be interactively selectable. Otherwise, all manually-plotted artists in
  *axes* will be used (*axes* defaults to all axes in all figures).

  Parameters
  -----------
  artists : a matplotlib artist or sequence of artists, optional
    The artists to make selectable and display information for. If this is
    not specified, then all manually plotted artists in `axes` will be
    used.
  axes : a matplotlib axes of sequence of axes, optional
    The axes to selected artists from if a sequence of artists is not
    specified. If `axes` is not specified, then all available axes in all
    figures will be used.
  tolerance : number, optional
    The radius (in points) that the mouse click must be within to select
    the artist. Default: 5 points.
  formatter : callable, optional
    A function that accepts arbitrary kwargs and returns a string that will
    be displayed with annotate. Often, it is convienent to pass in the
    format method of a template string, e.g.
    ``formatter="{label}".format``.
    Keyword arguments passed in to the `formatter` function:
      `x`, `y` : floats
        The x and y data coordinates of the clicked point
      `event` : a matplotlib ``PickEvent``
        The pick event that was fired (note that the selected
        artist can be accessed through ``event.artist``).
      `label` : string or None
        The legend label of the selected artist.
      `ind` : list of ints or None
        If the artist has "subitems" (e.g. points in a scatter or
        line plot), this will be a list of the item(s) that were
        clicked on. If the artist does not have "subitems", this
        will be None. Note that this is always a list, even when
        a single item is selected.
    Some selected artists may supply additional keyword arguments that
    are not always present, for example:
      `z` : number
        The "z" (usually color or array) value, if present. For an
        ``AxesImage`` (as created by ``imshow``), this will be the
        uninterpolated array value at the point clicked. For a
        ``PathCollection`` (as created by ``scatter``) this will be the
        "c" value if an array was passed to "c".
      `i`, `j` : ints
        The row, column indicies of the selected point for an
        ``AxesImage`` (as created by ``imshow``)
      `s` : number
        The size of the selected item in a ``PathCollection`` if a size
        array is specified.
      `c` : number
        The array value displayed as color for a ``PathCollection``
        if a "c" array is specified (identical to "z").
      `point_label` : list
        If `point_labels` is given when the data cursor is initialized
        and the artist has "subitems", this will be a list of the items
        of `point_labels` that correspond to the selected artists.
        Note that this is always a list, even when a single artist is
        selected.
      `width`, `height`, `top`, `bottom` : numbers
        The parameters for ``Rectangle`` artists (e.g. bar plots).
  point_labels : sequence or dict, optional
    For artists with "subitems" (e.g. Line2D's), the item(s) of
    `point_labels` corresponding to the selected "subitems" of the artist
    will be passed into the formatter function as the "point_label" kwarg.
    If a single sequence is given, it will be used for all artists with
    "subitems". Alternatively, a dict of artist:sequence pairs may be given
    to match an artist to the correct series of point labels.
  display : {"one-per-axes", "single", "multiple"}, optional
    Controls whether more than one annotation box will be shown.
    Default: "one-per-axes"
  draggable : boolean, optional
    Controls whether or not the annotation box will be interactively
    draggable to a new location after being displayed. Defaults to False.
  hover : boolean, optional
    If True, the datacursor will "pop up" when the mouse hovers over an
    artist. Defaults to False. Enabling hover also sets
    `display="single"` and `draggable=False`.
  props_override : function, optional
    If specified, this function customizes the parameters passed into the
    formatter function and the x, y location that the datacursor "pop up"
    "points" to. This is often useful to make the annotation "point" to a
    specific side or corner of an artist, regardless of the position
    clicked. The function is passed the same kwargs as the `formatter`
    function and is expected to return a dict with at least the keys "x"
    and "y" (and probably several others).
    Expected call signature: `props_dict = props_override(**kwargs)`
  keybindings : boolean or dict, optional
    By default, the keys "d" and "t" will be bound to deleting/hiding all
    annotation boxes and toggling interactivity for datacursors,
    respectively. If keybindings is False, the ability to hide/toggle
    datacursors interactively will be disabled. Alternatively, a dict of
    the form {'hide':'somekey', 'toggle':'somekey'} may specified to
    customize the keyboard shortcuts.
  date_format : string, optional
    The strftime-style formatting string for dates. Used only if the x or y
    axes have been set to display dates. Defaults to "%x %X".
  display_button: int, optional
    The mouse button that will triggers displaying an annotation box.
    Defaults to 1, for left-clicking. (Common options are 1:left-click,
    2:middle-click, 3:right-click)
  hide_button: int or None, optional
    The mouse button that triggers hiding the selected annotation box.
    Defaults to 3, for right-clicking. (Common options are 1:left-click,
    2:middle-click, 3:right-click, None:hiding disabled)
  keep_inside : boolean, optional
    Whether or not to adjust the x,y offset to keep the text box inside the
    figure. This option has no effect on draggable datacursors. Defaults to
    True. Note: Currently disabled on OSX and NbAgg/notebook backends.
  **kwargs : additional keyword arguments, optional
    Additional keyword arguments are passed on to annotate.

  Returns
  -------
  dc : A ``mpldatacursor.DataCursor`` instance
  """

官方實例源碼

import matplotlib.pyplot as plt
import numpy as np
from mpldatacursor import datacursor

data = np.outer(range(10), range(1, 5))

fig, ax = plt.subplots()
lines = ax.plot(data)
ax.set_title('Click somewhere on a line')

datacursor()

plt.show()

限定僅某數據元素使用交互式光標

本實例中,有兩個數據元素(artist):line1line2datacursor(line1)函數提供了參數line1,因此只有line1可以使用交互式數據光標,line2則沒有效果。

import matplotlib.pyplot as plt
import numpy as np
from mpldatacursor import datacursor
fig, ax = plt.subplots()
line1 = ax.plot([1,3])
line2 = ax.plot([1,2])
ax.set_title('Click somewhere on a line')
datacursor(line1)
plt.show()

其他官方實例功能概述

mpldatacursor提供了大量實際案例,詳見https://github.com/joferkington/mpldatacursor/tree/master/examples。不再一一分析,僅簡單說明功能。

  • basic_single_annotation.py:在多子圖情況下,默認每個子圖的數據光標是獨立的,即每個子圖都可以顯示數據光標,相互不影響。使用datacursor(display='single')參數后,僅在當前子圖顯示數據光標,其余子圖顯示的數據光標自動關閉。
  • change_popup_color.py:提供了兩個案例,一個取消了提示框的邊框,一個將提示框的背景色改為白色。
  • hover_example.py:將數據光標的觸發方式由鼠標左鍵單擊改為鼠標懸浮。
  • show_artist_labels.py:將數據光標默認顯示的坐標值改為數據元素的label
  • highlighting_example.py:點擊數據元素時,數據元素會高亮(黃色)顯示。
  • draggable_example.py:在一個子圖中,同時顯示多個數據光標。
  • customize_keyboard_shortcuts.py:重新綁定數據光標快捷鍵。
  • labeled_points_example.py:自定義數據點標簽。
  • date_example.py:日期數據顯示。
  • bar_example.py:在柱狀圖中,在每個柱上方鼠標懸浮觸發數據光標。

總結

mpldatacursor歷史悠久,但是遲遲沒有發布支持matplotlib3.3的穩定版,建議源碼安裝開發版,或者使用mplcursors包https://github.com/anntzer/mplcursors。
mpldatacursor功能上還是挺豐富的,可以作為深入學習matplotlib交互的案例。

到此這篇關于matplotlib交互式數據光標mpldatacursor的實現 的文章就介紹到這了,更多相關matplotlib交互式數據光標內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • matplotlib交互式數據光標實現(mplcursors)

標簽:長春 臨汾 東莞 德宏 漢中 河池 重慶 廊坊

巨人網絡通訊聲明:本文標題《matplotlib交互式數據光標mpldatacursor的實現》,本文關鍵詞  matplotlib,交互式,數據,光標,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《matplotlib交互式數據光標mpldatacursor的實現》相關的同類信息!
  • 本頁收集關于matplotlib交互式數據光標mpldatacursor的實現的相關信息資訊供網民參考!
  • 推薦文章
    精品一区二区三区视频在线观看| 久久久久亚洲AV成人无码国产| 999久久久精品视频| 国产探花视频在线播放| 中文字幕在线播放日韩| 日韩激情中文字幕| 亚洲日本丝袜连裤袜办公室| 欧美r级电影在线观看| 日韩电影免费观看在线观看| 久久久久久久久久久免费| 久久久久久久免费视频| 国内av免费观看| 国产一本一道久久香蕉| 成人一区二区电影| 国偷自拍第113页| 亚洲午夜在线电影| y97精品国产97久久久久久| 成人两性免费视频| 国产综合免费视频| 91香蕉视频在线播放| 韩国中文字幕hd久久精品| 高清不卡一区二区| 日韩视频在线一区二区| 国产高清一区二区三区| 久久婷婷综合国产| 亚洲成人av电影| 精品日本一区二区三区| 手机毛片在线观看| 丁香天五香天堂综合| 欧美成人一区二区三区片免费| www.久久久| 在线观看久久av| 91在线观看免费| 91成年人网站| 99精品偷自拍| 久久久av电影| 日韩一级片播放| aaa国产视频| 色综合久久综合| 欧美在线性爱视频| 日韩人妻一区二区三区蜜桃视频| 久久国产免费观看| 国产精品久久久久久久浪潮网站| 欧美精品一区在线播放| 可以在线看黄的网站| 国产综合精品久久久久成人av| 日韩高清欧美激情| 欧美亚洲图片小说| 欧美中文字幕在线观看| 中文字幕丰满乱码| 日韩 国产 欧美| 欧美性xxxxx极品| 久久久久久国产| 三上悠亚 电影| 美女视频一区免费观看| 欧美亚洲一区二区在线| 国产精品国产三级国产专区53| 欧美专区第二页| 色噜噜在线播放| 91国产丝袜在线播放| 久久精品国产理论片免费| 久久精品亚洲无码| 亚洲成人1区2区| 亚洲自拍偷拍视频| 日本欧美一区二区三区不卡视频| www.日韩精品| 日韩av手机在线看| 粗大的内捧猛烈进出视频| 国产毛片精品国产一区二区三区| 中文字幕日本欧美| 日本高清久久久| 日韩av中文字幕一区二区三区| 不卡毛片在线看| 日本高清一区二区视频| 国产成人在线免费观看| 久久免费视频网| 欧美精品欧美极品欧美激情| 天堂成人免费av电影一区| 欧美国产日产韩国视频| 黄色正能量网站| 91在线播放网址| 国产aaa精品| 成年人免费观看视频网站 | 一区二区三区人妻| 天堂在线亚洲视频| 日韩午夜小视频| 国产一区二区三区在线免费| 精品不卡一区二区| 亚洲成人精品视频| 国产一区二区三区四区五区在线| 成人黄色三级视频| 这里只有精品电影| 日韩欧美亚洲区| 国产情侣自拍小视频| 欧美日韩激情视频| 少妇高潮喷水在线观看| 欧美一级xxx| 国产手机av在线| 日本欧美视频在线观看| 欧美日韩国产精品| 国产一国产二国产三| 日韩免费中文专区| 亚洲欧美日本精品| 国产情人综合久久777777| 日韩一级免费在线观看| 有码中文亚洲精品| 三级久久三级久久| 免费看黄在线看| 色悠悠亚洲一区二区| 久久无码人妻一区二区三区| 精品亚洲一区二区三区四区五区| 成人午夜精品在线| 日韩av一二区| 欧美成年人网站| 天堂蜜桃一区二区三区 | 黄色片久久久久| 一区二区美女视频| 超碰成人在线免费观看| 富二代精品短视频| 国产又大又粗又硬| 黄色三级视频在线| 精品国产乱码久久久久久郑州公司| 精品av久久707| 国产亚洲精品中文字幕| 全程偷拍露脸中年夫妇| 欧美在线观看黄| 久久久在线免费观看| 老司机午夜免费精品视频| 中文字幕の友人北条麻妃| 欧洲激情一区二区| 国产一区二区三区视频播放| 日韩亚洲欧美中文高清在线| 污视频在线免费观看| 国产一区二区三区黄| 国产精品蜜臀av| 91精品人妻一区二区| 欧美一级片在线播放| 99久久久国产精品| 强开小嫩苞一区二区三区网站| 岛国视频午夜一区免费在线观看| 国产精品第9页| 中文字幕在线乱| 91禁外国网站| 久久97超碰色| 中文字幕av一区二区三区人妻少妇| 欧美精品videos另类日本| 亚洲视频一区在线播放| 亚洲国产日韩欧美| 一区二区三区久久精品| 天堂v在线观看| 亚洲欧美国产精品桃花| 疯狂做受xxxx欧美肥白少妇| 性色av免费观看| 国产传媒一区| 91香蕉视频黄| 亚洲精品乱码久久久久久9色| 3d动漫精品啪啪1区2区免费| 国产无人区码熟妇毛片多| 日本一区不卡| 色综合久久中文字幕综合网| 久久精品99北条麻妃| 伊人久久99| 激情av一区二区| 无码人妻精品一区二区蜜桃色欲| 韩国成人动漫在线观看| 亚洲综合色噜噜狠狠| 久久无码专区国产精品s| 亚洲三级黄色在线观看| 日韩在线视频不卡| 成人免费福利在线| 2021久久国产精品不只是精品| www.涩涩涩| 一区二区三欧美| 国产99久久久久| 国语对白一区二区| 综合色婷婷一区二区亚洲欧美国产| 91精品国产91热久久久做人人| 久久综合综合久久| caoporen国产精品| 亚洲大片精品永久免费| 天天操天天摸天天干| 国产三级中文字幕| 日韩午夜av电影| 中文字幕精品在线观看| 国语精品中文字幕| 亚洲精品综合在线| 中文字幕在线播放一区| xxxxx91麻豆| 国内精品伊人久久久久av影院 | 综合久久国产| 国产精品大尺度| 无码人妻丰满熟妇区毛片蜜桃精品| 久久国产一区二区三区| 无码国产精品一区二区色情男同| 亚洲成人网上| 欧美日韩一卡二卡三卡| 中文字幕手机在线视频| 亚洲欧美日韩另类精品一区二区三区| 日韩欧美亚洲成人| 国产精品成人网站| 欧美二级三级| 欧美电影精品一区二区| 国内精品久久久久久久久久久 | 日本网站在线观看一区二区三区 | 精品高清视频| 波波电影院一区二区三区| 欧洲美女亚洲激情| 亚洲国产97在线精品一区| 欧产日产国产v| 亚洲一区二区三区成人在线视频精品| 国产精品污污网站在线观看| 欧美日韩国产黄色| 国产欧美一区二区三区视频| 91麻豆免费视频| 国产激情视频网站| 国产狼人综合免费视频| 亚洲一区二区精品视频| 国产精品国产三级国产专区52| 成人国产亚洲精品a区天堂华泰| 国产欧美视频在线观看| 蜜桃精品一区二区| 97神马电影| 337p亚洲精品色噜噜狠狠| 全国男人的天堂网| 欧美韩国日本在线| 日韩欧美在线网站| 全部av―极品视觉盛宴亚洲| www.四虎精品| 国产精品美乳一区二区免费| 中文字幕一区二区三区精华液| 免费视频91蜜桃| 久久www视频| 久久综合一区二区三区| 欧美黄网免费在线观看| 538prom精品视频线放| 99久久精品免费精品国产| 国产一区二区三区免费| 欧美xxxxx精品| 性生活免费观看视频| 免费一级特黄毛片| 国产freexxxx性播放麻豆 | 亚洲一区二区三区成人在线视频精品| 欧洲美女7788成人免费视频| 亚洲男人天堂2023| 亚洲一区二区三区四区在线免费观看| 色香蕉在线视频| 日韩污视频在线观看| japanese中文字幕| 欧美精品无码一区二区三区| 最新中文字幕久久| 午夜精品久久17c| 91麻豆精品久久久久蜜臀| 欧美极品少妇xxxxⅹ高跟鞋 | 亚洲 国产 欧美一区| 国产不卡在线观看| 日韩中文第一页| 99精品视频一区二区三区| 国产精品成人免费观看| 日韩 国产 一区| 永久免费在线看片视频| 国产精品欧美激情在线观看| av在线天堂网| 日韩精品无码一区二区三区久久久| 免费在线观看h片| 黄色网址中文字幕| 天堂网一区二区| 中文字幕一区2区3区| 成人午夜免费在线观看| 亚洲一级在线播放| 久久久999久久久| 亚洲 欧美 日韩 综合| 性一交一黄一片| 人妻巨大乳一二三区| 欧美日韩福利在线| www.国产亚洲| 亚洲中文字幕无码一区二区三区 | 亚洲精品一区二区三区婷婷月| 久久91精品久久久久久秒播| 欧美激情精品久久久久久免费 | 国产日韩欧美视频| 欧美人妇做爰xxxⅹ性高电影| 成人av电影在线| 日本视频免费观看| www.久久国产| 亚欧精品在线| 国内成人精品一区| 亚洲精品在线一区二区| 国产精品嫩草99a| www.午夜激情| 制服 丝袜 综合 日韩 欧美| 国产精品va在线观看无码| 国产精品99久久久久久人 | 99精品黄色片免费大全| 国产成人精品亚洲男人的天堂 | 国产欧美日韩中文| 日韩西西人体444www| 久久久亚洲精品石原莉奈| 久久久久久久久久成人| 亚洲免费成人在线视频| 国产女主播一区二区三区| 亚洲欧美日韩中文在线| 亚洲成av人在线观看| 91在线免费视频观看| 一级黄色a视频| 后入内射无码人妻一区| 成人在线免费观看av| a级国产乱理论片在线观看99| 久久久久久久久电影| 欧美一区二区视频在线观看2020| 国产日产精品一区| 久久se精品一区精品二区| 免费黄色片视频| 国产一区第一页| 88av.com| 亚洲永久一区二区三区在线| 91久久极品少妇xxxxⅹ软件| 69视频在线播放| 日韩精品专区在线| 午夜精品123| 国产精品久线在线观看| 日日夜夜精品视频免费| 国产精品第九页| 50一60岁老妇女毛片| 五月婷婷狠狠操| 中文字幕无码精品亚洲资源网久久| 国产成人一区二区三区免费看| 性欧美长视频免费观看不卡| 亚洲成色777777女色窝| 色一区在线观看| 亚洲影院在线观看| 亚洲视频一区二区在线观看| 国产精品羞羞答答xxdd| 97人妻精品一区二区三区| 日本特黄一级片| 亚洲理论片在线观看| 九色91porny| 午夜激情福利在线| 三上悠亚av一区二区三区| 黄色大片在线免费看| 偷拍盗摄高潮叫床对白清晰| 亚洲高清不卡一区| 国产精品传媒毛片三区| 成人网在线视频| 38少妇精品导航| 色综合天天综合网国产成人网| 亚洲精品国产精品自产a区红杏吧 亚洲精品国产精品乱码不99按摩 亚洲精品国产精品久久清纯直播 亚洲精品国产精品国自产在线 | 日本午夜一区二区| 特级西西444www大精品视频免费看| 美女爆乳18禁www久久久久久 | 婷婷中文字幕在线观看| 最新天堂中文在线| 国模私拍视频在线观看| 久久久久国产精品熟女影院| 国产肥臀一区二区福利视频| 亚洲一区二区三区四区中文| 麻豆精品传媒视频| 国产日韩一区二区| 成人资源av| 国产精品乱子乱xxxx| 国产精品一区二区电影| 国产综合香蕉五月婷在线| 国产精品一二三视频| 国产精品国内视频| 国产美女精品视频| 亚洲自拍偷拍色图| 99久久久精品免费观看国产 | 色香蕉成人二区免费| 亚洲黄色av一区| 亚洲少妇中出一区| 亚洲免费av观看| 午夜私人影院久久久久| 在线观看精品一区| 在线日韩国产精品| 91久久精品日日躁夜夜躁欧美| 欧美一级片在线看| 精品国产99国产精品| 中文字幕国产日韩| 中文字幕在线观看亚洲| 国产91精品黑色丝袜高跟鞋| 91精品国产精品| 国产中文欧美精品| 午夜精品亚洲一区二区三区嫩草 | 秋霞午夜av一区二区三区| 69**夜色精品国产69乱| 中文字幕亚洲精品一区| 国产婷婷成人久久av免费高清 | 一区二区成人在线| 中文字幕人妻熟女人妻洋洋| a亚洲天堂av| 欧美日韩成人一区二区三区| 免费不卡在线视频| 亚洲aa中文字幕| 欧美熟妇交换久久久久久分类| 2019精品视频| 在线观看中文字幕2021| 欧美精品电影在线| 无码人妻精品一区二| 久久精品精品电影网| 欧美黑吊大战白妞| 亚洲精品资源在线| 黄色裸体一级片| 亚洲国产精品久久久久秋霞蜜臀| 三级电影在线看| 制服丝袜亚洲色图| 99精品一区二区三区无码吞精| 91国产精品成人| 精品人妻一区二区三| 91福利区一区二区三区| 久久久久无码精品| 日本韩国视频一区二区|