学习python笔记——matplotlib绘图使用小技巧

学习python笔记——matplotlib绘图使用小技巧

    学习python小白一只,在这记录下学习python的心得笔记,还往多多
    指教。
    话不多说,直接上学习matplotlib绘图小技巧相关代码。如下:

visualization data

# define image size
fig = plt.figure(figsize=(10, 8))
# create image form
ax1 = fig.add_subplot(111)
# title the image and define the font fammilies & size
ax1.set_title('Iteration of batch_64_Zer_36', fontdict={'family': 'Times New Roman', 'size': 18})
# title of x&y label and define the font fammilies & size
ax1.set_xlabel('Times of iteration', fontdict={'family': 'Times New Roman', 'size': 18})
ax1.set_ylabel('Value of iteration', fontdict={'family': 'Times New Roman', 'size': 18})
# difine axis size & font
plt.xticks(fontproperties='Times New Roman', size=16)
plt.yticks(fontproperties='Times New Roman', size=16)
# setting the spacing of axis
tick_spacing_x = 25000
tick_spacing_y = 0.025
ax1.xaxis.set_major_locator(ticker.MultipleLocator(tick_spacing_x))
# setting the scale of axis
plt.xlim(0, 100000)
plt.ylim(0.01, 0.1)
loss_t = ea.scalars.Items('loss_t_1')
# define the font color and label
ax1.plot([i.step for i in loss_t], [i.value for i in loss_t], label='loss_t', c='red')
# save image to folder
plt.savefig(r'D:\optimizer_1\batch_64_Zer_36_200520\IterOfBatch64Zer36.ps', dpi=1000)

还望大家多多交流指教!!!

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值