LoginSignup
1
1

More than 3 years have passed since last update.

kdeplotで火を作る

Posted at
plot.py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import seaborn as sns
fig=plt.figure()
ax=fig.add_subplot()
a=np.random.normal(0,0.1,100000)
b=np.random.chisquare(2,100000)
s=0
def plot(data):
    global ax,s
    ax.clear()
    ax.set_xlim(-1, 1)
    ax.set_ylim(0, 8)
    ax=sns.kdeplot(a[s:s+1000],b[s:s+1000],bw=0.1,shade=True,n_levels=30,shade_lowest=False,cmap='hot',vmin=-0.5)
    s+=100
    print("\b"*10,(s*100)/10000-1,"%",end="")

ani = animation.FuncAnimation(fig, plot, interval=100, frames=100)
ani.save("plot.gif", writer="imagemagick")

plot.gif

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1