{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Plotting Documentation\n", "\n", "Making plots in Atomica is intrinsically complex, because customization is required in several places\n", "\n", "- Aggregating outputs by summation or averaging\n", "- Aggregating outputs across populations\n", "- Collapsing values over time\n", "- Comparing outputs or pops within results, or comparing across results\n", "- Stacking bars with groups of variables\n", "- Setting colours for individual quantities, or sets of quantities\n", "- Setting axis limits to focus on particular times or values\n", "- Having legends together with the figure, or in a separate figure\n", "- Optionally having names converted to long names \n", "- Setting custom axis labels and titles\n", "- Saving output figures\n", "\n", "This notebook provides documentation for the plotting library, providing an overview of available functions and examples of how to perform common tasks. \n", "\n", "Note that this plotting library serves as the foundation for accessing and plotting outputs - it is expected that plots will require context-dependent customization after creation to suit specific uses e.g. frontend, reports, presentations, and a number of helper scripts are also provided to assist with these customizations. The default behaviours in the plotting library reflect the lowest common denominator of usage, maximizing the information displayed and minimizing information loss.\n", "\n", "## Quick Reference\n", "\n", "### Just give me a plot\n", "\n", " result = proj.run_sim(...)\n", " d = at.PlotData(result,pops=['0-4'],outputs=['sus','vac'],project=proj)\n", " figs = at.plot_series(d,data=proj.data)\n", "\n", "### FAQs\n", "\n", "##### Data manipulation\n", "- [How do I sum over all populations?](#Data-preparation-and-aggregation)\n", "- [How do I transform output quantities?](#Function-aggregations)\n", "- [I want to integrate my data over time](#Time-accumulation)\n", "- [I want to aggregate my data over time](#Time-aggregation)\n", "- [I want to plot flow rates](#Plotting-transition-parameters-and-flow-rates)\n", "- [I want to plot a specific link](#Flow-rate-aggregations-and-disaggregations)\n", "- [How do I get actual annual flow quantities](#Time-aggregation-of-flow-rates)\n", "\n", "##### General issues\n", "- [The plot uses code names instead of full names](#Setting-full-names)\n", "- [I want lines for populations, not for outputs](#Plotting-series)\n", "- [I want a single figure with subplots](#Subplots)\n", "- [How do I save figures to PNG files?](#Saving-figures)\n", "- [Something is wrong with the units](#Axis-units)\n", "- [I want different colours](#Setting-colors)\n", "\n", "##### Bar graphs\n", "\n", "- [I want to make a bar graph](#Plotting-bars)\n", "- [I want to stack things on the bar graph](#Stacking-bars)\n", "- [I want to label the bars differently](#Labelling-bars)\n", "- [I want horizontal bars](#Horizontal-bars)\n", "\n", "##### Legends\n", "\n", "- [Something is wrong with the legend](#Working-with-legends)\n", "- [I want the legend to be in a different order](#Controlling-legend-order)\n", "- [I want to specify custom legend labels](#Relabeling-legend-entries)\n", "\n", "