Skip to content

Commit

Permalink
cleanplotlib -> dufte
Browse files Browse the repository at this point in the history
  • Loading branch information
nschloe committed May 13, 2020
1 parent 5161de9 commit 5ef2be4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers =
packages = find:
# importlib_metadata can be removed when we support Python 3.8+ only
install_requires =
cleanplotlib
dufte
importlib_metadata
matplotlib
pyyaml
Expand Down
18 changes: 8 additions & 10 deletions stressberry/cli/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@


def plot(argv=None):
import cleanplotlib as cpl
import dufte
import matplotlib.pyplot as plt

plt.style.use(dufte.style)

parser = _get_parser_plot()
args = parser.parse_args(argv)

Expand All @@ -17,28 +19,24 @@ def plot(argv=None):
# actually plot it
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
a = []
b = []
c = []
for d in data:
temperature_data = d["temperature"]
if args.delta_t:
temperature_data = []
zip_object = zip(d["temperature"], d["ambient"])
for d["temperature"], d["ambient"] in zip_object:
temperature_data.append(d["temperature"] - d["ambient"])
a.append(d["time"])
b.append(temperature_data)
c.append(d["name"])

cpl.multiplot(a, b, c)
plt.plot(d["time"], temperature_data, label=d["name"])

dufte.legend()

if args.delta_t:
plot_yaxis_label = "Δ temperature [°C over ambient]"
else:
plot_yaxis_label = "temperature [°C]"
cpl.xlabel("time [s]")
cpl.ylabel(plot_yaxis_label)
plt.xlabel("time [s]")
plt.ylabel(plot_yaxis_label)

if args.temp_lims:
ax1.set_ylim(*args.temp_lims)
Expand Down

0 comments on commit 5ef2be4

Please sign in to comment.