0% found this document useful (0 votes)
25 views40 pages

France Temperature Line Plot

The document contains Python code for creating various line plots, scatter plots, and histograms to visualize and compare temperature data from France and Japan, as well as student age data from machine learning and Python courses. The code explores different visualization options including styling, colors, labels, legends, grids, subplots, and overlays. Multiple plots are created within each code cell to demonstrate different plotting parameters and techniques.

Uploaded by

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

France Temperature Line Plot

The document contains Python code for creating various line plots, scatter plots, and histograms to visualize and compare temperature data from France and Japan, as well as student age data from machine learning and Python courses. The code explores different visualization options including styling, colors, labels, legends, grids, subplots, and overlays. Multiple plots are created within each code cell to demonstrate different plotting parameters and techniques.

Uploaded by

sai yogesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

In 

[1]: import [Link] as plt

Line Plot

In [2]: days = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

temperature = [36.6,37,37.7,39,40.1,43,43.4,45,45.6,40.1,44,45,46.8,47,47.8]

[Link](days,temperature)

# [Link]([0,30,0,50])

[Link]('France Temperature')

[Link]('Days')

[Link]('Temperature')

[Link]()

In [3]: from matplotlib import style

days = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

temperature = [36.6,37,37.7,39,40.1,43,43.4,45,45.6,40.1,44,45,46.8,47,47.8]

[Link]('ggplot')

