Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python matplotlib动画在MPEG中向绘图角添加奇怪的长方体_Python_Matplotlib_Animation_Seaborn_Matplotlib Animation - Fatal编程技术网

Python matplotlib动画在MPEG中向绘图角添加奇怪的长方体

Python matplotlib动画在MPEG中向绘图角添加奇怪的长方体,python,matplotlib,animation,seaborn,matplotlib-animation,Python,Matplotlib,Animation,Seaborn,Matplotlib Animation,我正在使用matplotlib动画包创建动画图形 我用赛璐珞包装来简化事情,这样我就能画出一个海生的情节 我不明白为什么保存的视频中会出现一个小方框: 这是我的密码: #%% sns.set() plt.style.use('seaborn-pastel') sns.set_style('white', {"axes.axisbelow": False, "font.sans-serif": ['Futura'],

我正在使用matplotlib动画包创建动画图形

我用赛璐珞包装来简化事情,这样我就能画出一个海生的情节

我不明白为什么保存的视频中会出现一个小方框:

这是我的密码:

#%%
sns.set()
plt.style.use('seaborn-pastel')
sns.set_style('white',
              {"axes.axisbelow": False,
               "font.sans-serif": ['Futura'],
               })
sns.set_context("paper", font_scale=1.5)


#%%
fig = plt.figure()
camera = Camera(fig)

for i in range(0, len(height_sample_data)+2, 2):
    plot1 = sns.scatterplot(x=0, y=height_sample_data.Height[:i],
                            hue=height_sample_data.col, alpha=0.75)
    sns.despine(bottom=True)
    plt.xticks([])
    plt.xlabel("")
    plt.ylabel("Height (cm)")
    plt.legend("", frameon=False)
    plt.text(-.1, 140, f"{i}/{len(height_sample_data)} DataPoints Plotted")
    plt.xlim(-0.5, 0.5)
    plt.ylim(130, 220)
    camera.snap()
anim = camera.animate(blit=True)
anim.save('Chapter6/Animations/AddingDots.mp4')
我运行了几乎相同的绘图(sans动画),并将其保存到png而不是MPEG,并且该框不见了,因此它似乎与动画有关。起初我以为这是传说的大纲,但我想我把它藏好了


编辑:我在mac(Catalina)上,使用ffmpeg作为mpeg保存程序,通过自制软件安装。

我是个白痴。事实上,这就是传说。我最初删除图例的代码是用于ax(轴)对象的。从plt,我需要打电话

plt.legend("", frameon=False)
这就去掉了造成小正方形的框架。“”将删除内容,但不会删除框架