aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-05-06 15:05:04 -0400
committerKevin O'Connor <kevin@koconnor.net>2022-05-06 15:05:04 -0400
commit261944cc7ba3aea089c08a0d37017850cc28ec50 (patch)
tree60f863f75bcfa9d9b2c39947a8c2ce0dcc599325
parent6f0b7c7a2a81d88502f42bbeeac2d3b39f546a5f (diff)
downloadkutter-261944cc7ba3aea089c08a0d37017850cc28ec50.tar.gz
kutter-261944cc7ba3aea089c08a0d37017850cc28ec50.tar.xz
kutter-261944cc7ba3aea089c08a0d37017850cc28ec50.zip
graphstats: Improve labels on twinx() graphs
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rwxr-xr-xscripts/graphstats.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/graphstats.py b/scripts/graphstats.py
index f0e24c91..7cd52964 100755
--- a/scripts/graphstats.py
+++ b/scripts/graphstats.py
@@ -174,7 +174,9 @@ def plot_system(data):
color='yellow', alpha=0.3)
fontP = matplotlib.font_manager.FontProperties()
fontP.set_size('x-small')
- ax1.legend(loc='best', prop=fontP)
+ ax1li, ax1la = ax1.get_legend_handles_labels()
+ ax2li, ax2la = ax2.get_legend_handles_labels()
+ ax1.legend(ax1li + ax2li, ax1la + ax2la, loc='best', prop=fontP)
ax1.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%H:%M'))
ax1.grid(True)
return fig
@@ -248,7 +250,9 @@ def plot_temperature(data, heaters):
ax2.set_ylabel('pwm')
fontP = matplotlib.font_manager.FontProperties()
fontP.set_size('x-small')
- ax1.legend(loc='best', prop=fontP)
+ ax1li, ax1la = ax1.get_legend_handles_labels()
+ ax2li, ax2la = ax2.get_legend_handles_labels()
+ ax1.legend(ax1li + ax2li, ax1la + ax2la, loc='best', prop=fontP)
ax1.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%H:%M'))
ax1.grid(True)
return fig