How to make a PIE plot in MATPLOTLIB | Python Basic: Data Science tips| Python tutorial for brginner

Publicado em: 14 Dezembro 2022
no canal de: DESI ASTRO
201
10

This a very beginner-level Python code to Pie plot. It helps to understand the very zeroth level of pie plotting.

Are you looking to create visually appealing pie charts in Python? Look no further! In this video, we will explore how to create pie plots in Python using the matplotlib library.

Pie plots are an excellent way to display proportions and percentages in a visually appealing manner. We will start by importing the necessary libraries and data, and then we will use matplotlib to create a pie chart.

We will cover different aspects of pie charts, including adding labels, changing the colors of slices, and exploding slices for emphasis. Additionally, we will discuss how to customize the chart's appearance, such as adjusting the font size and changing the background color.

Whether you are a data scientist, analyst, or just someone interested in creating compelling visualizations, this video is for you. By the end of this tutorial, you will have the knowledge and skills to create beautiful pie plots in Python that effectively communicate your data.

So, grab your favorite text editor and let's get started on creating some beautiful pie plots with Python and matplotlib!
----------------------------------------------------------------------------------------------------------------

Please check the earlier videos on Python plotting.

   • Python Basic Guassian fit from Scratch| Sc...  
   • Python Basic | Straight line fit from Scra...  
   • Scatter plot in Python| Python tutorials F...  



------------------------------------------------------------------------------------------------






------python code-----------------------
import modules
import numpy as np # takes care of number and array
import matplotlib.pyplot as plt # used for plotting

%matplotlib widget
it adds control to plots
#define y_data
y=np.array([4,72,24])
now add label to these y values
my_label=["Visible Matter", " Dark Energy", " Dark Matter"]
#plot pie, plot with labels
now give explode parameters
explode=[0.5,0.1,0.2] # it will separate from each other, shodow shows projection, autopct control format to labels
plt.pie(y,labels=my_label,explode=explode,startangle=45,autopct='%1.1f%%',shadow=True) # give it a starting angle, it will rotate the plot
add, title,x,y labels, controls font size,
plt.title('Matter content in The Universe', color='red',fontsize=20,fontweight='bold')


plt.show()
----------------------------------------------


Nesta página do site você pode assistir ao vídeo on-line How to make a PIE plot in MATPLOTLIB | Python Basic: Data Science tips| Python tutorial for brginner duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário DESI ASTRO 14 Dezembro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 201 vezes e gostou 10 espectadores. Boa visualização!