Data Visualization with Python
- 32Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is data visualization primarily described as?
What is data visualization primarily described as?
32 questions
- 1
What is data visualization primarily described as?
- A
The method of summarizing data using statistical measures
- B
The process of cleaning and organizing raw data
- C
The technique of storing data in visual formats like images
- D
The art of representing raw data in the form of beautiful and aesthetic graphs
Correct answer
DThe art of representing raw data in the form of beautiful and aesthetic graphs
Explanation
The content defines data visualization as 'the art of representing the raw data in the form of beautiful and aesthetic graphs.'
- A
- 2
Why is data visualization important when working with large datasets?
- A
It speeds up the data collection process
- B
It automatically generates statistical summaries of the data
- C
It reduces the size of the dataset by eliminating unnecessary columns
- D
It helps to find interesting patterns and insights that are hard to see from raw data
Correct answer
DIt helps to find interesting patterns and insights that are hard to see from raw data
Explanation
The content states that with a huge dataset, finding insights is extremely hard, and data visualization helps find interesting patterns from the data.
- A
- 3
In the example with mammoth and saber-tooth cat, what insight was easily obtained from the image?
- A
The mammoth has a speed of 75 km/h
- B
The saber-tooth cat has a speed of 25 km/h
- C
The mammoth has a low aggressiveness and a size of 13,000 lbs
- D
The saber-tooth cat is heavier than the mammoth
Correct answer
CThe mammoth has a low aggressiveness and a size of 13,000 lbs
Explanation
The content mentions that from the image, the size of mammoth is 13,000 lbs and its aggressiveness is very low.
- A
- 4
What does Anscombe's quartet demonstrate?
- A
That bar plots are better than histograms for numerical data
- B
That averages and standard deviations are sufficient to understand data
- C
That datasets with similar summary statistics can have very different graphical relationships
- D
That all four datasets have identical distributions when plotted
Correct answer
CThat datasets with similar summary statistics can have very different graphical relationships
Explanation
Anscombe's quartet shows four datasets with nearly identical sum, average, and standard deviation, but when plotted, the relationships between x and y are very different.
- A
- 5
Which of the following is NOT a Python visualization library mentioned?
- A
GG plot
- B
Matplotlib
- C
Plotly
- D
D3.js
Correct answer
DD3.js
Explanation
The content lists matplotlib, GG plot, plotly, plot lab, and seaborn. D3.js is a JavaScript library, not Python.
- A
- 6
How do you import the matplotlib pyplot module in Python?
- A
import pyplot as plt
- B
import matplotlib.pyplot as plot
- C
from matplotlib import pyplot as pl
- D
import matplotlib.pyplot as plt
Correct answer
Dimport matplotlib.pyplot as plt
Explanation
The content uses 'import matplotlib.pyplot as plt'.
- A
- 7
Which method is used to display a plot in matplotlib?
- A
plt.output()
- B
plt.display()
- C
plt.show()
- D
plt.print()
Correct answer
Cplt.show()
Explanation
The content consistently uses
plt.show()to display the plot. - A
- 8
What is the correct way to create a simple line plot in matplotlib?
- A
plt.graph(x, y)
- B
plt.chart(x, y)
- C
plt.plot(x, y)
- D
plt.line(x, y)
Correct answer
Cplt.plot(x, y)
Explanation
The content uses
plt.plot(x, y)to create a line plot. - A
- 9
How can you change the color of a line in a line plot?
- A
By using the 'linecolor' attribute
- B
By calling plt.color('red') before plotting
- C
By passing a string argument to plt.style()
- D
By setting the 'color' parameter in plt.plot()
Correct answer
DBy setting the 'color' parameter in plt.plot()
Explanation
The content shows
plt.plot(x, y, color='red')to change the line color. - A
- 10
Which method adds a title to the current plot?
- A
plt.header('Title')
- B
plt.set_title('Title')
- C
plt.title('Title')
- D
plt.title('Title')
Correct answer
Cplt.title('Title')
Explanation
The content uses
plt.title('Line Plot')to add a title. - A
- 11
How do you set labels for the x-axis and y-axis?
- A
plt.xlabel() and plt.ylabel()
- B
plt.xlabel() and plt.ylabel()
- C
plt.label(x='axis') and plt.label(y='axis')
- D
plt.x_label() and plt.y_label()
Correct answer
Bplt.xlabel() and plt.ylabel()
Explanation
The content uses
plt.xlabel()andplt.ylabel(). - A
- 12
What is the purpose of the plt.subplot() method?
- A
To embed a plot inside another plot
- B
To add a subtitle to the plot
- C
To create multiple plots in the same figure
- D
To split a plot into smaller segments
Correct answer
CTo create multiple plots in the same figure
Explanation
The content uses
plt.subplot()to create two subplots in the same figure. - A
- 13
What does the first argument in plt.subplot(nrows, ncols, index) represent?
- A
The total number of subplots
- B
The number of columns
- C
The index of the active subplot
- D
The number of rows
Correct answer
DThe number of rows
Explanation
The content explains that the first parameter is the number of images in the rows, so nrows.
- A
- 14
Which plot type is used for categorical data?
- A
Histogram
- B
Scatter plot
- C
Line plot
- D
Bar plot
Correct answer
DBar plot
Explanation
The content states that a bar plot is used for categorical values and a histogram is used for numerical values.
- A
- 15
What is the difference between a bar plot and a histogram?
- A
Bar plots have spaces between bars, histograms do not
- B
Bar plots are horizontal, histograms are vertical
- C
Bar plots are for categorical data, histograms are for numerical data
- D
Bar plots show distribution while histograms show trends
Correct answer
CBar plots are for categorical data, histograms are for numerical data
Explanation
The content explicitly says that a bar plot is used for categorical values and a histogram for numerical values.
- A
- 16
How do you create a horizontal bar plot in matplotlib?
- A
plt.barh()
- B
plt.hbar()
- C
plt.bar(horizontal=True)
- D
plt.bar(orient='horizontal')
Correct answer
Aplt.barh()
Explanation
The content mentions
plt.barh()for horizontal bar plots. - A
- 17
Which method is used to create a scatter plot?
- A
plt.scatter()
- B
plt.point()
- C
plt.dots()
- D
plt.plot() with 'o' marker
Correct answer
Aplt.scatter()
Explanation
The content uses
plt.scatter()to create scatter plots. - A
- 18
How can you change the size of points in a scatter plot?
- A
By setting the 's' parameter
- B
By setting the 'markersize' parameter
- C
By setting the 'size' parameter
- D
By setting the 'pointsize' parameter
Correct answer
ABy setting the 's' parameter
Explanation
The content uses
sparameter to change the size of points, e.g.,plt.scatter(x, a, s=200). - A
- 19
Which parameter changes the marker shape in a scatter plot?
- A
symbol
- B
shape
- C
style
- D
marker
Correct answer
Dmarker
Explanation
The content uses
markerparameter to change the shape, e.g.,marker=3ormarker=1. - A
- 20
How do you change the overall figure size in matplotlib?
- A
plt.set_size(width, height)
- B
plt.figure(figsize=(width, height))
- C
plt.resize(width, height)
- D
plt.figsize(width, height)
Correct answer
Bplt.figure(figsize=(width, height))
Explanation
The content uses
plt.figure(figsize=(10,10))to change figure size. - A
- 21
What does a histogram show?
- A
The distribution of a numerical dataset
- B
The comparison of categorical quantities
- C
The relationship between two variables
- D
The change over time
Correct answer
AThe distribution of a numerical dataset
Explanation
The content states that a histogram gives the distribution of the data.
- A
- 22
How can you change the number of bins in a histogram?
- A
By setting the 'intervals' parameter
- B
By setting the 'columns' parameter
- C
By setting the 'groups' parameter
- D
By setting the 'bins' parameter in plt.hist()
Correct answer
DBy setting the 'bins' parameter in plt.hist()
Explanation
The content uses
bins=30to change the number of bins. - A
- 23
In a box plot, what does the line inside the box represent?
- A
The mode
- B
The mean
- C
The first quartile
- D
The median
Correct answer
DThe median
Explanation
The content says 'this line which you see at the center of the box this basically denotes the median value'.
- A
- 24
What is the main difference between a box plot and a violin plot?
- A
Box plots are used for categorical data, violin plots for numerical data
- B
Violin plots are always horizontal
- C
Box plots show mean, violin plots show median
- D
The shape: box plot looks like a box, violin plot looks like a violin
Correct answer
DThe shape: box plot looks like a box, violin plot looks like a violin
Explanation
The content states 'the only difference between a box plot and a violin plot is that the shape is different. Box plot looks like a box and the violin plot looks like a violin'.
- A
- 25
Which arguments can show the median and mean in a violin plot?
- A
showmedian and showmean
- B
show_median and show_mean
- C
median and mean
- D
showmedians and showmeans
Correct answer
Dshowmedians and showmeans
Explanation
The content uses
showmedians=Trueandshowmeans=True. - A
- 26
How do you add a grid to a plot?
- A
plt.grid(True)
- B
plt.gridline(True)
- C
plt.axis('grid')
- D
plt.showgrid()
Correct answer
Aplt.grid(True)
Explanation
The content uses
plt.grid(True)to add a grid. - A
- 27
Which parameter in plt.pie() adds percentage labels?
- A
labelpct
- B
showpercent
- C
autopct
- D
percent
Correct answer
Cautopct
Explanation
The content uses
autopct='%0.1f%%'to add percentages. - A
- 28
How do you highlight a slice in a pie chart?
- A
By setting the 'separate' parameter
- B
By setting the 'explode' parameter
- C
By setting the 'highlight' parameter
- D
By setting the 'pull' parameter
Correct answer
BBy setting the 'explode' parameter
Explanation
The content uses
explodeparameter to separate a slice. - A
- 29
How is a donut plot created in matplotlib?
- A
By using plt.bar() with circular coordinates
- B
By overlaying a white pie chart with smaller radius on top of a colored pie chart
- C
By using plt.donut() method
- D
By setting the 'donut' parameter in plt.pie()
Correct answer
BBy overlaying a white pie chart with smaller radius on top of a colored pie chart
Explanation
The content creates a donut plot by making two pie charts: one colored with radius 2 and a white one with radius 1 on top.
- A
- 30
Which method is used to create an area plot?
- A
plt.polygon()
- B
plt.fill()
- C
plt.area()
- D
plt.stackplot()
Correct answer
Dplt.stackplot()
Explanation
The content uses
plt.stackplot()to create an area plot. - A
- 31
How can you add a line plot on top of an area plot?
- A
By using plt.overlay() method
- B
By using plt.plot() with the same x and y values after the area plot
- C
By using plt.line() after the area plot
- D
By setting the 'line' parameter in plt.stackplot()
Correct answer
BBy using plt.plot() with the same x and y values after the area plot
Explanation
The content shows that after the area plot, you can call
plt.plot(x, y, color='green')to add a line on top. - A
- 32
To change colors in a pie chart, what parameter is used?
- A
colormap
- B
colors
- C
color
- D
palette
Correct answer
Bcolors
Explanation
The content uses
colorsparameter, e.g.,colors=['black','gray','yellow','green']. - A

Ask anything
We've read this whole study set, so questions about it get the best answers.