Найти - Пользователи
Полная версия: matplotlib animation
Начало » Python для новичков » matplotlib animation
1
jacksson2012
как из этого сделать анимацию в matplotlib ?
пример с https://matplotlib.org/gallery/ticks_and_spines/custom_ticker1.html#sphx-glr-gallery-ticks-and-spines-custom-ticker1-py

[code python]
from matplotlib.ticker import FuncFormatter
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(4)
a=[1,2,3,4,5,6,7,8,9,10]
b=[10,9,8,7,6,5,4,3,2,1]
c=[1,2,3,4,5,6,7,8,9,10]
d=[10,9,8,7,6,5,4,3,2,1]
money = [a,b,c,d]
def millions(x, pos):
'The two args are the value and tick position'
return '$%1.1fM' % (x * 1e-6)
formatter = FuncFormatter(millions)
fig, ax = plt.subplots()
ax.yaxis.set_major_formatter(formatter)
plt.bar(x, money)
plt.xticks(x, ('Bill', 'Fred', 'Mary', 'Sue'))
plt.show()

/code][/code]
jacksson2012
как должно выглядеть:
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB