Skip to content
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

MEP12: Clean-up line and marker demos #2788

Merged
merged 1 commit into from Feb 10, 2014
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/users/pyplot_tutorial.rst
Expand Up @@ -175,7 +175,7 @@ rectangular grid, use the :func:`~matplotlib.pyplot.axes` command,
which allows you to specify the location as ``axes([left, bottom,
width, height])`` where all values are in fractional (0 to 1)
coordinates. See :ref:`pylab_examples-axes_demo` for an example of
placing axes manually and :ref:`pylab_examples-line_styles` for an
placing axes manually and :ref:`pylab_examples-subplots_demo` for an
example with lots-o-subplots.


Expand Down
33 changes: 33 additions & 0 deletions examples/lines_bars_and_markers/line_styles_reference.py
@@ -0,0 +1,33 @@
"""
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()


def nice_repr(text):
return repr(text).lstrip('u')


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

linestyles = ['-', '--', '-.', ':']
for y, linestyle in enumerate(linestyles):
ax.text(-0.5, y, nice_repr(linestyle), **text_style)
ax.plot(y * points, linestyle=linestyle, color=color, linewidth=3)
format_axes(ax)
ax.set_title('line styles')

plt.show()
34 changes: 34 additions & 0 deletions examples/lines_bars_and_markers/marker_fillstyle_reference.py
@@ -0,0 +1,34 @@
"""
Reference for marker fill-styles included with Matplotlib.
"""
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()


def nice_repr(text):
return repr(text).lstrip('u')


fig, ax = plt.subplots()

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

plt.show()
57 changes: 57 additions & 0 deletions examples/lines_bars_and_markers/marker_reference.py
@@ -0,0 +1,57 @@
"""
Reference for filled- and unfilled-marker types included with Matplotlib.
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D


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


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


def nice_repr(text):
return repr(text).lstrip('u')


def split_list(a_list):
i_half = len(a_list) // 2
return (a_list[:i_half], a_list[i_half:])


# Plot all un-filled markers
# --------------------------

fig, axes = plt.subplots(ncols=2)

# Filter out filled markers and marker settings that do nothing.
unfilled_markers = [m for m, func in Line2D.markers.iteritems()
if func != 'nothing' and m not in Line2D.filled_markers]
unfilled_markers = sorted(unfilled_markers)[::-1] # Reverse-sort for pretty
for ax, markers in zip(axes, split_list(unfilled_markers)):
for y, marker in enumerate(markers):
ax.text(-0.5, y, nice_repr(marker), **text_style)
ax.plot(y * points, marker=marker, **marker_style)
format_axes(ax)
fig.suptitle('un-filled markers', fontsize=14)


# Plot all filled markers.
# ------------------------

fig, axes = plt.subplots(ncols=2)
for ax, markers in zip(axes, split_list(Line2D.filled_markers)):
for y, marker in enumerate(markers):
ax.text(-0.5, y, nice_repr(marker), **text_style)
ax.plot(y * points, marker=marker, **marker_style)
format_axes(ax)
fig.suptitle('filled markers', fontsize=14)

plt.show()
38 changes: 0 additions & 38 deletions examples/pylab_examples/filledmarker_demo.py

This file was deleted.

45 changes: 0 additions & 45 deletions examples/pylab_examples/line_styles.py

This file was deleted.

2 changes: 1 addition & 1 deletion examples/tests/backend_driver.py
Expand Up @@ -56,6 +56,7 @@
'fill_demo.py',
'fill_demo_features.py',
'line_demo_dash_control.py',
'line_styles_reference.py',
'scatter_with_legend.py'
]

Expand Down Expand Up @@ -193,7 +194,6 @@
'legend_demo3.py',
'line_collection.py',
'line_collection2.py',
'line_styles.py',
'log_bar.py',
'log_demo.py',
'log_test.py',
Expand Down