ubuntu下matplotlib的字体设置(新罗马字体)

Matplotlib 中英文及公式字体设置 - cherichy的文章 - 知乎
https://zhuanlan.zhihu.com/p/118601703

https://blog.csdn.net/feynman233/article/details/86364398?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-4.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-4.channel_param

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
matplotlib中,您可以使用不同的方法来设置字体。引用中的方法一是通过导入matplotlib库并设置字体的参数来实现。具体步骤是: 1. 导入matplotlib库:import matplotlib 2. 设置字体:font = {'family':'SimHei', 'weight':'bold', 'size':12} 3. 应用字体设置matplotlib.rc("font", **font) 另一种方法是在画图时自定义字体格式。引用中的方法是: 1. 导入matplotlib库:from matplotlib import pyplot as plt 2. 定义图形和坐标轴:fig, ax = plt.subplots() 3. 修改全局字体:ax.set_title("标题", fontname="Times New Roman") 还有一种方法是通过使用matplotlib.font_manager模块来设置字体。引用中的方法三是: 1. 导入matplotlib库:from matplotlib import pyplot as plt 2. 导入字体管理器:from matplotlib.font_manager import FontProperties 3. 定义字体:font = FontProperties(fname=r"c:\windows\fonts\simsun.ttc", size=14) 4. 绘制图形:x = [1,2,3,4] y = [3,2,1,3] 5. 添加x轴标签并设置字体:plt.xlabel("x轴标签",fontproperties=font) 6. 显示图形:plt.show() 这些是设置matplotlib字体的几种方法,您可以根据需要选择适合您的情况的方法来设置字体。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Python碎片|matplotlib设置中文字体的三种方法](https://blog.csdn.net/wglink/article/details/113263089)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [matplotlib添加字体字体格式自定义](https://blog.csdn.net/jasminefeng/article/details/120834650)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值