pygcam.chart

Functions for charting data in CSV files generated by XML queries against the GCAM database.

API

pygcam.chart.chartGCAM(args, num=None, negate=False)

Generate a chart from GCAM data. This function is called to process the chart sub-command for a single scenario. See the command-line arguments to the chart sub-command for details about args.

Parameters
  • args – (argparse Namespace) command-line arguments to chart sub-command

  • num – (int or None) if not None, a number to prepend to the filename to allow files to have numerical sequence.

  • negate – (bool) if True, all values in year columns are multiplied by -1 before plotting.

Returns

none

pygcam.chart.plotStackedBarsScalar(df, indexCol, columns, valuesCol, box=False, rotation=90, zeroLine=False, title='', xlabel='', ylabel='', ncol=5, ygrid=False, yticks=False, ymin=None, ymax=None, barWidth=0.5, legendY=None, palette=None, outFile=None, sideLabel=False, labelColor=None, yFormat=None, transparent=False, openFile=False, closeFig=True)

Plot a stacked bar plot using data in df, given the index column, the column holding the values to pivot to columns, and the column holding the values. The argument ‘ncol’ specifies the number of columns with which to render the legend.

pygcam.chart.plotUnstackedRegionComparison(df, categoryCol, valueCol=None, region=None, otherRegion='Rest of world', box=False, title='', ncol=3, xlabel='', ylabel='', ygrid=False, yticks=False, ymin=None, ymax=None, legendY=None, palette=None, outFile=None, sideLabel=False, labelColor=None, yFormat=None, transparent=False, openFile=False, closeFig=True)

Plot unstacked bars showing the values for ‘categoryCol’, summed across years, for one region, for everything else, and the totals of the two.

pygcam.chart.systemOpenFile(path)

Ask the operating system to open a file at the given pathname.

Parameters

path – (str) the pathname of a file to open

Returns

none