Made it easier to set colors.

This commit is contained in:
Lasse Edfast 2023-01-24 10:59:09 +01:00 committed by GitHub
parent 61407e7d58
commit 92378ff191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,8 +11,10 @@ df['hour']=df.index
df['y']=df['hour'].apply(lambda x: int(x/120))
df['x']=df['hour'].apply(lambda x: int(x%120))
# Set export to orange and import to grey.
df['color'] = df['balance'].apply(lambda x: 'orange' if x < 0 else 'grey')
# Set colors for export and import
export_color = 'orange'
import_color = 'grey'
df['color'] = df['balance'].apply(lambda x: export_color if x < 0 else import_color)
# Plot the data.
ax = df.plot(kind='scatter', x='x', y='y', c='color')