⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 custom_ticker1.py

📁 非原创。很好的python例子
💻 PY
字号:
#!/usr/bin/env python"""The new ticker code was designed to explicity support user customizedticking.  The documentationhttp://matplotlib.sourceforge.net/matplotlib.ticker.html details thisprocess.  That code defines a lot of preset tickers but was primarilydesigned to be user extensible.In this example a user defined function is used to format the ticks inmillions of dollars on the y axis"""from matplotlib.ticker import FuncFormatterfrom pylab import *x =     arange(4)money = [1.5e5, 2.5e6, 5.5e6, 2.0e7]def millions(x, pos):    'The two args are the value and tick position'    return '$%1.1fM' % (x*1e-6)formatter = FuncFormatter(millions)ax = subplot(111)ax.yaxis.set_major_formatter(formatter)bar(x, money)xticks( x + 0.5,  ('Bill', 'Fred', 'Mary', 'Sue') )show()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -