matplotlib
默认在图像Windows窗口中显示当前鼠标光标所在位置的坐标,格式为x=xx, y=xx
。
鼠标光标的坐标格式由子图模块Axes
中的format_coord
函数控制。
通过重写format_coord
函数即可实现坐标的自定义格式。
注意:调用format_coord
函数的对象是子图对象,常见的错误主要在没有正确的获取当前子图对象。
format_coord
函数源码
matplotlib.axes.Axes.format_coord def format_coord(self, x, y): """Return a format string formatting the *x*, *y* coordinates.""" if x is None: xs = '"htmlcode">import matplotlib.pyplot as plt def format_coord(x, y): return 'x坐标为%1.4f, y坐标为%1.4f' % (x, y) #获取当前子图 ax=plt.gca() ax.format_coord = format_coord plt.show()
最新资源
- 群星.2024-繁花电视剧原声带3CD【环球】【WAV+C
- 江希文.1994-伝说少女(饿狼伝说动画原声大碟)【
- 洪荣宏.2010-上爱的人【华特】【WAV+CUE】
- 《大牌国语情歌 经典再现 深情对唱 2CD》[WAV/分
- 《陈百强粉红色的一生精选 3CD》[FLAC/分轨][1.
- 《丁当 20首重量级歌曲 Fu Good 下一站天后 2CD
- 歌莉雅.2012-My.Voice.Story【环星】【FLAC分轨
- 群星.1993-一曲成名·青春无悔【飞碟】【WAV+CUE
- 刘德华.2000-爱无知(金装版)【NEWMELODY】【WAV
- 许巍《时光漫步》1CD[FLAC/分轨][804.3MB]