I changed the global font of matplotlib:
import matplotlib.pyplot as plt
from matplotlib import rcParams
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Vazir']
But numbers of axis ranges are still english,
How can we use persian/arabic numbers for axis ranges in plot?
I have a function that converts english numbers to persian:
def en_to_fa(self, num, formatter='%1.0f'):
num_as_string = formatter % num
mapping = dict(list(zip('0123456789.%', '??????????.%')))
return ''.join(mapping[digit] for digit in num_as_string)
But I do not know how use this function in mathplotlib, Any ideas welcome...
question from:
https://stackoverflow.com/questions/65833143/how-use-persian-arabic-numbers-for-axis-ranges-in-matplotlib 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…