From b9e647f20355a7c8b1d0c2175ec190609556619a Mon Sep 17 00:00:00 2001 From: Manish Devgan Date: Tue, 17 Jul 2018 13:18:22 +0530 Subject: [PATCH] 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`