From 4e242b3463eaf8d2c480ea19d7234159a7e119a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gi=C3=B9=20Marcer?= Date: Sun, 31 May 2020 18:56:25 +0200 Subject: [PATCH] ex-6: redo 6-smoothed.pdf with the right font in the title The code in plot.py is also made more easy to use for passing from one mode to the other (show or save figure). --- ex-6/plot.py | 28 ++++++++++++++++------------ notes/images/6-smoothed.pdf | Bin 17687 -> 17399 bytes 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ex-6/plot.py b/ex-6/plot.py index 8a7fe9a..9283b8d 100755 --- a/ex-6/plot.py +++ b/ex-6/plot.py @@ -1,18 +1,22 @@ #!/usr/bin/env python -from pylab import * +from matplotlib import pyplot as plt +import numpy as np import sys -figure() +a, b, f = np.loadtxt(sys.stdin, unpack=True) -a, b, f = loadtxt(sys.stdin, unpack=True) -title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right') -hist(a, np.insert(b, 0, a[0]), weights=100*f/sum(f), - histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b') -xlabel(r'$\theta$ (radians)') -ylabel(r'$I(\theta)$ (a.u.)') +plt.figure() +# plt.figure(figsize=(5, 3)) +# plt.rcParams['font.size'] = 8 -xlabel('$\\theta$') -ylabel('$I(\\theta)$') -tight_layout() -show() +plt.title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right') +plt.xlabel(r'$\theta$ (radians)') +plt.ylabel(r'$I(\theta)$ (a.u.)') +plt.hist(a, np.insert(b, 0, a[0]), weights=100*f/sum(f), + histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b') + +plt.tight_layout() +plt.show() +# name = sys.argv[2] if len(sys.argv) > 1 else "prova" +# plt.savefig('notes/images/' + name + '.pdf') diff --git a/notes/images/6-smoothed.pdf b/notes/images/6-smoothed.pdf index 4e7bc6df15270a7aa1df85ef2a7518f17f2c7d35..0b32753a187c7dbaac7ab68b01b8f922ce084685 100644 GIT binary patch delta 5439 zcmZux2|U!>+rKC~*|H9eW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