https://github.com/JackMcKew/pandas_alive 项目中 python绘制动图气泡图
作者原文提到了:
If you get an error such as `TypeError: 'MovieWriterRegistry' object is not an iterator`, this signals there isn't a writer library installed on your machine.
如果出现诸如“TypeError:”MovieWriterRegistry“对象不是迭代器”之类的错误,这表示您的计算机上没有安装writer库。
此软件包使用[matplotlib.animation函数](https://matplotlib.org/3.2.1/api/animation_api.html),因此需要编写器库。
# @Time : 2022/1/12 19:58
# @Author : 南黎
# @FileName: 5.气泡图.py
import pandas as pd
######显示中文宋体字体导入,如果使用中文加上这段代码######
import matplotlib as plt
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
#####################################################
import pandas_alive
multi_index_df = pd.read_csv("数据源data/multi.csv", header=[0, 1], index_col=0)
multi_index_df.index = pd.to_datetime(multi_index_df.index, dayfirst=True)
map_chart = multi_index_df.plot_animated(
title='发现你走远了——5.气泡图',
kind="bubble",
filename="5.气泡图",
x_data_label="Longitude",
y_data_label="Latitude",
size_data_label="Cases",
color_data_label="Cases",
vmax=5, steps_per_period=3, interpolate_period=True, period_length=500,
dpi=100
)
This package utilises the https://matplotlib.org/3.2.1/api/animation_api.html, thus requiring a writer library.
Ensure to have one of the supported tooling software installed prior to use!
Ensure that a matplotlib writer library is installed,
确保安装 matplotlib writer library
安装 matplotlib writer library
现在遇到什么问题了