简单定义图轴:
import numpy as npimport matplotlib.pyplot as plt创建一个简单的matplotlib实例:
fig = plt.figure()rect = fig.patch # a rectangle instancerect.set_facecolor('lightgoldenrodyellow')ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])rect = ax1.patchrect.set_facecolor('lightslategray')for label in ax1.xaxis.get_ticklabels(): # label is a Text instance label.set_color('red') label.set_rotation(45) label.set_fontsize(16)for line in ax1.yaxis.get_ticklines(): # line is a Line2D instance line.set_color('green') line.set_markersize(25) line.set_markeredgewidth(3)plt.show()效果展示:
脚本运行时间:(0分0.021秒)
总结
以上就是本文关于Python自定义简单图轴简单实例的全部内容,希望对大家有所帮助。感兴趣的朋友可以继续参阅本站其他相关专题,如有不足之处,欢迎留言指出。感谢朋友们对本站的支持!