KEMBAR78
Data Visulization | PDF | Scatter Plot | Infographics
0% found this document useful (0 votes)
42 views2 pages

Data Visulization

Uploaded by

Vinay Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views2 pages

Data Visulization

Uploaded by

Vinay Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Data Visualization

Matplotlib

import matplotlib.pyplot as plt # library

1. Bar plot
 A bar chart uses bars to show comparisons between categories of data.
 A bar graph will always have two axis.
 One axis will generally have numerical values or measures,
 The other will describe the types of categories being compared or dimensions.

 plt.bar(x_component, y_component): Used to draw a bar graph

 plt.show(): Explicit command required to display the plot object

2. Scatter Plot

Scatter plots are used when you want to show the relationship between two facts or
measures.

Scatter plot, as the name suggests, displays how the variables are spread across the range
considered. It can be used to identify a relationship or pattern between two quantitative variables
and the presence of outliers within them.
plt.scatter(x_axis, y_axis)
plt.scatter(profit[product_category == "Technology"],
sales[product_category == "Technology"], c= 'Green',
alpha= 0.7, s = 150, label="Technology" )

plt.scatter(profit[product_category == "Office
Supplies"], sales[product_category == "Office Supplies"],
c= 'Yellow', alpha= 0.7, s = 100, label="Office Supplies"
)

plt.scatter(profit[product_category == "Furniture"],
sales[product_category == "Furniture"], c= 'Cyan', alpha=
0.7, s = 50, label="Furniture" )

for xy in zip (profit[country == "India"], sales[country


== "India"]):

plt.annotate(text = "India", xy = xy)

# Adding and formatting title


plt.title("Sales versus Profits across various Countries
and Product Categories\n", fontdict={'fontsize': 20,
'fontweight' : 5, 'color' : 'Green'})

# Labeling Axes
plt.xlabel("Profit", fontdict={'fontsize': 12,
'fontweight' : 5, 'color' : 'Brown'})

plt.ylabel("Sales", fontdict={'fontsize': 12,


'fontweight' : 5, 'color' : 'Brown'})

plt.legend()

plt.show()
Data Visualization
Line Graph and Histogram

A line chart or line plot or line graph or curve chart is a type of chart which displays
information as a series of data points called 'markers' connected by straight line segments.
Most commonly used with time data.

A line graph is used to present continuous time-dependent data. It accurately depicts the trend of
a variable over a specified time period.
plt.plot(months, sales)

# Adding and formatting title


plt.title("Sales across 2015\n", fontdict={'fontsize': 20,
'fontweight' : 5, 'color' : 'Green'})

# Labeling Axes
plt.xlabel("Months", fontdict={'fontsize': 12, 'fontweight' : 5,
'color' : 'Brown'})
plt.ylabel("Sales", fontdict={'fontsize': 12, 'fontweight' : 5,
'color' : 'Brown'} )

ticks = np.arange(0, 600000, 50000)


labels = ["{}K".format(i//1000) for i in ticks]
plt.yticks(ticks, labels)

plt.xticks(rotation=90)

for xy in zip(months, sales):


plt.annotate(text = "{}K".format(xy[1]//1000), xy = xy,
textcoords='data')

plt.show()

You might also like