message_ix_models.tools.iea.eei.Plot
- class message_ix_models.tools.iea.eei.Plot[source]
Bases:
Plot
Diagnostic plot of processed data.
- __init__()
Methods
__init__
()add_tasks
(c, key, *inputs[, strict])Add a task to c to generate and save the Plot.
generate
(data)Generate and return the plot.
make_task
(*inputs)Return a task
tuple
to add to a Computer.save
(config, *args, **kwargs)Prepare data, call
generate()
, and save to file.Attributes
File name base for saving the plot.
Keys
referring toQuantities
or other inputs accepted bygenerate()
.Path for file output.
Keyword arguments for
plotnine.ggplot.save
.static
File extension; determines file format.
- classmethod add_tasks(c: Computer, key: Key | str, *inputs, strict: bool = False) Key | str [source]
Add a task to c to generate and save the Plot.
Analogous to
Operator.add_tasks()
.
- basename = 'IEA_EEI-data'
File name base for saving the plot.
- generate(data)[source]
Generate and return the plot.
A subclass of Plot must implement this method.
- Parameters:
args (
Sequence
ofpandas.DataFrame
orother
) –One argument is given corresponding to each of the
inputs
.Because
plotnine
operates on pandas data structures,save()
automatically converts anyQuantity
inputs topandas.DataFrame
before they are passed togenerate()
.
- inputs: Sequence[Hashable] = []
Keys
referring toQuantities
or other inputs accepted bygenerate()
.
- classmethod make_task(*inputs)[source]
Return a task
tuple
to add to a Computer.Deprecated since version 1.18.0: Use
add_tasks()
instead.- Parameters:
*inputs (.Key or
str
orhashable
, optional) – If provided, overrides theinputs
property of the class.- Returns:
The first, callable element of the task is
save()
.The second element is
"config"
, to access the configuration of the Computer.The third and following elements are the inputs.
- Return type:
- path: Path | None = None
Path for file output. If it is not set,
save()
will populate it with a value constructed fromconfig["output_dir"]
,basename
, andsuffix
. The implementation ofgenerate()
in a Plot sub-class may assign any other value, for instance one constructed at runtime from theinputs
.
- save(config, *args, **kwargs) Path | None [source]
Prepare data, call
generate()
, and save to file.This method is used as the callable in the task generated by
add_tasks()
.Added in version 1.24.1: This method uses
disable_copy_on_write()
to work around has2k1/mizani#38. This may cause issues if other computations (for instance, of the inputs to the Plot) rely on Pandas’ copy-on-write behaviour being enabled.
- suffix = '.pdf'
File extension; determines file format.