You have the following code in an Azure Synapse notebook

HOTSPOT

You have the following code in an Azure Synapse notebook.

Use the drop-down menus to select the answer choice that completes each statement based on the information presented in the code. NOTE: Each correct selection is worth one point.

Answer:

Explanation:

Box 1: stacked bar chart

matplotlib.pyplot.bar makes a bar plot.

The bars are positioned at x with the given alignment. Their dimensions are given by height and width. The vertical baseline is bottom (default 0).

Many parameters can take either a single value applying to all bars or a sequence of values, one for each bar.

Stacked bars can be achieved by passing individual bottom values per bar.

Stacked bar chart

This is an example of creating a stacked bar plot with error bars using bar. Note the parameters yeer used for error bars, and bottom to stack the women’s bars on top of the men’s bars.

import matplotlib.pyplot as plt

labels = [‘G1’, ‘G2’, ‘G3’, ‘G4’, ‘G5’]

men_means = [20, 35, 30, 35, 27]

women_means = [25, 32, 34, 20, 25]

men_std = [2, 3, 4, 1, 2]

women_std = [3, 5, 2, 3, 3]

width = 0.35 # the width of the bars: can also be len(x) sequence

fig, ax = plt.subplots()

ax.bar(labels, men_means, width, yerr=men_std, label=’Men’)

ax.bar(labels, women_means, width, yerr=women_std, bottom=men_means, label=’Women’)

ax.set_ylabel(‘Scores’)

ax.set_title(‘Scores by group and gender’)

ax.legend()

plt.show()

Box 2: two items

Blue item and Green Item.

matplotlib.legend

The legend module defines the Legend class, which is responsible for drawing legends associated with axes and/or figures.

Note: A Diagram Legend is an element that you can add to your diagram to provide information about the colors and/or line thicknesses and styles that have been used in the current diagram, where those colors and other styles have some particular meaning.

https://matplotlib.org/stable/gallery/lines_bars_and_markers/bar_stacked.html

https://matplotlib.org/stable/api/legend_api.html

Latest DP-500 Dumps Valid Version with 83 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments