This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig['layout'] = go.Layout( | |
font = {'size' : 14}, | |
plot_bgcolor = 'white', | |
xaxis = {'showline': True, | |
'visible': True, | |
'range': (0, data['Value'].max()), | |
'title_text': 'Production Quantity (tonnes)' # title of the x axis | |
}, | |
yaxis = {'showline': False, | |
'visible': True, # to show the title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1 Assign color to each unique item | |
from random import sample | |
colors = {item: 'rgb({}, {}, {})'.format(*sample(range(256), 3)) for item in data['Item'].unique()} | |
data['color'] = data['Item'].map(colors) | |
#2 Slice data, select earliest date available | |
##2.1 Select earliest year available | |
frame1 = data[data['Year'] == data['Year'].min()] |
NewerOlder