From d7ba921c2a67a893974634aa2f234b0790c378c8 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Sat, 10 Sep 2016 15:55:58 +0100 Subject: [PATCH 1/3] Added linestyles example --- examples/lines_bars_and_markers/linestyles.py | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 examples/lines_bars_and_markers/linestyles.py diff --git a/examples/lines_bars_and_markers/linestyles.py b/examples/lines_bars_and_markers/linestyles.py new file mode 100644 index 000000000000..869cf597d1f8 --- /dev/null +++ b/examples/lines_bars_and_markers/linestyles.py @@ -0,0 +1,45 @@ +""" +Different linestyles copying those of Tikz/PGF +""" +import numpy as np +import matplotlib.pyplot as plt +from collections import OrderedDict + +linestyles = OrderedDict( + [('solid', (0, ())), + ('loosely dotted', (0, (1, 10))), + ('dotted', (0, (1, 5))), + ('densely dotted', (0, (1, 1))), + + ('loosely dashed', (0, (5, 10))), + ('dashed', (0, (5, 5))), + ('densely dashed', (0, (5, 1))), + + ('loosely dashdotted', (0, (3, 10, 1, 10))), + ('dashdotted', (0, (3, 5, 1, 5))), + ('densely dashdotted', (0, (3, 1, 1, 1))), + + ('loosely dashdotdotted', (0, (3, 10, 1, 10, 1, 10))), + ('dashdotdotted', (0, (3, 5, 1, 5, 1, 5))), + ('densely dashdotdotted', (0, (3, 1, 1, 1, 1, 1)))]) + + +plt.figure(figsize=(10, 6)) +ax = plt.subplot(1, 1, 1) + +X, Y = np.linspace(0, 100, 10), np.zeros(10) +for i, (name, linestyle) in enumerate(linestyles.items()): + ax.plot(X, Y+i, linestyle=linestyle, linewidth=1.5, color='black') + +ax.set_ylim(-0.5, len(linestyles)-0.5) +plt.yticks(np.arange(len(linestyles)), linestyles.keys()) +plt.xticks([]) + +for i, (name, linestyle) in enumerate(linestyles.items()): + ax.text(-0.5, i-0.4, str(linestyle), fontsize=8, ha="right", + color="blue", family="monospace") + +plt.tight_layout() +plt.savefig("linestyles.pdf") +plt.savefig("linestyles.png", dpi=150) +plt.show() From 1e5e66f3b339fa4a56410249482d776b4330883c Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Sat, 10 Sep 2016 15:56:36 +0100 Subject: [PATCH 2/3] Removed figure saving --- examples/lines_bars_and_markers/linestyles.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/lines_bars_and_markers/linestyles.py b/examples/lines_bars_and_markers/linestyles.py index 869cf597d1f8..dae12caf4eaf 100644 --- a/examples/lines_bars_and_markers/linestyles.py +++ b/examples/lines_bars_and_markers/linestyles.py @@ -40,6 +40,6 @@ color="blue", family="monospace") plt.tight_layout() -plt.savefig("linestyles.pdf") -plt.savefig("linestyles.png", dpi=150) +# plt.savefig("linestyles.pdf") +# plt.savefig("linestyles.png", dpi=150) plt.show() From d7154a76f918632d09a8eae477928667b6e064d0 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Sat, 10 Sep 2016 16:53:12 +0100 Subject: [PATCH 3/3] Removed commented lines --- examples/lines_bars_and_markers/linestyles.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/lines_bars_and_markers/linestyles.py b/examples/lines_bars_and_markers/linestyles.py index dae12caf4eaf..c61276a6d6f5 100644 --- a/examples/lines_bars_and_markers/linestyles.py +++ b/examples/lines_bars_and_markers/linestyles.py @@ -40,6 +40,4 @@ color="blue", family="monospace") plt.tight_layout() -# plt.savefig("linestyles.pdf") -# plt.savefig("linestyles.png", dpi=150) plt.show() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy