Plotting with Pyplot Type C Sumita arora IP Solution


Q1. Execute the following codes and find out what happens? (Libraries have been imported already; pit is the alias name for

matplotlib pyplot)

(a)
A = np.arange(2, 20, 2)
B = np.log(A)
plt.plot(A, B)

(b)
A = np.arange(2, 20, 2)
B= np.log(A)
plt.bar(A, B)

(c)
X = np.arange(1, 18, 2.655)
B =  np.log(X)
plt.scatter(X, Y)

Will any code produce error? Why/Why not?




Q2. Write a program to add titles for the X-axis, Y-axis and for the whole chart in above codes.



Q3. plt.plot(A, B) produces (A and B are the sequences same as created in question 2) chart as:



Write codes to produce charts as shown below:





 

Q4. Given a data frame df1 as shown below:

   1990   2000   2010
a    52      340    890
b    64      480     560
c    78      688    1102
d    94      766     889

Write code to create:
(a) A scatter chart from the 1990 and 2010 columns of dataframe df1
(b) A line chart from the 1990 and 2000 columns of dataframe df1
(c) Create a bar chart plotting the three columns of dataframe dfl



Q5. The score of four teams in 5 IPL matches is available to you. Write a program to plot these in a bar chart.



Q6. The score of a team in 5 IPL matches is available to you. Write a program to create a pie chart from this data, showing the last match's performance as a wedge.



Q7. The prices of a stock for 3 months are given. Write a program to show the variations in prices for each month by 3 lines on same line chart. Make sure to add legends and labels. Show grid also.



Q8. A distribution data stores about 1000 random number Write a program to create a scatter chart from this data with varying point sizes.



Q9. Navya has started an online business. A list stores the number of orders in last 6 months. Write a program to plot this data on a horizontal bar chart.




Q10. Given the following set of data:

Weight measurements for 16 small orders of French-fries (in grams).
78 72 69 81 63 67 65 75
79 74 71 83 71 79 80 69

(a) Create a simple histogram from the above data
(b) Create a horizontal histogram from the above data
(c) Create a step type of histogram from the above data
(d) Create a cumulative histogram from the above data




Q11. Create an ndarray containing 16 values and then plot this array along with dataset of previous question in same histogram

(a) Normal histograms
(b) Cumulative histograms
(c) Horizontal histograms




Q12. Out of above plotted histograms, which ones can be used for creating frequency polygons? Can you draw frequency polygons from all the above histograms?



Q13. Create / draw frequency polygon from the data used in above questions.




Q14. From the following ordered set of data:

63, 65, 67, 69, 69, 71, 71, 72, 74, 75, 78, 79, 79, 80, 81, 83

(a) Create a horizontal boxplot
(b) Create a vertical boxplot
(c) Show means in the boxplot
(d) Create boxplot without the box




Q15. Sina has created ordered set of data from the number of new customers registered on his online service center in last 20 months.
Write a program to plot this data on a filled boxplot with means shown.


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post