Skip to content

Commit 56d1846

Browse files
committed
MNT: tweak picking example
1 parent f9821b6 commit 56d1846

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

05-temperature/03-picking.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import matplotlib.pyplot as plt
2-
from w_helpers import load_data, aggregate_by_day, extract_day_of_hourly
2+
from w_helpers import load_data, aggregate_by_day, extract_day_of_hourly, label_date
33

44
import uuid
55

6-
datasource = 'ornl'
6+
datasource = 'central_park'
77

88
temperature = load_data(datasource)
9-
temperature = temperature[temperature['year'] >= 2016]
9+
temperature = temperature[temperature['year'] >= 2017]
1010
temperature_daily = aggregate_by_day(temperature)
1111

1212

1313
class RowPrinter:
1414
def __init__(self, ln, df, picker=10):
1515
ln.set_picker(picker)
16+
# we can use this to ID our line!
1617
self.uid = str(uuid.uuid4())
1718
ln.set_gid(self.uid)
1819
self.ln = ln
@@ -44,18 +45,18 @@ def remove(self):
4445
ax.set_xlabel('Date [UTC]')
4546
ax.set_ylabel('Air Temperature [℃]')
4647
ax.set_title(f'{datasource} temperature')
48+
4749
rp = RowPrinter(ln, temperature_daily)
4850

49-
one_day = extract_day_of_hourly(temperature, 2015, 10, 18)
51+
one_day = extract_day_of_hourly(temperature, 2017, 10, 27)
5052
plt.show()
5153

5254
# EXERCISE
5355
# - make the print out nicer looking
5456

5557
# - open a new window with plot of day temperature
5658
# - fig, ax = plt.subplots()
57-
# - one_day = extract_day_of_hourly(bwi, 2015, 10, 18)
58-
59-
59+
# - one_day = extract_day_of_hourly(temperature, 2015, 10, 18)
6060
# - make picking add a label with `label_data`
61-
# - use `get_gid` to filter instead of `is not`
61+
62+
# - use `get_gid` to filter artists instead of `is not`

0 commit comments

Comments
 (0)