Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
628 views
in Technique[技术] by (71.8m points)

python - How use Persian/Arabic numbers for axis ranges in matplotlib

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...