自定义matplotlib图
示例
import pylab as plt
import numpy as np
plt.style.use('ggplot')
fig = plt.figure(1)
ax = plt.gca()
# make some testing data
x = np.linspace( 0, np.pi, 1000 )
test_f = lambda x: np.sin(x)*3 + np.cos(2*x)
# plot the test data
ax.plot( x, test_f(x) , lw = 2)
# set the axis labels
ax.set_xlabel(r'$x$', fontsize=14, labelpad=10)
ax.set_ylabel(r'$f(x)$', fontsize=14, labelpad=25, rotation=0)
# set axis limits
ax.set_xlim(0,np.pi)
plt.draw()# Customize the plot
ax.grid(1, ls='--', color='#777777', alpha=0.5, lw=1)
ax.tick_params(labelsize=12, length=0)
ax.set_axis_bgcolor('w')
# add a legend
leg = plt.legend( ['text'], loc=1 )
fr = leg.get_frame()
fr.set_facecolor('w')
fr.set_alpha(.7)
plt.draw()热门推荐
10 生日的祝福语 文案简短
11 PMP考试祝福语简短励志
12 下雪拜年祝福语简短英语
13 英语祝福语搞笑短句简短
14 生日祝福语小孩诗句简短
15 结婚婚宴圆满祝福语简短
16 电力考试祝福语简短高级
17 酒店疫情祝福语大全简短
18 生日祝福语简短发小