How to edit table data with interactive event in matplotlib

天大地大妈咪最大 提交于 2019-12-20 02:37:37

问题


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()

回答1:


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

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

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.



来源:https://stackoverflow.com/questions/49848575/how-to-edit-table-data-with-interactive-event-in-matplotlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!