def correlation(self): # Caption # caption = "Correlation of loss values in" \ " 22 countries and 2 data sources." # Import # from forest_puller.viz.correlation import all_graphs # Initialize # result = "" # Loop every country batch # for graph in all_graphs[:-1]: result += str(BareFigure(graph=graph)) + '\n\n' # The last one can have the caption # result += str(ScaledFigure(graph = all_graphs[-1], caption = caption, label = 'correlation')) # Return # return result
def genus_comp(self): # Caption # caption = "Comparison of genus composition in the growing stock at" \ " 4 different time points in 27 countries." # Import # from forest_puller.viz.genus_barstack import all_graphs, genus_legend # Initialize # result = "" # Loop every country batch # for graph in all_graphs: result += str(BareFigure(graph=graph)) + '\n\n' # Add the legend # result += str(ScaledFigure(graph = genus_legend, caption = caption, label = 'genus_comp')) # Return # return result
def comp_total_area(self): # Caption # caption = "Comparison of total forest area reported in" \ " 27 countries and 5 data sources." # Import # from forest_puller.viz.area_comp import all_graphs, legend # Initialize # result = "" # Loop every country batch # for graph in all_graphs: result += str(BareFigure(graph=graph)) + '\n\n' # Add the legend # result += str(ScaledFigure(graph = legend, caption = caption, label = 'comp_total_area', width = '9em')) # Return # return result
def waste_gen_by_country(self): # Import # from waste_flow.viz.gen_by_country import countries, legend # Caption # caption = "Legend for waste generation" # Initialize # result = "" # Add the legend # result += str(ScaledFigure(graph = legend, caption = caption, label = 'wastes_legend', width = '18em')) # Loop every country batch # for viz in countries.values(): result += '\n--\n**%s**\n--\n\n' % viz.country.long_name for graph in viz.all_graphs: result += str(BareFigure(graph=graph)) + '\n\n' # Return # return result
def comp_increments(self): # Caption # caption = "Comparison of gains, losses, and totals reported" \ " in 27 countries and 5 data sources." # Import # from forest_puller.viz.increments import countries, legend # Initialize # result = "" # Loop every country # for iso2_code in country_codes['iso2_code']: graph = countries[iso2_code] result += str(BareFigure(graph=graph)) + '\n\n' # Add the legend # result += str(ScaledFigure(graph = legend, caption = caption, label = 'comp_increments', width = '9em')) # Return # return result
def comp_conv_to_tons(self): # Caption # caption = "Comparison of gains, losses, and totals converted to tons of" \ " carbon reported in 27 countries and 5 data sources." # Import # from forest_puller.viz.converted_to_tons import countries, legend, all_codes # Initialize # result = "" # Loop every country # for iso2_code in all_codes: graph = countries[iso2_code] result += str(BareFigure(graph=graph)) + '\n\n' # Add the legend # result += str(ScaledFigure(graph = legend, caption = caption, label = 'comp_conv_to_tons', width = '9em')) # Return # return result
def waste_gen_by_sector(self): # Import # from waste_flow.viz.gen_by_sector import sectors, legend from waste_flow.common import nace_names # Caption # caption = "Legend for waste generation" # Initialize # result = "" # Add the legend # result += str(ScaledFigure(graph = legend, caption = caption, label = 'wastes_legend', width = '20em')) # Loop every country batch # for viz in sectors.values(): row = nace_names.query('nace == @viz.sector') text = row.iloc[0]['full_name'] if len(text) > 60: text = text[:60] + ' [...]' result += '\n--\n**%s**\n--\n\n' % text for graph in viz.all_graphs: result += str(BareFigure(graph=graph)) + '\n\n' # Return # return result
# Built-in modules # # Third party modules # # Internal modules # from forest_puller import cache_dir # First party modules # from pymarktex.figures import LatexFigure, BareFigure ############################################################################### # Monkey patch # LatexFigure.abs_path = lambda s: '../' + s.path.rel_path_from(cache_dir) ############################################################################### # Import # from forest_puller.viz.manuscript.area_comparison import all_graphs, legend # Initialize # result = "" # Loop every country # for g in all_graphs: result += str(BareFigure(graph=g, width='\\textwidth')) # Print # print(result) # Add the legend # #print(BareFigure(graph=legend))