From 95f5d5f426e83c3349f713ffb0e678c763dd72c8 Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Wed, 24 Mar 2021 13:21:57 +0000 Subject: [PATCH] adjust y-axis range and reposition legend. I reduced the range on the y-axis to make the change in the light levels more noticable (at a glance/distance). The range is now closer to the upper and lower limits of the system so there is less 'excess' space in the chart. With the scaling down of the range on the y-axis, the legend was starting to get in the way of the lastest readings -- when there is a high light-reading. To combat this, I moved the legend to the lower-left part of the graph. If the light reading goes into the negatives (lights off in the factory but the system is still on), the legend can still impede but it only does so on the oldest of the readings on the graph. Also, the legend is slightly transparent so you can still see behind it, it's just cumbersome (especially at a glance/distance). --- light-wave.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/light-wave.py b/light-wave.py index 0a366eb..9e38e6c 100644 --- a/light-wave.py +++ b/light-wave.py @@ -9,7 +9,7 @@ session = requests.Session() # Parameters x_length = 600 # No. of readings show at one time. -y_range = [-100, 100] # Light reading range. +y_range = [-80, 65] # Light reading range. # Figure/Graph Details fig = plt.figure() @@ -22,8 +22,7 @@ line2, = ax.plot(ys2, label='factory2') plt.title("Light Meter Readings in Ritherdon") plt.xlabel("<--- Oldest (Time) Latest --->") plt.ylabel("Light") -plt.legend() -plt.subplots_adjust(bottom=0.20) +plt.legend(loc='lower left') ax.set_xticklabels(())