-
Notifications
You must be signed in to change notification settings - Fork 13
Description
On writing up #172 I had the thought that, to provide an immediate plot view in headless situations, or otherwise as a possibly useful 'quick look' feature, there are libraries that enable in-terminal primitive plots. It is firm 'bells and whistles' territory, but it is not too much code to add as a dependency to the 'climate-aware-task-scheduler[plots]' libraries some lightweight library like plotext which I've used for a brief demo below, to allow such a view.
Example
I had a quick play around and got this which I appended to the plotplan in the plotting module, to compare to the main matplotlib plot:
import plotext as textplt
textplt.date_form('d/m/Y H:M:S')
def convert_dt_to_mins(dt):
return textplt.datetimes_to_string(dt)
conv_ci_times = convert_dt_to_mins(times)
textplt.plot(conv_ci_times, values, fillx=True)
textplt.plot(convert_dt_to_mins(now_times), now_values, fillx=True)
textplt.plot(convert_dt_to_mins(opt_times), opt_values, fillx=True)
textplt.xlim(min(conv_ci_times), max(conv_ci_times))
textplt.ylim(0.0, max(values))
textplt.show()which produces:
where the reference full matplotlib plot (going from my PR branch #171 which will update the plotting) that also emerges is:
It's not perfect but for a quick-look it's decent enough...