如何在Matplotlib中使用交互式事件编辑表数据 [英] How to edit table data with interactive event in matplotlib

查看:98
本文介绍了如何在Matplotlib中使用交互式事件编辑表数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在图中创建一个表.现在,我想在单元格上双击后编辑表格,在该单元格中添加,删除或修改数据.就像Excel中的编辑功能一样.我的python版本是3.64.代码如下:

A table is created in a figure. Now I want to edit the table after double click at the cell, adding, deleting or revising the data in this cell. Just like the edit function in Excel. My python version is 3.64. Codes are following:

import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()

# Hide axes
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)

# Table from Ed Smith answer
clust_data = [[1,1,7]]
collabel=("col 1", "col 2", "col 3")
ax.table(cellText=clust_data,colLabels=collabel,loc='center')
plt.show()

推荐答案

使用纯matplotlib函数似乎不容易实现.

It seems that you this is not easy to achieve using pure matplotlib functional.

您应该考虑查看 qgrid 模块,该模块在Jupyter Notebook中提供类似于Excel的交互式表格编辑

You should consider looking at qgrid module, which provides interactive Excel-like table editing in Jupyter Notebook.

然后,如果要相应地更改图形,则需要与表进行一些交互. ipywidgets 确实可以为您提供帮助.

Then, if you want to change your graph accordingly, you will need to create some interaction with the table. ipywidgets can really help you with that.

这篇关于如何在Matplotlib中使用交互式事件编辑表数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