Edit Template

Matplotlib Customization in Hindi

Matplotlib मे ऐसे कई methods होते है जिनकी help से हम plot को customize कर सकते है और अपने graph को attractive बना सकते है।

Axis Labels

जब हम matplotlib कोई graph plot करते है तो X-axis और Y-axis (आम-तौर पर) numbers दिखते है, but सिर्फ numbers से graph के axis को समझना कठिन होता है इसलिए हम उन axis को एक नाम देते है, इसके लिए xlabel() (x-axis के लिए) और ylabel() (y-axis के लिए) का use करते है। Graph को कोई title देने के लिए title() का use किया जाता है।

Axis Limits

X-axis label को zoom in या zoom out करने के लिए xlim() और Y-axis label को zoom in या zoom out करने के लिए ylim() का use किया जाता है।

Grid

किसी भी graph में grid add करने के लिए grid() method का use किया जाता है इसके parameter में “True” और “linestyle” में कोई भी line और “color” में कोई भी color दिया जाता है।

Ticks

Axis में ticks देने के लिए xticks() और yticks का उसे करते है इसके parameter में list pass किया जाता है।

Subplots

Matplotlib में हमे एक figure के multiple grophs को दिखा सकते है, इसके लिए हम subplot(),  subplots() का use करते है,

Text

अगर हमे graph पर कोई text directly लिखना हो तो हमे text() method का use करते है इसके parameter में location और text को दिया जाता है।

Annotation

अगर हमे graph में किसी point को arrow के साथ highlight करना हो तो हम annotate() method का use करते है।

Styles and Themes

Matplotlib में कुछ build-in themes होते है जो graph के look को instantly change कर देते है जैसे ggplot, seaborn, dark_background इन्हे use करने के लिए style.use() का use किया जाता है।

Figure Size

Figure के size को काम या ज्यादा करने के लिए figure() method का use किया जाता है इसमे “figsize”(inch में width x height के लिए) और “dpi” (resolution के लिए) parameters में value assign किया जात है।

Save Figure

Graph को किसी file में save करने के लिए savefig() method का use किया जाता है, हमे graph को .png, .jpg, .pdf में save कर सकते है इसे file name के साथ savefig() के parameter में दिया जाता ह।

Add a comment...

Sign up to track your learning

Login to continue your learning tracking

To reset your password, please enter your email address or username below.

Scroll to Top