Table of Contents
Matplotlib Tutorial
Table of Contents
Matplotlib Tutorial
Matplotlib in Hindi
What is Matplotlib
matplotlib का use हम data visualization के लिए करते हैं, यह एक python library है। इसके help से हम data को graph, chart or plot के form में देख सकते हैं। इसका use data analytics और scientific computation में अक्सर किया जाता है।
How to Install Matplotlib
ये python की library है इसलिए हमारे computer में पहले से python install होना जरूरी है, अब matplotlib को install करने के लिए हमें अपने computer में command terminal को open करना है और उसमें pip install matplotlib लिखकर enter press कर देना है अब कुछ ही time में matplotlib हमारे computer में install हो जाएगा।
Import & alias Matplotlib
import : python library को अपने program मे use करने के लिए उसे अपने program मे import करना होता है, इसके लिए “import” use करते है। जैसा की इस example code के 1st line मे हमने matplotlib को import किया है import matplotlibl.pyplot as plt
यहाँ पर हमने “as” का use करके matplotlib को एक short form दिया है plt,इससे होता ये है की अब जहां भी हमे matplotlib लिखने की जरूरत होगी तो वह हम सिर्फ plt लिखेंगे हमारा काम हो जाएगा । आप plt के जगह कुछ भी ले सकते है but वो meaningful रहे, आम तौर पर हम plt का ही use करते है ।
show() Method
matplotlib में किसी भी plot को देखने के लिए show() method का use करते है।
Labels, Title, Legend
Plot को title देने के लिए title() का use करते है, और labels (axis name) के लिए xlabel() & ylabel() का use किया जाता है।
Legend(): title का plot में show करने के लिए legend() method का use किया जाता है।
Some Customization Parameters
Plot को customize करने के लिए कई सारे parameters होते है हम अपने जरूरत से कोई भी parameter use के सकते है।
जैसे : color=, linestyle=, marker=, etc.
Color : color में हम कोई भी color name या color code दे सकते है इससे plot का color change हो जाएगा।
Type of Plots
Bar Plot
Histogram
Scatter Plot
Pie Chart
Stem Plot
Stack Plot