Skip to content

DOC : Improves Documentation for stem_plot.py #11677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion examples/lines_bars_and_markers/stem_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i prefer writing out "with respect to", but that's not a deal breaker.

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`