{'体育': 0, '数字化': 1, '文化旅游': 2, '新能源': 3, '旅游': 4, '轨道交通': 5, '中医药': 6, '物联网': 7, '大数据': 8, '新一代信息技术': 9, '互联网+': 10, '人工智能': 11, '区块链': 12, '数字经济': 13, '生命': 14} Requirement already satisfied: matplotlib in /Users/hh/anaconda3/lib/python3.10/site-packages (3.7.0) Requirement already satisfied: cycler>=0.10 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (0.11.0) Requirement already satisfied: contourpy>=1.0.1 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (1.0.5) Requirement already satisfied: fonttools>=4.22.0 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (4.25.0) Requirement already satisfied: packaging>=20.0 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (22.0) Requirement already satisfied: pyparsing>=2.3.1 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (3.0.9) Requirement already satisfied: kiwisolver>=1.0.1 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (1.4.4) Requirement already satisfied: python-dateutil>=2.7 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (2.8.2) Requirement already satisfied: numpy>=1.20 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (1.23.5) Requirement already satisfied: pillow>=6.2.0 in /Users/hh/anaconda3/lib/python3.10/site-packages (from matplotlib) (9.4.0) Requirement already satisfied: six>=1.5 in /Users/hh/anaconda3/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)
时间: 2023-10-30 11:08:24 浏览: 139
2022年公需课:数字化转型与产业创新发展,答案
根据你提供的词典token到id的映射关系,以及你已经安装了matplotlib库,你应该可以成功绘制热力图了。
请确保在绘制热力图之前,你已经执行了以下代码来加载数据和设置词典:
```python
import pickle
import gensim
import matplotlib.pyplot as plt
# 加载语料库
text_corpus = pickle.load(open('/Users/hh/Desktop/11_14/十一五-十四五产业规划bow.pkl', mode='rb'))
# 创建词典
dictionary = gensim.corpora.Dictionary(text_corpus)
# 设置词典的token到id映射关系
token2id = dictionary.token2id
# 打印词典的token到id映射关系
print(token2id)
# 其他代码...
```
接下来,你可以使用你提供的绘制热力图的代码来绘制热力图。确保在绘制热力图之前,`data`变量中包含了正确的数据。
希望这次能成功绘制热力图!如果还有其他问题,请随时提问。
阅读全文