|
7 | 7 | """
|
8 | 8 |
|
9 | 9 | import flowsa
|
| 10 | +import flowsa.datavisualization as dv |
10 | 11 | from flowsa.settings import plotoutputpath
|
11 | 12 | import matplotlib.pyplot as plt
|
12 | 13 |
|
13 | 14 |
|
14 |
| -# Produce facet graph of resources associated with cropland sectors |
| 15 | +########## Produce facet graph of resources associated with cropland sectors ########## |
15 | 16 | sectors = ['112']
|
16 | 17 | sector_length_display = 6
|
17 | 18 | plottype = 'facet_graph'
|
|
20 | 21 | 'Employment 2017': 'Employment_national_2017'}
|
21 | 22 |
|
22 | 23 |
|
23 |
| -flowsa.generateFBSplot(method_dict, plottype, |
24 |
| - sector_length_display=sector_length_display, |
25 |
| - sectors_to_include=sectors, |
26 |
| - plot_title='Direct Resource Use for Livestock' |
27 |
| - ) |
| 24 | +dv.FBSscatterplot(method_dict, plottype, |
| 25 | + sector_length_display=sector_length_display, |
| 26 | + sectors_to_include=sectors, |
| 27 | + plot_title='Direct Resource Use for Livestock' |
| 28 | + ) |
28 | 29 | # Can manually adjust the figure pop up before saving
|
29 | 30 | plt.savefig(f"{plotoutputpath}livestock_resource_use.png", dpi=300)
|
30 | 31 |
|
31 | 32 |
|
32 |
| -# Compare the results between water method 1 and method 2 |
| 33 | +########## Compare the results between water method 1 and method 2 ########## |
33 | 34 | sectors = ['21']
|
34 | 35 | sector_length_display = 6
|
35 | 36 | plottype = 'method_comparison'
|
|
45 | 46 | )
|
46 | 47 | # Can manually adjust the figure pop up before saving
|
47 | 48 | plt.savefig(f"{plotoutputpath}mining_water_comp.png", dpi=300)
|
| 49 | + |
| 50 | + |
| 51 | +########## Compare food waste flows via Sankey ########## |
| 52 | +methodnames = ['Food_Waste_national_2018_m1', 'Food_Waste_national_2018_m2'] |
| 53 | +target_sector_level = 'NAICS_2' |
| 54 | +target_subset_sector_level = { |
| 55 | + 'Food_Waste_national_2018_m1': {'NAICS_4': ['2212'], |
| 56 | + 'NAICS_6': ['62421', '31111', '32411', |
| 57 | + '56221', '62421', '115112', |
| 58 | + '22132'], |
| 59 | + 'NAICS_7': ['562212', '562219'] |
| 60 | + }, |
| 61 | + 'Food_Waste_national_2018_m2': { |
| 62 | + 'SectorConsumedBy': {'NAICS_6': ['115112', '22132','311119', |
| 63 | + '32411', '562213','62421'], |
| 64 | + 'NAICS_7': ['562212', '562219'] |
| 65 | + }} |
| 66 | +} |
| 67 | +# set domain to scale sankey diagrams |
| 68 | +domain_dict = {0: {'x': [0.01, 0.49], 'y': [0, 1]}, |
| 69 | + 1: {'x': [.51, 0.99], 'y': [.12, .88]} |
| 70 | + } |
| 71 | + |
| 72 | +dv.generateSankeyDiagram( |
| 73 | + methodnames, |
| 74 | + target_sector_level=target_sector_level, |
| 75 | + target_subset_sector_level=target_subset_sector_level, |
| 76 | + use_sectordefinition=True, |
| 77 | + sectors_to_include=None, |
| 78 | + fbsconfigpath=None, |
| 79 | + orientation='horizontal', |
| 80 | + domain_dict=domain_dict, |
| 81 | + value_label_format='brackets', |
| 82 | + subplot_titles=['m1', 'm2'], |
| 83 | + filename='FoodWasteSankey' |
| 84 | +) |
| 85 | + |
| 86 | + |
| 87 | +####### GHG Bar Chart ############ |
| 88 | +# Option 1 - GHG emissions by GHG |
| 89 | +dv.stackedBarChart('GHG_national_2018_m1', |
| 90 | + sectors_to_include=['111110', '112120', '325312'], |
| 91 | + filename='GHGEmissions') |
| 92 | + |
| 93 | +# Option 2 - specify indicator, much have LCIAformatter installed |
| 94 | +# https://github.com/USEPA/LCIAformatter |
| 95 | +dv.stackedBarChart('GHG_national_2018_m1', impact_cat='Global warming', |
| 96 | + sectors_to_include=['111110', '112120', '325312'], |
| 97 | + filename='GHGEmissionsGlobalWarming') |
0 commit comments