मशीन लर्निंग और डेटा साइंस में पायथन के प्रसिद्ध उपयोग के मामलों में से एक है। डेटासेट की कल्पना और प्लॉट करने के लिए, हम Matplotlib लाइब्रेरी का उपयोग करते हैं। टिंकर एप्लिकेशन में मैटप्लोटलिब ग्राफ को प्लॉट करने के लिए, हमें "matplotlib.pyplot से plt के रूप में प्रारंभ करके लाइब्रेरी को आयात करना होगा। ". प्लॉट को या तो श्रेणी मान को परिभाषित करके या नोटबुक में डेटासेट आयात करके खींचा जा सकता है।
उदाहरण
#Import the required Libraries
from tkinter import *
from tkinter import ttk
import numpy as np
import matplotlib.pyplot as plt
#Create an instance of Tkinter frame
win= Tk()
#Set the geometry of the window
win.geometry("700x250")
def graph():
car_prices= np.random.normal(50000,4000,2000)
plt.figure(figsize=(7,3))
plt.hist(car_prices, 25)
plt.show()
#Create a Button to plot the graph
button= ttk.Button(win, text= "Graph", command= graph)
button.pack()
win.mainloop() आउटपुट
उपरोक्त कोड को चलाने से एक विंडो प्रदर्शित होगी जिसमें एक बटन होगा।

जब हम "ग्राफ" बटन पर क्लिक करते हैं, तो यह मुख्य विंडो पर एक ग्राफ प्रदर्शित करेगा।
