Question and Answers For Pyplots
Question and Answers For Pyplots
1. Write a Python program to draw a line with suitable label in the x axis, y axis
and a title.
2. Write a Python program to draw a line using given axis values with suitable
label in the x axis , y axis and a title.
3. Write a Python program to draw line charts of the financial data of Alphabet
Inc. between October 3, 2016 to October 7, 2016.
4. Write a Python program to plot two or more lines and set the line markers.
5. Write a Python program to display the current axis limits values and set new
axis values.
7. Create a histogram that plots two ndarrays x and y with 48 bins, in stacked
horizontal histogram.
8. Write a Python program to plot several lines with different format styles in one
command using arrays.
a) gplt.plot()
b) plt.plot()
c) plt.plotgraph()
11. Point out the correct combination with regards to kind keyword for graph plotting:
a) ‘hist’ for histogram
b) ‘box’ for boxplot
c) ‘area’ for area plots
d) all of the Mentioned
12. Which of the following value is provided by kind keyword for barplot ?
a) barh
b) kde
c) hexbin
d) none of the Mentioned
13. You can create a scatter plot matrix using the __________ method in pandas.tools.plotting.
a) sca_matrix
b) scatter_matrix
c) DataFrame.plot
d) all of the Mentioned
14. Point out the wrong combination with regards to kind keyword for graph plotting:
a) ‘scatter’ for scatter plots
b) ‘kde’ for hexagonal bin plots
c) ‘pie’ for pie plots
d) none of the Mentioned
15. Which of the following plots are used to check if a data set or time series is random ?
a) Lag
b) Random
c) Lead
d) None of the Mentioned
17. Which of the following plots are often used for checking randomness in time series ?
a) Autocausation
b) Autorank
c) Autocorrelation
d) None of the Mentioned
21.What is histogram?
22. What is data visualization?
25. Name the functions that are used to create bar chart.
Answer 2:
Answer 3:
Answer 4:
Answer 5:
X =range(1,50)
plt.plot(X, Y)
plt.xlabel('x - axis')
plt.ylabel('y - axis')
plt.title('Draw a line.')
print(plt.axis())
plt.axis([0,100,0,200])
plt.show()
Answer 6:
import numpy as np
import pylab as pl
x1 =[2,3,5,6,8]
y1 =[1,5,10,18,20]
y2 =[2,6,11,20,22]
pl.axis([0,10,0,30])
pl.show()
Answer 7:
import numpy as np
t = np.arange(0.,5.,0.2)
plt.show()
Answer 8:
import numpy as np
import matplotlib.pyplot as plt
Answer 9:
plt.subplot(2, 1, 1)
plt.xticks(()), plt.yticks(())
plt.subplot(2, 3, 4)
plt.xticks(())
plt.yticks(())
plt.subplot(2, 3, 5)
plt.xticks(())
plt.yticks(())
plt.subplot(2, 3, 6)
plt.xticks(())
plt.yticks(())
plt.show()
10. The plot method on Series and DataFrame is just a simple wrapper around :
a) gplt.plot()
b) plt.plot()
c) plt.plotgraph()
Answer: b
Explanation: If the index consists of dates, it calls gcf().autofmt_xdate() to try to format the x-axis
nicely.
11. Point out the correct combination with regards to kind keyword for graph plotting:
a) ‘hist’ for histogram
b) ‘box’ for boxplot
c) ‘area’ for area plots
d) all of the Mentioned
Answer: d
Explanation: The kind keyword argument of plot() accepts a handful of values for plots other than the
default Line plot.
12. Which of the following value is provided by kind keyword for barplot ?
a) barh
b) kde
c) hexbin
d) none of the Mentioned
Answer: b
Explanation: You can create density plots using the Series/DataFrame.plot.
13. You can create a scatter plot matrix using the __________ method in pandas.tools.plotting.
a) sca_matrix
b) scatter_matrix
c) DataFrame.plot
d) all of the Mentioned
Answer: b
Explanation: You can create density plots using the Series/DataFrame.plot.
14. Point out the wrong combination with regards to kind keyword for graph plotting:
a) ‘scatter’ for scatter plots
b) ‘kde’ for hexagonal bin plots
c) ‘pie’ for pie plots
d) none of the Mentioned
Answer: b
Explanation: kde is used for density plots.
15. Which of the following plots are used to check if a data set or time series is random ?
a) Lag
b) Random
c) Lead
d) None of the Mentioned
Answer: a
Explanation: Random data should not exhibit any structure in the lag plot.
Answer: a
Explanation: There are several plotting functions in pandas.tools.plotting.
17. Which of the following plots are often used for checking randomness in time series ?
a) Autocausation
b) Autorank
c) Autocorrelation
d) None of the Mentioned
Answer: c
Explanation: If time series is random, such autocorrelations should be near zero for any and all time-
lag separations.
Answer: c
Explanation: Resulting plots and histograms are what constitutes the bootstrap plot.
Answer: a
Explanation: Curves belonging to samples of the same class will usually be closer together and form
larger structures
20.import matplotlib.pyplot.
21. A histogram is a statistical tool used to
summarized discrete or continuous data.
22. General term that describe any effort to help people understand significance
of data by placing it in visual context.
24.matplotlib.pyplot.plot()
25. matplotlib.pyplot.bar()