0% found this document useful (0 votes)
47 views

Data Visualization

This document discusses data visualization in Python using various packages and libraries. It introduces popular visualization libraries like Matplotlib, Seaborn, Bokeh, and Altair. It then demonstrates how to create common chart types like bar charts, column charts, and grouped bar charts using the Titanic dataset in Matplotlib and Seaborn. The document shows code examples for creating basic and customized visualizations in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Data Visualization

This document discusses data visualization in Python using various packages and libraries. It introduces popular visualization libraries like Matplotlib, Seaborn, Bokeh, and Altair. It then demonstrates how to create common chart types like bar charts, column charts, and grouped bar charts using the Titanic dataset in Matplotlib and Seaborn. The document shows code examples for creating basic and customized visualizations in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

DATA VISUALIZATION

PRESENTED BY
SHAGUN RAI
JEFFREY WILLIAMS
INTRODUCTION
◦ Data visualization in python is perhaps one of the most utilized features for data science with python in
today’s day and age. The libraries in python come with lots of different features that enable users to make
highly customized, elegant, and interactive plots.

◦ In this SESSION, we will cover the usage of Matplotlib, Seaborn as well as an introduction to other
alternative packages that can be used in python visualization.

◦ Within Matplotlib and Seaborn, we will be covering a few of the most commonly used plots in the data
science world for easy visualization.
Useful packages for visualizations in python

◦ Matplotlib
◦ Seaborn
◦ Bokeh
◦ Altair
◦ Plotly
◦ Ggplot
◦ Folium
Pandas
How to use the right visualization?
Bar chart using Matplotlib
◦ #Creating the dataset

◦ df = sns.load_dataset('titanic')

◦ df=df.groupby('who')['fare'].sum().to_frame().reset_index()

◦ #Creating the bar chart

◦ plt.barh(df['who'],df['fare'],color = ['#F0F8FF','#E6E6FA','#B0E0E6'])

◦ #Adding the aesthetics

◦ plt.title('Chart title')

◦ plt.xlabel('X axis title')

◦ plt.ylabel('Y axis title')

◦ #Show the plot

◦ plt.show()
Bar chart using Seaborn
◦ #Creating the dataset
◦ df = sns.load_dataset('titanic')
◦ df=df.groupby('who')['fare'].sum().to_frame().reset_index()

◦ #Creating the bar chart


◦ plt.barh(df['who'],df['fare'],color = ['#F0F8FF','#E6E6FA','#B0E0E6'])

◦ #Adding the aesthetics


◦ plt.title('Chart title')
◦ plt.xlabel('X axis title')
◦ plt.ylabel('Y axis title')

◦ #Show the plot


◦ plt.show()
Column chart using Matplotlib

◦ #Creating the dataset


◦ df = sns.load_dataset('titanic')
◦ df=df.groupby('who')['fare'].sum().to_frame().reset_index()
◦ #Creating the column plot
◦ plt.bar(df['who'],df['fare'],color = ['#F0F8FF','#E6E6FA','#B0E0E6'])
◦ #Adding the aesthetics
◦ plt.title('Chart title')
◦ plt.xlabel('X axis title')
◦ plt.ylabel('Y axis title')
◦ #Show the plot
◦ plt.show()
Column chart using Seaborn

◦ #Reading the dataset


◦ titanic_dataset = sns.load_dataset('titanic')
◦ #Creating column chart
◦ sns.barplot(x = 'who',y = 'fare',data = titanic_dataset,palette = "Blues")
◦ #Adding the aesthetics
◦ plt.title('Chart title')
◦ plt.xlabel('X axis title')
◦ plt.ylabel('Y axis title')
◦ # Show the plot
◦ plt.show()
Grouped bar chart

◦ #Creating the dataset


◦ df = sns.load_dataset('titanic')
◦ df_pivot = pd.pivot_table(df, values="fare",index="who",columns="class", aggfunc=np.mean)
◦ #Creating a grouped bar chart
◦ ax = df_pivot.plot(kind="bar",alpha=0.5)
◦ #Adding the aesthetics
◦ plt.title('Chart title')
◦ plt.xlabel('X axis title')
◦ plt.ylabel('Y axis title')
◦ # Show the plot
◦ plt.show()
Title Lorem Ipsum

LOREM IPSUM DOLOR SIT AMET, NUNC VIVERRA IMPERDIET PELLENTESQUE HABITANT
CONSECTETUER ADIPISCING ENIM. FUSCE EST. VIVAMUS A MORBI TRISTIQUE SENECTUS ET
ELIT. TELLUS. NETUS.

You might also like