Skip to content

Simplify linestyle and fillstyle reference docs. #11909

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
Aug 22, 2018
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
22 changes: 7 additions & 15 deletions examples/lines_bars_and_markers/line_styles_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,21 @@

Reference for line-styles included with Matplotlib.
"""

import numpy as np
import matplotlib.pyplot as plt


color = 'cornflowerblue'
points = np.ones(5) # Draw 5 points for each line
text_style = dict(horizontalalignment='right', verticalalignment='center',
fontsize=12, fontdict={'family': 'monospace'})


def format_axes(ax):
ax.margins(0.2)
ax.set_axis_off()


# Plot all line styles.
fig, ax = plt.subplots()

linestyles = ['-', '--', '-.', ':']
for y, linestyle in enumerate(linestyles):
ax.text(-0.1, y, repr(linestyle), **text_style)
ax.plot(y * points, linestyle=linestyle, color=color, linewidth=3)
format_axes(ax)
ax.set_title('line styles')
ax.text(-0.1, y, repr(linestyle),
horizontalalignment='center', verticalalignment='center')
ax.plot([y, y], linestyle=linestyle, linewidth=3, color='tab:blue')

ax.set_axis_off()
ax.set_title('line styles')

plt.show()
23 changes: 9 additions & 14 deletions examples/lines_bars_and_markers/marker_fillstyle_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,25 @@
:doc:`/gallery/lines_bars_and_markers/marker_fillstyle_reference`
and :doc:`/gallery/shapes_and_collections/marker_path` examples.
"""

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D


points = np.ones(5) # Draw 3 points for each line
text_style = dict(horizontalalignment='right', verticalalignment='center',
fontsize=12, fontdict={'family': 'monospace'})
marker_style = dict(color='cornflowerblue', linestyle=':', marker='o',
markersize=15, markerfacecoloralt='gray')


def format_axes(ax):
ax.margins(0.2)
ax.set_axis_off()

points = np.ones(5) # Draw 5 points for each line
marker_style = dict(color='tab:blue', linestyle=':', marker='o',
markersize=15, markerfacecoloralt='tab:red')

fig, ax = plt.subplots()

# Plot all fill styles.
for y, fill_style in enumerate(Line2D.fillStyles):
ax.text(-0.5, y, repr(fill_style), **text_style)
ax.text(-0.5, y, repr(fill_style),
horizontalalignment='center', verticalalignment='center')
ax.plot(y * points, fillstyle=fill_style, **marker_style)
format_axes(ax)
ax.set_title('fill style')

ax.set_axis_off()
ax.set_title('fill style')

plt.show()