当前位置:网站首页>利用可视化结果,点击出现对应的句子
利用可视化结果,点击出现对应的句子
2022-07-03 18:50:00 【这个利弗莫尔不太冷】
数据格式:前两行为点坐标,后面为句子

"""
-*- coding: utf-8 -*-
author: Hao Hu
@date 2022/6/30 7:49 PM
"""
import numpy as np
import matplotlib.pyplot as plt
def onpick(event):
thisline = event.artist
xdata = thisline.get_xdata()
ydata = thisline.get_ydata()
ind = event.ind
points = tuple(zip(xdata[ind], ydata[ind]))
print('the point of the sentence', x_to_sentence[xdata[ind][0]])
def get_pos():
"""得到点位置信息"""
with open('inf.txt','r') as fp:
contents = fp.readlines()
pos = []
x_to_sentence = {}
for sample in contents:
x = float(sample.split()[0])
y = float(sample.split()[1])
pos.append([x,y])
sentence_str = ''
for sample in sample.split()[2:]:
sentence_str +=' '+sample
x_to_sentence[x] = sentence_str
return pos,x_to_sentence
def show_pic(pos,x_to_sentence):
fig, ax = plt.subplots()
ax.set_title('click and show sentence')
for i in range(len(pos)):
line, = ax.plot(pos[i][0], pos[i][1], 'o',
picker=True, pickradius=5) # 5 points tolerance
fig.canvas.mpl_connect('pick_event', onpick)
plt.show()
if __name__ == '__main__':
# fig.canvas.mpl_connect('pick_event', onpick)
# plt.show()
pos,x_to_sentence = get_pos()
show_pic(pos, x_to_sentence)


边栏推荐
- SSM integration - joint debugging of front and rear protocols (list function, add function, add function status processing, modify function, delete function)
- 198. Looting - Dynamic Planning
- SQL: special update operation
- Pytorch introduction to deep learning practice notes 13- advanced chapter of cyclic neural network - Classification
- [combinatorics] exponential generating function (proving that the exponential generating function solves the arrangement of multiple sets)
- Understanding of database architecture
- SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
- Scrape crawler framework
- Work Measurement - 1
- Software development freelancer's Road
猜你喜欢

DriveSeg:动态驾驶场景分割数据集
![leetcode:11. Container with the most water [double pointer + greed + remove the shortest board]](/img/d4/cbbaec40119be6cb5594899e348261.png)
leetcode:11. Container with the most water [double pointer + greed + remove the shortest board]

为什么要做特征的归一化/标准化?

Recommend a simple browser tab

Record: MySQL changes the time zone

235. 二叉搜索树的最近公共祖先【lca模板 + 找路径相同】
![Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]. StandardContext](/img/56/ea61359dd149a49589ba7ad70812a0.jpg)
Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]. StandardContext
![leetcode:556. Next larger element III [simulation + change as little as possible]](/img/a0/12e5ee5d01d666acb4b75ada2e6fec.png)
leetcode:556. Next larger element III [simulation + change as little as possible]

Opencv learning notes (continuously updated)

Pan for in-depth understanding of the attention mechanism in CV
随机推荐
Raft log replication
编程中常见的 Foo 是什么意思?
cipher
Getting started with JDBC
How many convolution methods does deep learning have? (including drawings)
my. INI file not found
SSH 远程执行命令简介
C enum contains value - C enum contains value
Know what it is, and know why, JS object creation and inheritance [summary and sorting]
Change is the eternal theme
Record: writing MySQL commands
VLAN experiment
High concurrency Architecture - distributed search engine (ES)
TypeScript 官网教程
There are several levels of personal income tax
Read the paper glodyne global topology preserving dynamic network embedding
The more you talk, the more your stupidity will be exposed.
变化是永恒的主题
记录在模拟器中运行flutter时报的错
Xception for deeplab v3+ (including super detailed code comments and original drawing of the paper)