Plotting and Visualization
50 questions available
Questions
What is the primary purpose of the `%matplotlib inline` command when used in a Jupyter notebook?
View answer and explanationWhich method is used to add a subplot to an existing Figure object in matplotlib?
View answer and explanationIn the command `fig.add_subplot(2, 2, 1)`, what does the argument `1` represent?
View answer and explanationWhat is the more convenient alternative to `fig.add_subplot` for creating a figure and a grid of subplots simultaneously, which also returns a NumPy array of the subplot objects?
View answer and explanationWhat do the `sharex` and `sharey` arguments in `plt.subplots()` achieve when set to True?
View answer and explanationIn `fig.subplots_adjust(wspace=0, hspace=0)`, what is the effect on the plot layout?
View answer and explanationWhich argument is used in plotting functions like `ax.plot` to specify the style of the line, for example, to make it dashed?
View answer and explanationIn a line plot, what is the purpose of the `marker` argument?
View answer and explanationHow can you alter the default linear interpolation between points in a line plot to a step-like pattern?
View answer and explanationWhich method is used to explicitly set the tick locations on the x-axis of a matplotlib subplot?
View answer and explanationWhat is the easiest way to add a legend to a matplotlib plot that identifies different plotted elements?
View answer and explanationWhich function is used to add annotations that can consist of both text and an arrow to a subplot?
View answer and explanationTo add a shape like a `Rectangle` or `Circle` to a subplot, you create a patch object and then pass it to which method?
View answer and explanationWhen saving a figure using `fig.savefig()`, what does the `dpi` option control?
View answer and explanationWhich function is used to programmatically modify matplotlib's global configuration parameters, such as the default figure size?
View answer and explanationBy default, what type of plot does the `.plot()` method on a pandas Series or DataFrame create?
View answer and explanationWhen plotting a pandas DataFrame, what is the default behavior regarding its columns?
View answer and explanationIn the context of a pandas DataFrame plot, what does the argument `subplots=True` do?
View answer and explanationHow do you create a stacked bar plot from a pandas DataFrame?
View answer and explanationWhat is a useful recipe for visualizing the frequency of values in a pandas Series using a bar plot?
View answer and explanationIn the `seaborn.barplot` function, what does the `data` argument typically expect?
View answer and explanationWhen using `seaborn.barplot`, if there are multiple observations for each category on the y-axis, what do the bars represent by default?
View answer and explanationIn `seaborn.barplot`, what is the purpose of the `hue` argument?
View answer and explanationWhat is a key difference between a histogram and a density plot?
View answer and explanationWhich seaborn function is particularly useful for examining the relationship between two one-dimensional data series by making a scatter plot and fitting a linear regression line?
View answer and explanationWhat is a pairs plot (or scatter plot matrix), and which seaborn function can create it?
View answer and explanationIn the `sns.pairplot` function, what does the `diag_kind='kde'` argument specify?
View answer and explanationWhat is a facet grid, as created by `seaborn.catplot`?
View answer and explanationIn `sns.catplot`, which arguments are used to create a facet grid by splitting the data into subplots based on the values of certain columns?
View answer and explanationWhat type of plot does `sns.catplot(..., kind='box')` create?
View answer and explanationTo ensure subplots in a 2x2 grid created with `plt.subplots(2, 2)` have the same y-axis ticks for comparison, which argument should be used?
View answer and explanationWhat is the return type of the `plt.subplots(2, 3)` command?
View answer and explanationWhat does the `alpha` style option, such as `alpha=0.3`, control in a plot?
View answer and explanationIf you call `ax.set_xticklabels(["one", "two", "three"], rotation=30)`, what is the effect of `rotation=30`?
View answer and explanationWhat is the purpose of the `loc` argument in the `ax.legend()` method?
View answer and explanationHow can you save a plot to a 400 DPI PNG file named 'my_figure.png' using a Figure object `fig`?
View answer and explanationIn a pandas DataFrame plot, what does the `layout` argument, such as `layout=(2, 2)`, specify?
View answer and explanationWhich pandas function is described as a convenient way to compute a simple frequency table from two DataFrame columns, which can then be used for plotting?
View answer and explanationWhich seaborn function is used to change the aesthetics of plots, such as the plot background and grid line colors, with predefined themes like 'whitegrid'?
View answer and explanationWhat is another name for a density plot, based on the method used to create it?
View answer and explanationThe `kind` argument in pandas' `.plot()` method can be set to 'barh'. What type of plot does this create?
View answer and explanationWhat does a box plot, as created by `sns.catplot(kind='box', ...)` or other methods, show?
View answer and explanationWhat is the primary function of the seaborn library as described in the text?
View answer and explanationWhen creating a histogram for tip percentages using `tips["tip_pct"].plot.hist(bins=50)`, what does the argument `bins=50` accomplish?
View answer and explanationWhich command would you use to change the default seaborn color palette to a greyscale one suitable for black-and-white print?
View answer and explanationIn a pandas DataFrame plot, what does the argument `sort_columns` do?
View answer and explanationWhat does the `figsize` argument, such as `figsize=(8, 6)`, specify when used in a plotting function like `plt.figure` or `plt.subplots`?
View answer and explanationWhen calling a pandas Series plot method like `s.plot()`, what is used for the x-axis by default?
View answer and explanationAccording to the text, in seaborn's `barplot`, what do the black lines drawn on the bars represent by default?
View answer and explanationYou have a pandas DataFrame with columns `A` and `B`. Which is the correct syntax to create a vertical bar plot of column `A`?
View answer and explanation