From ad3c2544576123a38a0db1404fe30159d3aae0e5 Mon Sep 17 00:00:00 2001 From: Jiyun Shin Date: Thu, 30 Mar 2017 15:04:25 +0200 Subject: [PATCH 1/2] Merged the fill_demo figures and changed the axes --- examples/lines_bars_and_markers/fill_demo.py | 30 +++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/examples/lines_bars_and_markers/fill_demo.py b/examples/lines_bars_and_markers/fill_demo.py index 120036516955..8603802f73b4 100644 --- a/examples/lines_bars_and_markers/fill_demo.py +++ b/examples/lines_bars_and_markers/fill_demo.py @@ -14,18 +14,28 @@ import numpy as np import matplotlib.pyplot as plt -x = np.linspace(0, 1, 500) -y = np.sin(4 * np.pi * x) * np.exp(-5 * x) +x1 = np.linspace(0, 2 * np.pi, 500) +y1 = np.sin(x1) +y2 = np.sin(3 * x1) -fig, ax = plt.subplots() +fig, (ax1, ax3) = plt.subplots(1,2, sharey=True) -ax.fill(x, y, zorder=10) -ax.grid(True, zorder=5) +ax1.set_xticks([0, np.pi/2, np.pi, 3*np.pi/2, 2*np.pi]) +ax1.set_xticklabels( ['$0$', r'$\frac{\pi}{2}$', r'$\pi$',r'$\frac{3\pi}{2}$',r'$2\pi$'] ) +ax1.set_title('fill_demo_feature') +ax1.set_xlabel('Time',labelpad=2) +ax1.set_ylabel('Amplitude') +ax1.fill(x1, y1, 'b', x1, y2, 'r', alpha=0.3) +ax1.xaxis.set_label_coords(0.5, -0.1) -x = np.linspace(0, 2 * np.pi, 500) -y1 = np.sin(x) -y2 = np.sin(3 * x) -fig, ax = plt.subplots() -ax.fill(x, y1, 'b', x, y2, 'r', alpha=0.3) +x3 = np.linspace(0, 1, 500) +y3 = np.sin(4 * np.pi * x3) * np.exp(-5 * x3) + +ax3.set_title('fill_demo') +ax3.set_xlabel('Time', labelpad=8) +ax3.fill(x3, y3, zorder=10) +ax3.grid(True, zorder=5) +ax3.xaxis.set_label_coords(0.5, -0.1) + plt.show() From 9bd7e3d1270c01cfadfe287b52112a5275f9df99 Mon Sep 17 00:00:00 2001 From: Jiyun Shin Date: Mon, 3 Apr 2017 20:30:00 +0200 Subject: [PATCH 2/2] Modified version --- examples/lines_bars_and_markers/fill_demo.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/lines_bars_and_markers/fill_demo.py b/examples/lines_bars_and_markers/fill_demo.py index 8603802f73b4..3e1879bc7554 100644 --- a/examples/lines_bars_and_markers/fill_demo.py +++ b/examples/lines_bars_and_markers/fill_demo.py @@ -15,27 +15,27 @@ import matplotlib.pyplot as plt x1 = np.linspace(0, 2 * np.pi, 500) + y1 = np.sin(x1) y2 = np.sin(3 * x1) -fig, (ax1, ax3) = plt.subplots(1,2, sharey=True) +fig, (ax1, ax2) = plt.subplots(1,2, sharey=True) ax1.set_xticks([0, np.pi/2, np.pi, 3*np.pi/2, 2*np.pi]) -ax1.set_xticklabels( ['$0$', r'$\frac{\pi}{2}$', r'$\pi$',r'$\frac{3\pi}{2}$',r'$2\pi$'] ) +ax1.set_xticklabels(['$0$', r'$\frac{\pi}{2}$', r'$\pi$',r'$\frac{3\pi}{2}$',r'$2\pi$']) ax1.set_title('fill_demo_feature') ax1.set_xlabel('Time',labelpad=2) ax1.set_ylabel('Amplitude') ax1.fill(x1, y1, 'b', x1, y2, 'r', alpha=0.3) ax1.xaxis.set_label_coords(0.5, -0.1) +x2 = np.linspace(0, 1, 500) +y3 = np.sin(4 * np.pi * x2) * np.exp(-5 * x2) -x3 = np.linspace(0, 1, 500) -y3 = np.sin(4 * np.pi * x3) * np.exp(-5 * x3) - -ax3.set_title('fill_demo') -ax3.set_xlabel('Time', labelpad=8) -ax3.fill(x3, y3, zorder=10) -ax3.grid(True, zorder=5) -ax3.xaxis.set_label_coords(0.5, -0.1) +ax2.set_title('fill_demo') +ax2.set_xlabel('Time', labelpad=8) +ax2.fill(x2, y3, zorder=10) +ax2.grid(True, zorder=5) +ax2.xaxis.set_label_coords(0.5, -0.1) plt.show()