From 3a957bd4fda0aa89d96101391f996e1fd461dcf7 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Thu, 19 Jul 2018 15:08:40 -0700 Subject: [PATCH] Backport PR #11677: DOC : Improves Documentation for stem_plot.py --- examples/lines_bars_and_markers/stem_plot.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/lines_bars_and_markers/stem_plot.py b/examples/lines_bars_and_markers/stem_plot.py index 3585902a1425..2a5ad4d401b7 100644 --- a/examples/lines_bars_and_markers/stem_plot.py +++ b/examples/lines_bars_and_markers/stem_plot.py @@ -3,13 +3,23 @@ Stem Plot ========= -Example stem plot. +Stem plot plots vertical lines from baseline to the y-coordinate +Plotting cosine(x) w.r.t x, using '-.' as the pattern +for plotting vertical lines """ import matplotlib.pyplot as plt import numpy as np +# returns 10 evenly spaced samples from 0.1 to 2*PI x = np.linspace(0.1, 2 * np.pi, 10) + markerline, stemlines, baseline = plt.stem(x, np.cos(x), '-.') + +# setting property of baseline with color red and linewidth 2 plt.setp(baseline, color='r', linewidth=2) plt.show() + +############################# +# This example makes use of: +# * :meth:`matplotlib.axes.Axes.stem`