Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions examples/lines_bars_and_markers/stem_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
x = np.linspace(0.1, 2 * np.pi, 41)
y = np.exp(np.sin(x))

plt.stem(x, y)
plt.stem(x, y, use_line_collection=True)
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed to prevent warning

/home/circleci/project/examples/lines_bars_and_markers/stem_plot.py:15: UserWarning: In Matplotlib 3.3 individual lines on a stem plot will be added as a LineCollection instead of individual lines. This significantly improves the performance of a stem plot. To remove this warning and switch to the new behaviour, set the "use_line_collection" keyword argument to True.

plt.show()

#############################################################################
Expand All @@ -23,8 +23,8 @@
# properties are configurable via keyword arguments. For more advanced
# control adapt the line objects returned by `~.pyplot`.

markerline, stemlines, baseline = plt.stem(x, y, linefmt='grey', markerfmt='D',
bottom=1.1)
markerline, stemlines, baseline = plt.stem(
x, y, linefmt='grey', markerfmt='D', bottom=1.1, use_line_collection=True)
markerline.set_markerfacecolor('none')
plt.show()

Expand Down
1 change: 1 addition & 0 deletions tutorials/introductory/sample_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@
:scale: 50

xkcd

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes

/home/circleci/project/doc/tutorials/introductory/sample_plots.rst:425: WARNING: Explicit markup ends without a blank line; unexpected unindent.

which was caused by the original code translating to .rst as:

.. figure:: ../../gallery/showcase/images/sphx_glr_xkcd_001.png
   :target: ../../gallery/showcase/xkcd.html
   :align: center
   :scale: 50

   xkcd
Subplot example
===============

"""

###################################################################
Expand Down