如何将标签字体设置为"Time New Roman"通过python中的drawparallels [英] How to set the label Fonts as "Time New Roman" by drawparallels in python
本文介绍了如何将标签字体设置为"Time New Roman"通过python中的drawparallels的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我绘制了一个地图,其中标有纬度,但是我想将字体设置为"Times New Roman".如何使其成为可能?
I have draw a map with latitudes labelled but I want to set the fonts as "Times New Roman". How to make it possible?
m.drawparallels(parallels,labels = [1,0,0,0],fontsize = 12)
m.drawparallels(parallels,labels=[1,0,0,0],fontsize=12)
推荐答案
您需要使用matplotlib
的pyplot
设置字体系列.
You need to set font family using pyplot
of matplotlib
.
import matplotlib.pyplot as plt
csfont = {'fontname':'Times New Roman'}
// write your code related to basemap here
plt.title('title',**csfont)
plt.show()
您还可以使用以下内容全局更改字体.
You can also use the following to change font globally.
import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "Times New Roman"
这篇关于如何将标签字体设置为"Time New Roman"通过python中的drawparallels的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文