[Link](days,temperature,color = 'm',marker = 'o',linestyle = '--',linewidth =


# [Link]([0,30,0,50])

[Link]('France Temperature',fontsize = 14)

[Link]('Days',fontsize = 12)

[Link]('Temperature',fontsize = 12)

[Link](['Temp Line'],loc = 0)

# [Link]()

[Link]()

In [4]: from matplotlib import style

days = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

temperature = [36.6,37,37.7,39,40.1,43,43.4,45,45.6,40.1,44,45,46.8,47,47.8]

[Link]('ggplot')

[Link](days,temperature,color = 'red',marker = 'o',linestyle = '--',linewidth


# [Link]([0,30,0,50])

[Link]('France Temperature',fontsize = 14)

[Link]('Days',fontsize = 12)

[Link]('Temperature',fontsize = 12)

[Link](['Temp Line'],loc = 0)

[Link](color = 'green',linestyle = '-',linewidth = 1)

[Link]()

In [5]: from matplotlib import style

days = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

france_temperature = [36.6,37,37.7,39,40.1,43,43.4,45,45.6,40.1,44,45,46.8,47,4
japan_temperature = [39,39.4,40,40.7,41,42.5,43.5,44,44.9,44,45,45.1,46,47,46]

[Link]('ggplot')

[Link](figsize = (15,9))

[Link](days,france_temperature,color = 'red',marker = 'o',linestyle = '--',li


[Link](days,japan_temperature,color = 'green',marker = 'o',linestyle = '--',l
# [Link]([0,30,0,50])

[Link]('France & Japan Temperature',fontsize = 14,color = 'blue')

[Link]('Days',fontsize = 12,color = 'm')

[Link]('Temperature',fontsize = 12,color = 'red')

# [Link](['Temp Line'],loc = 0)

[Link](loc = 0)

[Link](color = 'white',linestyle = '-',linewidth = 1)

[Link]()

In [6]: x = [1,2,3,4,5,6,7,8]

y = [1,2,3,4,3,2,9,12]

fig, ax = [Link]()

[Link](x,y,'k')

[Link] = (20,5)

# [Link](b = True)

# ax = [Link]()
# ax.set_facecolor()

[Link](0)

[Link](0,4,facecolor = 'green',alpha = 0.5)

[Link](4,9,facecolor = 'yellow',alpha = 0.5)

[Link](9,12,facecolor = 'red',alpha = 0.5)

[Link]()

In [7]: import [Link] as plt

import random

# generate random data

elevation = [[Link](-y -1, 0) for y in range(10)]

distance = range(10)

# get reference to axes

fig, ax = [Link]()

# plot data with a yellow line

[Link](distance, elevation, 'y', linewidth=3)

# format axes

[Link]()

[Link](0)

ax.set_ylabel('elevation (m)')

ax.set_xlabel('position')

ax.set_ylim([min(elevation) - 1, max(elevation) + 1])

# get range of axes

ymin, ymax = ax.get_ylim()

xmax = max(distance)

# set background colours

[Link](ymin, ymax, 0 / xmax, 3 / xmax, facecolor='green')

[Link](ymin, ymax, 3 / xmax, 8 / xmax, facecolor='brown')

[Link](ymin, ymax, 8 / xmax, 9 / xmax, facecolor='blue')

# display graph

[Link]()

Histogram

In [8]: import [Link] as plt

import numpy as np

import random

In [9]: ml_student_age = [Link](18,45,(100))

py_student_age = [Link](15,40,(100))

print(ml_student_age)

print(py_student_age)

[20 34 27 28 28 33 39 38 40 44 32 35 41 37 33 36 26 26 24 18 29 42 24 25

28 41 36 26 36 29 21 35 22 29 32 38 36 38 37 26 32 26 22 23 35 41 26 27

32 20 36 38 27 29 23 21 18 21 20 29 44 18 36 28 27 29 42 21 31 28 18 21

26 25 43 19 43 20 40 36 34 30 28 30 30 18 21 40 43 31 28 20 37 25 26 29

26 40 21 19]

[35 36 15 29 32 24 23 33 38 27 15 37 33 16 36 35 24 36 23 21 16 22 29 21

33 18 34 17 33 19 39 31 27 36 35 19 38 29 28 34 22 38 32 38 37 17 22 23

19 31 39 35 16 30 27 24 21 30 29 22 19 18 22 25 27 16 30 17 16 21 24 36

19 29 22 36 36 31 32 22 16 25 16 20 27 36 38 24 24 23 27 16 27 38 27 27

38 28 35 17]

In [10]: [Link](figsize = (15,9))

[Link](ml_student_age,color = 'pink')

[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](['ML Students'],loc = 0)

[Link]()

In [11]: bins = [15,20,25,30,35,40,45]

[Link](ml_student_age,bins,rwidth = 0.8,color = 'blue',histtype = 'step')

[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link]()

In [12]: bins = [15,20,25,30,35,40,45]

[Link](ml_student_age,bins,rwidth = 0.8,color = 'y',orientation = 'horizontal


[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link]()

In [13]: bins = [15,20,25,30,35,40,45]

[Link](ml_student_age,bins,rwidth = 0.8,color = 'red',orientation = 'horizont


[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link]()

In [14]: bins = [15,20,25,30,35,40,45]

[Link](ml_student_age,bins,rwidth = 0.8,color = 'y')

[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link]()

In [15]: # bins = [15,20,25,30,35,40,45]

# [Link](ml_student_age,bins,color = 'green')

# [Link]('ML Students Age')

# [Link]('Students Age Cotegory')

# [Link]('Numbers Students Age')

# [Link]()

In [16]: [Link](ml_student_age,color = 'red',label = 'ML Students')

[Link](py_student_age,color = 'green',label = 'Python Students')

[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [17]: [Link](ml_student_age,color = 'red',label = 'ML Students',orientation = 'hori


[Link](py_student_age,color = 'green',label = 'Python Students')

[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [18]: [Link](ml_student_age,color = 'red',label = 'ML Students',orientation = 'hori


[Link](py_student_age,color = 'green',label = 'Python Students',histtype = 'b
[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [19]: [Link](ml_student_age,color = 'red',label = 'ML Students',orientation = 'vert


[Link](py_student_age,color = 'green',label = 'Python Students',orientation =
[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [20]: [Link](figsize = (15,9))

[Link]([ml_student_age,py_student_age],color = ['m','y'],label = ['ML Student


# [Link](py_student_age,color = 'green',label = 'Python Students',orientation
[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [21]: [Link](figsize = (15,9))

[Link]([ml_student_age,py_student_age],color = ['pink','white'],label = ['ML


# [Link](py_student_age,color = 'green',label = 'Python Students',orientation
[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [22]: [Link](figsize = (15,9))

[Link](ml_student_age,color = 'pink',label = 'ML Students')

[Link](py_student_age,color = 'white',label = 'Python Students')

[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [23]: ax = [Link]()

# [Link](figsize = (15,9))

# [Link](facecolor = 'r')

ax.set_facecolor('violet')

[Link]([ml_student_age,py_student_age],color = ['pink','white'],label = ['ML


# [Link](py_student_age,color = 'green',label = 'Python Students',orientation
[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [24]: ax = [Link]()

# [Link](figsize = (15,9))

ax.set_facecolor('black')

[Link]([ml_student_age,py_student_age],color = ['pink','white'],label = ['ML


# [Link](py_student_age,color = 'green',label = 'Python Students',orientation
[Link]('ML Students Age')

[Link]('Students Age Cotegory')

[Link]('Numbers Students Age')

[Link](loc = 0)

[Link]()

In [25]: [Link](facecolor = 'y')

ax = [Link]()

# [Link](figsize = (15,9))

# [Link](facecolor = 'r')

ax.set_facecolor('violet')

[Link]([ml_student_age,py_student_age],color = ['r','g'],label = ['ML Student


# [Link](py_student_age,color = 'green',label = 'Python Students',orientation
[Link]('ML Students Age',color = 'white',fontsize = 15)

[Link]('Students Age Cotegory',color = 'black',fontsize = 12)

[Link]('Numbers Students Age',color = 'black',fontsize = 12)

[Link](color = 'black',linestyle = '--',linewidth = 1)

[Link](loc = 0)

[Link]()

Bar Chart

In [26]: import [Link] as plt

import numpy as np

from matplotlib import style

In [27]: classes = ['Python','R','AI','ML','DS']

class1_students = [30,10,20,25,10]

class2_students = [40,5,20,20,10]

class3_students = [35,5,30,15,15]

class4_students = [25,5,35,20,15]

In [28]: [Link](classes,class1_students)

<BarContainer object of 5 artists>


Out[28]:
In [29]: [Link](classes,class1_students)

<BarContainer object of 5 artists>


Out[29]:

In [30]: [Link](classes,class1_students,width = 0.2,align = 'edge',color = 'g',edgecolo

<BarContainer object of 5 artists>


Out[30]:

In [31]: [Link]('ggplot')

[Link](figsize = (12,9))

[Link](classes,class1_students,width = 0.6,align = 'edge',color = 'blue',edgec


[Link]('Students Classes',fontsize = 25,color = 'b')

[Link]('Classes',fontsize = 15)

[Link]('Number Of Students',fontsize = 15)

[Link](loc = 0)

[Link]()

In [32]: [Link](figsize = (12,9))

classes_index = [Link](len(classes))

width = 0.2

[Link](classes_index,class1_students,width,color = 'b',label = 'Class 1 Studen


[Link](classes_index + width,class2_students,width,color = 'g',label = 'Class
[Link](classes_index + width,classes)

[Link]('Students Classes',fontsize = 20,color = 'k')

[Link]('Classes',fontsize = 15,color = 'k')

[Link]('Number Of Students',fontsize = 15,color = 'k')

[Link](loc = 0)

[Link]()

In [33]: [Link](figsize = (12,9))

classes_index = [Link](len(classes))

width = 0.2

[Link](classes_index,class1_students,width,color = 'b',label = 'Class 1 Studen


[Link](classes_index + width,class2_students,width,color = 'g',label = 'Class
[Link](classes_index + width + width,class3_students,width,color = 'y',label =
[Link](classes_index + width,classes)

[Link]('Students Classes',fontsize = 20) # ,color = 'k')

[Link]('Classes',fontsize = 15) # ,color = 'k')

[Link]('Number Of Students',fontsize = 15) # ,color = 'k')

[Link](loc = 0)

[Link]()

In [34]: [Link](figsize = (12,9))

classes_index = [Link](len(classes))

width = 0.2

[Link](classes_index,class1_students,width,color = 'b',label = 'Class 1 Studen


[Link](classes_index + width,class2_students,width,color = 'g',label = 'Class
[Link](classes_index + width + width,class3_students,width,color = 'y',label =
[Link](classes_index + width + width + width,class4_students,width,color = 'r
[Link](classes_index + width,classes)

[Link]('Students Classes',fontsize = 20) # ,color = 'k')

[Link]('Classes',fontsize = 15) # ,color = 'k')

[Link]('Number Of Students',fontsize = 15) # ,color = 'k')

[Link](loc = 0)

[Link]()

In [35]: [Link](figsize = (15,9))

classes_index = [Link](len(classes))

width = 0.2

[Link](classes_index,class1_students,width,color = 'b',label = 'Class 1 Stude


[Link](classes_index + width,class2_students,width,color = 'g',label = 'Class
[Link](classes_index + width + width,class3_students,width,color = 'y',label
[Link](classes_index + width + width + width,class4_students,width,color = 'r
[Link](classes_index + width,classes)

[Link]('Students Classes',fontsize = 20) # ,color = 'k')

[Link]('Classes',fontsize = 15) # ,color = 'k')

[Link]('Number Of Students',fontsize = 15) # ,color = 'k')

[Link](loc = 0)

[Link]()

In [36]: # [Link](figsize = (12,9))

classes_index = [Link](len(classes))

width = 0.2

[Link](classes_index,class1_students,width,color = 'b',label = 'Class 1 Stude


[Link](classes_index + width,class2_students,width,color = 'g',label = 'Class
[Link](classes_index + width + width,class3_students,width,color = 'y',label
[Link](classes_index + width,classes)

[Link]('Students Classes',fontsize = 20) # ,color = 'k')

[Link]('Classes',fontsize = 15) # ,color = 'k')

[Link]('Number Of Students',fontsize = 15) # ,color = 'k')

[Link](loc = 0)

[Link]()

Scatter Plot
In [37]: import [Link] as plt

import pandas as pd

In [38]: df_google_plat_store_apps = pd.read_csv('C:\\Users\prasad jadhav\Downloads\Pand


df_google_plat_store_apps.shape

(1000, 13)
Out[38]:

In [39]: df_google_plat_store_apps.head(5)

Out[39]: Content
App Category Rating Reviews Size Installs Type Price
Rating

Photo
Editor &
Candy
0 ART_AND_DESIGN 4.1 159 19M 10,000+ Free 0 Everyone Art &
Camera &
Grid &
ScrapBook

Coloring
1 book ART_AND_DESIGN 3.9 967 14M 500,000+ Free 0 Everyone Design;
moana

U
Launcher
Lite –
2 FREE Live ART_AND_DESIGN 4.7 87510 8.7M 5,000,000+ Free 0 Everyone Art &
Cool
Themes,
Hide ...

Sketch -
3 Draw & ART_AND_DESIGN 4.5 215644 25M 50,000,000+ Free 0 Teen Art &
Paint

Pixel Draw
- Number
4 Art ART_AND_DESIGN 4.3 967 2.8M 100,000+ Free 0 Everyone
Design;Cr
Coloring
Book

In [40]: x = df_google_plat_store_apps['Rating']

y = df_google_plat_store_apps['Reviews']

[Link](x,y)

<[Link] at 0x28030a34850>
Out[40]:
In [41]: x = df_google_plat_store_apps['Rating']

y = df_google_plat_store_apps['Reviews']

[Link](x,y, color = 'r')

[Link]('Google Play Store Apps',color = 'r')

[Link]('Rating')

[Link]('Reviews')

[Link]()

In [42]: [Link](figsize = (15,9))

x = df_google_plat_store_apps['Rating']

y = df_google_plat_store_apps['Reviews']

[Link](x,y, color = 'r',marker = '*',s = 100) # ,alpha = 0.5)

[Link]('Google Play Store Apps',color = 'r')

[Link]('Rating')

[Link]('Reviews')

[Link]()

In [43]: [Link](figsize = (15,9))

x = df_google_plat_store_apps['Rating']

y = df_google_plat_store_apps['Reviews']

[Link](x,y, color = 'green',marker = '+',s = 75) # ,linewidths = 10) # ,al


[Link]('Google Play Store Apps',color = 'k')

[Link]('Rating')

[Link]('Reviews')

[Link]()

In [44]: # [Link](figsize = (15,9))

# x = df_google_plat_store_apps['Rating']

# y = df_google_plat_store_apps['Reviews']

# [Link](x,y, color = 'r',marker = '+',s = 75,linewidths = 10,alpha = 0.5,


# [Link]('Google Play Store Apps',color = 'k')

# [Link]('Rating')

# [Link]('Reviews')

# [Link]()

In [45]: [Link](figsize = (15,9))

x = df_google_plat_store_apps['Rating']

y = df_google_plat_store_apps['Reviews']

# [Link](x,y, color = 'r',marker = '+',s = 75) # ,linewidths = 10,alpha =


[Link](x,y,color = 'g',marker = '+',s = 75)

[Link](x,df_google_plat_store_apps['Installs'],color = 'r',marker = '*',s


[Link]('Google Play Store Apps',color = 'k')

[Link]('Rating')

[Link]('Reviews & Installs')

[Link]()

In [46]: [Link](figsize = (15,9))

x = df_google_plat_store_apps['Rating']

y = df_google_plat_store_apps['Reviews']

# [Link](x,y, color = 'r',marker = '+',s = 75) # ,linewidths = 10,alpha =


[Link](x,y,color = 'g',marker = '+',s = 100,linewidths = 10,alpha = 0.5,ed
[Link](x,df_google_plat_store_apps['Installs'],color = 'b',marker = '*',s
[Link]('Google Play Store Apps',color = 'k')

[Link]('Rating')

[Link]('Reviews & Installs')

[Link]()

C:\Users\prasad jadhav\AppData\Local\Temp\ipykernel_17068\[Link]: UserW


arning: You passed a edgecolor/edgecolors ('b') for an unfilled marker ('+').
Matplotlib is ignoring the edgecolor in favor of the facecolor. This behavior
may change in the future.

[Link](x,y,color = 'g',marker = '+',s = 100,linewidths = 10,alpha = 0.


5,edgecolors = 'b')

In [47]: ax = [Link]()

ax.set_facecolor('violet')

# [Link](figsize = (15,9))

[Link](facecolor = 'm')

x = df_google_plat_store_apps['Rating']

y = df_google_plat_store_apps['Reviews']

# [Link](x,y, color = 'r',marker = '+',s = 75) # ,linewidths = 10,alpha =


[Link](x,y,color = 'green',marker = '+',s = 75) # ,linewidths = 10,alpha =
[Link](x,df_google_plat_store_apps['Installs'],color = 'red',marker = '*'
[Link]('Google Play Store Apps',color = 'white')

[Link]('Rating',color = 'white')

[Link]('Reviews & Installs',color = 'white')

[Link](color = 'black',linestyle = '--',linewidth = 1)

[Link]()

In [48]: import numpy as np

import [Link] as cm

import [Link] as plt

N = 256

angle = [Link](0,8 * 2 * [Link], N)

radius = [Link](.5,1., N)

X = radius * [Link](angle)

Y = radius * [Link](angle)

[Link](figsize = (15,9))

[Link](X,Y, c = angle, cmap = [Link])

[Link]()

Pie Chart

import [Link] as plt

In [49]:

In [50]: classes = ['Python','R','Machine Learning','Artificial Intelligence','Data Scie


class1_students = [45,15,35,25,30]

[Link](class1_students,labels = classes)

[Link]()

In [51]: classes = ["Python", "R", "Machine Learning", "Artificial Intelligence", "Data


class1_students = [45,15,35,25,30]

explode = [0.2,0,0.1,0,0]

textprops = {"fontsize":11}

[Link](figsize = (5,5))

# colors = ['']

[Link](class1_students, labels = classes, explode = explode, autopct = "%0.1f%


# [Link](loc = 2)
[Link]()

In [52]: # classes = ["Python", "R", "Machine Learning", "Artificial Intelligence", "Dat


#

# class1_students = [45,15,35,25,30]

# explode = [0.2,0,0.1,0,0]

# textprops = {"fontsize":11}

# [Link](figsize = (5,5))

# # colors = ['']

# wedgeprops = {'linewidth': 4,'width': 1,'edgecolor': 'k'}

# [Link](class1_students, labels = classes, explode = explode, autopct = "%0.1


# [Link](loc = 2)
# [Link]()

In [53]: # import numpy as np

# [Link](figsize=(7,4))

# #[Link](figsize=(16,9)

# colors = ['r','w','r','w','r','w','r','w','r','w','r','w','r','w','r','w','r
# labels = [Link](20)

# #labels = [1.0,1.0,1.0,1.0,1.0,.........,1.0]

# [Link]([1], colors="k", radius = 2.05)

# [Link](labels, colors=colors, radius = 2.0)

# [Link]([1], colors="g", radius = 1.8)

# [Link]([1], colors="y", radius = 1.6)

# [Link]([1], colors="c", radius = 1.3)

# [Link]([1], colors="b", radius = 1.1)

# [Link]([1], colors="m", radius = 0.9)

# [Link]([1], colors="b", radius = 0.31)

# [Link](labels, colors=colors, radius = 0.3)

# [Link]([1], colors="w", radius = 0.2)

# [Link]([1], colors="k", radius = 0.1)

# [Link]()

Subplot

In [54]: import numpy as np

import [Link] as plt

In [55]: fig = [Link](figsize=(10,8))

a1 = fig.add_subplot(331)

a2 = fig.add_subplot(332)

a3 = fig.add_subplot(333)

a4 = fig.add_subplot(334)

a5 = fig.add_subplot(335)

a6 = fig.add_subplot(336)

a7 = fig.add_subplot(337)

a8 = fig.add_subplot(338)

a9 = fig.add_subplot(339)

In [56]: fig = [Link](figsize=(10,8))

a1 = fig.add_subplot(521)

a2 = fig.add_subplot(522)

a3 = fig.add_subplot(523)

a4 = fig.add_subplot(524)

a5 = fig.add_subplot(525)

a6 = fig.add_subplot(526)

a7 = fig.add_subplot(527)

a8 = fig.add_subplot(528)

a9 = fig.add_subplot(529)

a10 = fig.add_subplot(5,2,10)

In [57]: # x = [Link]([0,1,2,3])

# y = [Link]([3,8,1,10])

# [Link](1,2,1)

# [Link](x,y)

# x = [Link]([0,1,2,3])

# y = ([10,20,30,40])
#

# [Link](1,2,2)

# [Link](x,y)

# [Link]()

In [58]: # x = [Link]([0,1,2,3])

# y = [Link]([3,8,1,10])

# [Link](2,1,1)

# [Link](x,y)

# x = ([0,1,2,3])

# y = ([10,20,30,40])
#

# [Link](2,1,2)

# [Link](x,y)

# [Link]()

In [59]: [Link](figsize = (8,8))

[Link](2,2,1)

[Link](X,Y,color = 'blue')

[Link](2,2,2)

[Link](X,Y,color = 'red')

[Link](2,2,3)

[Link](X,Y,color = 'green')

[Link](2,2,4)

[Link](X,Y,color = 'black')

[Link]()

In [60]: [Link](figsize = (8,8))

[Link](2,2,1)

[Link](x,y,color = 'blue')

[Link](2,2,2)

[Link](x,y,color = 'red')

[Link](2,2,3)

[Link](x,y,color = 'green')

[Link](2,2,4)

[Link](x,y,color = 'black')

[Link]()

Save Figure

In [61]: # [Link]([40,30,20])
# [Link]('Pie_Chart',dpi = 100,quality = 99,facecolor = 'white')

# [Link]()

Image Show & Color Bar

In [62]: import [Link] as plt

import [Link] as mpimg

In [63]: img = [Link]("pjofficial_windows11.png")

In [64]: img

array([[[0.23529412, 0.18039216, 0.8666667 , 1. ],

Out[64]:
[0.23529412, 0.18039216, 0.8666667 , 1. ],

[0.23529412, 0.18039216, 0.8666667 , 1. ],

...,

[0.21176471, 0.08235294, 0.627451 , 1. ],

[0.21176471, 0.08235294, 0.627451 , 1. ],

[0.21176471, 0.08235294, 0.627451 , 1. ]],

[[0.2 , 0.14117648, 0.85490197, 1. ],

[0.2 , 0.14117648, 0.85490197, 1. ],

[0.2 , 0.14117648, 0.85490197, 1. ],

...,

[0.17254902, 0.04313726, 0.6 , 1. ],

[0.17254902, 0.04313726, 0.6 , 1. ],

[0.17254902, 0.04313726, 0.6 , 1. ]],

[[0.2 , 0.14117648, 0.85882354, 1. ],

[0.2 , 0.14117648, 0.85882354, 1. ],

[0.2 , 0.14117648, 0.85882354, 1. ],

...,

[0.16862746, 0.03529412, 0.60784316, 1. ],

[0.16862746, 0.03529412, 0.60784316, 1. ],

[0.16862746, 0.03529412, 0.60784316, 1. ]],

...,

[[0.04705882, 0.00392157, 0.12156863, 1. ],

[0.04705882, 0.00392157, 0.12156863, 1. ],

[0.04705882, 0.00392157, 0.12156863, 1. ],

...,

[0.08627451, 0.01568628, 0.24313726, 1. ],

[0.08627451, 0.01568628, 0.24313726, 1. ],

[0.08627451, 0.01568628, 0.24313726, 1. ]],

[[0.04705882, 0.00392157, 0.12156863, 1. ],

[0.04705882, 0.00392157, 0.12156863, 1. ],

[0.04705882, 0.00392157, 0.12156863, 1. ],

...,

[0.08235294, 0.01176471, 0.23921569, 1. ],

[0.08235294, 0.01176471, 0.23921569, 1. ],

[0.08235294, 0.01176471, 0.23921569, 1. ]],

[[0.09019608, 0.04705882, 0.16470589, 1. ],

[0.09019608, 0.04705882, 0.16470589, 1. ],

[0.09019608, 0.04705882, 0.16470589, 1. ],

...,

[0.1254902 , 0.05490196, 0.28235295, 1. ],

[0.1254902 , 0.05490196, 0.28235295, 1. ],

[0.1254902 , 0.05490196, 0.28235295, 1. ]]], dtype=float32)

In [65]: type(img)

[Link]
Out[65]:

In [66]: [Link]

(1836, 3264, 4)
Out[66]:

In [67]: [Link]

3
Out[67]:

In [68]: single_channel = img[:,:,1]

[Link](figsize = (10,10))

[Link]("off")

[Link](single_channel, cmap = "binary")

[Link]()

[Link]()

In [69]: single_channel1 = img[:,:,1]

[Link](figsize = (10,10))

[Link]("off")

[Link](single_channel1, cmap = "Blues")

[Link]()

[Link]()

In [70]: single_channel2 = img[:,:,1]

[Link](figsize = (10,10))

[Link]("off")

[Link](single_channel2, cmap = "Oranges")

[Link]()

[Link]()

In [71]: [Link](figsize = (15,15))

[Link](321)

img = [Link]("pjofficial_windows11.png")

img

single_channel = img[:,:,1]

#[Link](figsize = (10,10))

[Link]("off")

[Link](single_channel, cmap = "binary")

[Link]()

[Link]()

[Link](figsize = (15,15))

[Link](322)

img1 = [Link]("pjofficial_windows11.png")

img1

single_channel1 = img[:,:,1]

#[Link](figsize = (10,10))

[Link]("off")

[Link](single_channel1, cmap = "Blues")

[Link]()

[Link]()

[Link](figsize = (15,15))

[Link](323)

img2 = [Link]("pjofficial_windows11.png")

img2

single_channel2 = img[:,:,1]

#[Link](figsize = (10,10))

[Link]("off")

[Link](single_channel2, cmap = "Oranges")

[Link]()

[Link]()

[Link]()

CampusX
In [72]: import [Link] as plt

# from matplotlib import style

%matplotlib inline

Pie Chart

In [73]: areas = ['Marketing','Sale','Development','HR','Customer Support']


budget = [2.5,4,10,1,6]

In [74]: [Link](budget,labels = areas,autopct = '%0.2f%%')

[Link](loc = 2)

[Link]()

Scatter Plot

In [75]: x = [23,45,12,49,97,32,11,44]

y = [45,34,67,87,55,22,89,90]

[Link](x,y,color = 'r')

[Link]('Age & Salary Graph')

[Link]('Age')

[Link]('Salary')

[Link]()

2D Plot

In [76]: product_id = [1,2,3,4,5,6,7,8]

online_price = [233,456,770,120,222,444,200,300]

offline_price = [400,300,100,333,444,565,456,899]

chor_bazaar = [100,200,300,400,150,250,450,500]

jio_mart = [100,198,225,319,429,99,25,11]

In [77]: [Link](product_id,online_price,color = 'red',marker = 'o',markersize = 5,labe


[Link](product_id,offline_price,color = 'green',marker = '*',markersize = 5,l
[Link](product_id,chor_bazaar,color = 'blue',marker = '+',markersize = 5,labe
[Link](product_id,chor_bazaar,color = 'yellow',marker = '^',markersize = 5,la

[Link]('Product Price Comparision',fontsize = 13)

[Link]('Product')

[Link]('Price')

[Link](loc = 0)

[Link]()

Bar Graph

In [78]: year = [2012,2013,2014,2015,2016,2017,2018]

price = [65000,69000,75000,55000,52000,64000,81000]

[Link](year,price,color = 'red')

[Link]('Year By Year Comparision')

[Link]('Years')

[Link]('Price INR')

[Link]()

Step Plot

In [79]: x = [1,2,3,4,5]

y = [1,2,3,4,5]

[Link](x,y,color = 'red',marker = 'o')

[Link]()

Fill Between

In [80]: import numpy as np

x = [Link]([1,2,3,4,5])

y = [Link]([1,2,3,4,5])

[Link](x,y,color = 'red',marker = 'o')

plt.fill_between(x,y,color = 'green',where = (x>=2) & (x<=4))

[Link]()

3D Plot

In [1]: import ipywidgets as widgets

from mpl_toolkits import mplot3d

import numpy as np

import [Link] as plt

In [2]: def theta(t):

fig = [Link](figsize = (10,15))

ax = [Link](projection = '3d')

z = [Link](0,t,500)

x = [Link](z)

y = [Link](z)

ax.plot3D(x,y,z,color = 'red')

[Link]()

[Link](theta,t = [Link](min = 0,max = 15))

[Link]()

interactive(children=(Play(value=0, description='t', max=15), Output()), _dom_


classes=('widget-interact',))

Thank You

Common questions

Powered by AI

The age distribution of Machine Learning (ML) and Python students is analyzed using histograms in various configurations. The ML student ages range from 18 to 45, while Python student ages range from 15 to 40. In the visualizations, ML and Python students' ages are represented with different colors like red for ML and green for Python. Histograms show the distribution of ages within specified bins spanning these ranges, such as 15-20, 20-25, etc. Histograms are plotted to visualize the frequency of ages in these categories, providing insights into age group distributions. For instance, an ML Students Age histogram is presented with pink color and vertical orientation, while other configurations use horizontal orientations or different bin sizes to analyze age distribution nuances .

Color schemes and styles hold immense importance in data visualization as they significantly influence how data is perceived and interpreted. The right color scheme can highlight key insights, differentiate between data categories, and improve the readability of complex datasets. Colors can convey emotions and draw attention to specific areas in a plot. Styles like 'ggplot' provide aesthetic templates that ensure consistency and visual appeal, helping viewers understand the visual narrative quickly. Poor choice of colors can hinder interpretation, leading to confusion or misinterpretation, especially for people with color vision deficiencies, showing the need for thoughtful use of accessible colors .

3D plots allow for the visualization of complex data dimensions by representing data points in a three-dimensional space, combining axes that represent different variables. This enables the examination of patterns and relationships across multiple dimensions that are not easily captured in 2D plots. Benefits include the ability to convey complex relationships and interactions between variables, often revealing multifaceted trends and patterns. Challenges include difficulty in interpreting 3D plots from certain perspectives, especially when dealing with occlusion and overlapping points, which can cause loss of data visibility. Interactive tools can help mitigate these challenges by allowing users to rotate and zoom into the plots for better clarity .

Step plots and area plots are significant in representing temporal data trends and changes as they provide clear visual cues about shifts and trends over time. Step plots highlight data changes at specific intervals, ideal for discrete data points where sudden changes or step functions are important to show, such as price changes over years. Area plots, especially the fill-between variant, effectively illustrate cumulative changes and are used to visualize the magnitude of change over time by filling the area below the line plot, thus making trend comparisons intuitive. These visualizations are particularly effective because they give a clear indication of rising and falling trends and help identify periods of growth or recession more clearly than line plots .

Pie charts effectively portray the distribution of budget across different organizational areas by representing each area as a proportional slice of a pie. This visual form helps in quickly understanding the relative size of each category. To enhance readability and comprehension, labels with area names and percentage values are included. Explode effects are applied to emphasize certain slices, for example, larger budgets might be slightly detached to draw attention. Other design considerations include consistent color schemes to distinguish slices clearly, ensuring the pie chart is not too complex to maintain ease of interpretation, and using a legend for additional clarity .

Image processing within data visualization frameworks allows for the enhancement and analysis of image data, providing another dimension of data representation. It is significant in projects requiring the manipulation and display of image data, such as medical imaging or remote sensing data. Processing enables manipulation of image attributes like contrast, color mappings, and channel extraction, as seen in applications where single channels of an image are extracted and displayed using specific color maps (e.g., binary, blues). These techniques enable detailed exploration of image features, enhancing visual analysis and interpretation by emphasizing specific image data aspects .

Subplotting allows the display of multiple related datasets simultaneously by dividing a figure into a grid layout, where each cell can contain a different plot. This technique is beneficial for presenting complex data analyses where comparing or contrasting different datasets on the same axis system is necessary. In implementation, matplotlib’s `subplot` function is used, specifying the grid size and the plot position. Example configurations include 2x2 or 3x3 grids for smaller visualization areas. Titles, axes labels, and color coding maintain clarity and coherence across subplots, allowing for comprehensive data comparison without clutter in a single figure .

Scatter plots are utilized to examine the relationship between app ratings and the number of reviews by plotting individual app entries as data points on a 2D plane with ratings on the x-axis and review counts on the y-axis. The scatter plots reveal trends and correlations between high-rated apps and their review counts, indicating potential popularity or consumer satisfaction levels. Different aesthetic styles are employed, such as using red markers for data points, varying marker sizes and colors, and adding titles and labels for clarity. Observations might include a positive correlation between reviews and ratings for apps, with denser clusters indicating more common rating-review combinations. This visualization aids in identifying outliers and examining the spread of app popularity across different rating levels .

Bar charts are used to compare the student populations across different classes by plotting the number of students in each class as bars, allowing for easy visual comparison. The classes include Python, R, Machine Learning, Artificial Intelligence, and Data Science. Techniques such as adjusting bar width and color are employed; for example, bars are assigned distinct colors like blue for class 1 students and green for class 2 students. Additionally, multi-bar charts are created to show distributions across several data series by plotting them as grouped bars, using indices and a specified width for alignment. The ggplot style is also applied for visual consistency, and legends are used to differentiate between groups .

Pie charts offer several benefits in data representation; they provide a straightforward and visually appealing way to convey proportions of a whole, allowing viewers to quickly grasp the relative sizes of categories. They are particularly effective with simple, small datasets. However, pie charts pose drawbacks in complex datasets, as they can become cluttered and difficult to interpret accurately with too many slices. Problems in perceiving small differences between similar-sized slices can mislead interpretation. Complex datasets benefit more from other charts like bar graphs, which handle categorical data more explicitly without the size distortion issues inherent to pie charts .

You might also like