Barchart Sizer of Text & Barwidth مع Matplotlib - بيثون
-
23-08-2019 - |
سؤال
أقوم بإنشاء مخطط شريط مع Matplotlib-0.91 (لأول مرة) ولكن يتم قطع تسميات محور Y. إذا قمت بزيادة عرض الرقم بما فيه الكفاية، فإنها تظهر في النهاية تماما ولكن الإخراج ليس الحجم الصحيح.
بأي طريقة للتعامل مع هذا؟
المحلول
أعتقد أنني ركضت مشكلة مماثلة.
معرفة ما إذا كان هذا يساعد في ضبط حجم الخط التسمية:
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
fontsize2use = 10
fig = plt.figure(figsize=(10,5))
plt.xticks(fontsize=fontsize2use)
plt.yticks(fontsize=fontsize2use)
fontprop = fm.FontProperties(size=fontsize2use)
ax = fig.add_subplot(111)
ax.set_xlabel('XaxisLabel')
ax.set_ylabel('YaxisLabel')
.
<main plotting code>
.
ax.legend(loc=0, prop=fontprop)
لعرض الشريط، إذا كنت تستخدم pyplot.bar. يبدو أنه يمكنك اللعب مع سمة العرض.
نصائح أخرى
إلقاء نظرة على subplots_adjust
, ، أو مجرد استخدام axes
([left,bottom,width,height])
.
لا تنتمي إلى StackOverflow