- Compare bar() and barh() function using examples.
- What is the use of matplotlib and pyplot?
- A list namely temp contains average temperatures for 7 days of last week. You want to see how temperature charged in last 7 days. Which chart type will you plot for the same and why?
- Write a program to draw a sin and cos graph (with 100 continuous observations) in the same line chart.
- Given an ndarray p as ([1,2,3,4]). Write code to plot a bar chart having bars for p and p**2 (with red color) and another bar for p vs p*2 (with blue color). Assume that libraries have been included.
- Mr. Sanjay wants to plot a bar graph for the given set of values of subject on x-axis and number of students who opted for that subject on y-axis.
Complete the code to perform the following : - To plot the bar graph in statement 1
- To display the legends in the Graph in statement 2
import matplotlib.pyplot as plt x=['Hindi', 'English', 'Science', 'SST'] y=[10,20,30,40] _____________________ Statement 1 _____________________ Statement 2
Click Here for Solution - What will be the output of the following code:
import matplotlib.pyplot as p x=[6,7,8,9,10] y=[60,40,55,30,70] p.title('Secondary Class Strength') p.xlabel('Class') p.ylabel('No. of students') p.bar(x,y) p.show()
-
Fill in the blank with appropriate pyplot methods:
import matplotlib.pyplot as p Year=[2000,2002,2004,2006] Rate=[21.0,20.7,21.2,21.6] ____________________________ # To draw a line graph p.xlabel('Year') p.ylabel('Rate') p.title('Fuel Rates in every Two Year') ___________________(“Graph1.pdf”) # To save the graph p.show()
- What is the structure of a histogram if cumulative attribute is set to be True.
- Write a code to plot the speed of a passenger train as shown in the figure given below:
- Mr. Sanjay wants to plot a bar graph for the given set of values of subject on x-axis and number of students who opted for that subject on y-axis.
Complete the code to perform the following :
- To plot the bar graph in statement 1
- To display the graph in statement 2
import matplotlib.pyplot as plt x=['Hindi', 'English', 'Science', 'SST'] y=[10,20,30,40] _____________________ Statement 1 _____________________ Statement 2
- Mr. Harry wants to draw a line chart using a list of elements named LIST.
Complete the code to perform the following operations:- To plot a line chart using the given LIST.
- To give a y-axis label to the line chart named "Sample Numbers"
import matplotlib.pyplot as PLINE LIST=[10,20,30,40,50,60] _____________________ Statement 1 _____________________ Statement 2 PLINE.show()
- what is boxplot ? how do you create it in pyplot.
- Write commands to plot the chart as per given instructions:
- Plot a line y=x+5 for 100 points of x in range -50 to 50.
No comments:
Post a Comment