Форум сайта python.su
0
как из этого сделать анимацию в 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 (Фев. 5, 2019 09:26:21)
Офлайн
0
как должно выглядеть:
Прикреплённый файлы:
75896343_aa6c64374c55dc38295926b720abd9f9_800.png (6,4 KБ)
Офлайн