Created
November 1, 2016 16:31
-
-
Save rjzak/3ef956e72133871e435797d101734994 to your computer and use it in GitHub Desktop.
A quick and simple Python script to graph numpy arrays. Useful for initial analysis and comparing of data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from __future__ import print_function | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import sys | |
# Modeled after: http://matplotlib.org/1.3.0/examples/pylab_examples/legend_demo.html | |
if len(sys.argv) < 2: | |
print("Usage: %s <File1>...<FileN>" % sys.argv[0]) | |
sys.exit(1) | |
fig, ax = plt.subplots() | |
for arg in sys.argv[1:]: | |
d = np.fromfile(arg) | |
ax.plot(d, label=arg) | |
legend = ax.legend(loc='upper center', shadow=True) | |
frame = legend.get_frame() | |
frame.set_facecolor('0.90') | |
for label in legend.get_texts(): | |
label.set_fontsize('small') | |
for label in legend.get_lines(): | |
label.set_linewidth(1.0) | |
plt.show() | |
plt.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment