[PYTHON] Make a fire with kdeplot

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

Recommended Posts

Make a fire with kdeplot
Make a fortune with Python
Let's make a GUI with python.
Make a recommender system with python
Make a filter with a django template
Let's make a graph with python! !!
Let's make a supercomputer with xCAT
Make a model iterator with PySide
Make a nice graph with plotly
Let's make a shiritori game with Python
Make a video player with PySimpleGUI + OpenCV
Make a rare gacha simulator with Flask
Make a Notebook Pipeline with Kedro + Papermill
Make a partially zoomed figure with matplotlib
Make a cascade classifier with google colaboratory
Let's make a simple language with PLY 1
Make a logic circuit with a perceptron (multilayer perceptron)
Make a Yes No Popup with Kivy
Make a wash-drying timer with a Raspberry Pi
Let's make a web framework with Python! (1)
Let's make a tic-tac-toe AI with Pylearn 2
Make a desktop app with Python with Electron
Let's make a web framework with Python! (2)
A memorandum to make WebDAV only with nginx
Investment quest: Make a system trade with pyhton (2)
Make a Twitter trend bot with heroku + Python
[Python] Make a game with Pyxel-Use an editor-
Make a monitoring device with an infrared sensor
Make a simple pixel art generator with Flask
How to make a dictionary with a hierarchical structure.
I want to make a game with Python
Try to make a "cryptanalysis" cipher with Python
[Python] Make a simple maze game with Pyxel
Let's replace UWSC with Python (5) Let's make a Robot
Try to make a dihedral group with Python
Make holiday data into a data frame with pandas
Make a LINE WORKS bot with Amazon Lex
(Memorandum) Make a 3D scatter plot with matplodlib
Make a squash game
Make Lambda Layers with Lambda
Make Yubaba with Discord.py
Make a function decorator
Make a distance matrix
I'll make a password!
Make a Nyan button
Decorate with a decorator
Make slides with iPython
Make a Tetris-style game!
Make a Base64 decoder
Make one repeating string with a Python regular expression.
Make a morphological analysis bot loosely with LINE + Flask
Try to make a command standby tool with python
[Practice] Make a Watson app with Python! # 2 [Translation function]
[Practice] Make a Watson app with Python! # 1 [Language discrimination]
Make a simple Slackbot with interactive button in python
[Let's play with Python] Make a household account book
How to make a shooting game with toio (Part 1)
Let's make a simple game with Python 3 and iPhone
Make a breakpoint on the c layer with python
Make a function to describe Japanese fonts with OpenCV
Let's make dependency management with pip a little easier