一.语法简介 plt.xlabel("销售月份",fontsize=16,color='red',fontweight='bold',loc='center',backgroundcolor='black', labelpad=10,rotation=1,alpha=1) '''fontsize 设置字体大小 默认值为12fontweight 设置字体粗细 color 设置字体颜色loc 设置标题对齐方式 具体值有center left right top bottombackgrou
模式识别的一个实验,要求画出贝叶斯决策的图.这里我是利用python中的matplotlib库实现的图线的拟合.主要对于matplotlib的使用可以参照博客:webary 如果要绘制三维图像可以参考博客:python绘制三维图 具体实现: 接下来,就是对具体数据进行绘图了.比如我们要绘制一条y=x^2的曲线,可这样写代码: x = range() # 横轴的数据 y = [i*i for i in x] # 纵轴的数据 pl.plot(x, y) # 调用pylab的plot函数绘制曲线 pl
参考:https://blog.csdn.net/kaizei_pao/article/details/80795377 首先查看matplotlib已加载的字体: import matplotlib.font_manager a = sorted([f.name for f in matplotlib.font_manager.fontManager.ttflist]) for i in a: print(i) 然后找到Mac自身带的字体 command-空格,进行搜索查找字体册,选择中文-华