We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
a
Short Answer Type ‘A
Questions (3 marks each)
Q.1. Consider the chart given below:
Scatter Plot
10
8
ae
&
4
2
Sun Sat Thur Fri
Day
Write suitable Python statements for the following
if matplotlib.pyplot is imported as plt
(i) To add title as given in the chart
(ii) To add label at x-axis
(iii) To show the plot on the screen
(i) plt-title(“Scatter Plot”)
(ii) plt.xlabel(Day’)
(iii) plt.show()
Q.2. Carefully observe the chart given below:
Crop Yields in Kanto
—-- Apples
~~ Oranges
v
a 2000 2002 2004 2006 2008 2010
Write Python statements for the followin’
considering matplotlib.pyplot is imported a5 a
(i) To mark the data points for both the plots.
(ii) To add legends to the plot.
(iti) To add label to the ‘Y’ axis“€ plt.plot(years, apples, marker=’o’)
pltplot(years,orange, marker =’x’)
(ii) pltlegend({Apples’/Oranges’])
(iii) pltylabel(Yield(tons per hectare)’)
Q.3. Carefully observe the chart given below:
Bar Chart
10
8
10 20 30 40 50
Total Bill
Write the suitable Python statements for the
following considering that the matplotlib.pyplot
is imported as plt
(i) To plot the graph with data values Total_Bill and
Tip, when both are axes of a dataframe ‘dataset’.
(ii) To specify the width of the bars as 0.3 units.
(iii) To specify color of the bars as red.
Ans.
(i) pltbar(dataset[‘Total_Bill’], dataset{/Tip’])
(ii) plt-bar(dataset[‘Total_Bill’],
dataset[‘Tip’], width=0.3)
(iii) pltbar(dataset[’Total_Bill’],
dataset[‘Tip’], color=’red’)
Long Answer Type
Questions (4 marks each)
Q.1. Siddhant has created the following Chart for data
Visualization:
Crop Yields in Kanto
= Apples
J Oranges
2000 2002 2004 2006 2008 2010
(A) Predict the output of the following Python
Statements:
(B)
Ans.
(A)
(B)
(A)
(B)
Ans.
(A)
(B)
SUPPLEMENT 63 ea
(i) plt.plot(year,Peaches,r’)
(ii) pltshow()
Write Python statements to plot ‘+’ markers for
peaches.
OR
(For part B only)
Write Python statements to make the line and
marker both of black colour,
(i) This will plot a line graph for peaches with year
on X-axis and line colour as red.
(ii) This will show the graph on screen.
plt.plot(Year,Peaches, marker =’+’)
OR
Pit.plot(year,peaches/k+’,marker=’+’)
. Garvit has created the following chart for data
visualization:
10. °
IT 2)” 3 004) 05 5 neal
Predict the output for the following Python
statements:
(i) matplotlib.pyplot.plot(4,6, c=’b’,marker='0’)
(ii) matplotlib.pyplot.plot(5,8, s=8, marker="d’)
Write suitable Python statements to draw a line
graph, red in colour through the two points already
marked.
ORAA YO
OR
Write suitable Python statements to draw star
markers at the data points in a line graph when
data is stored in two lists x and y,
(i) This will mark a circular marker at point with
coordinates as (4,6).
(ii) This will mark a diamond marker at point at
coordinates (5,8).
X= [18]
Y=[3,10]
Matplotlib.pyplot.plot(X,Y/r’)
OR
Matplotlib.pyplot.plot(X,Y,marker="*’)
oa