plot_costsrevs#
- scikitplot.decile.plot_costsrevs(plot_input, *, fixed_costs, currency='€', variable_costs_per_unit, profit_per_unit, highlight_ntile=None, highlight_how='plot_text', line_kws=None, ref_line_kws=None, legend_kws=None, grid_kws=None, axes_kws=None, annotation_kws=None, footer_kws=None, save_fig=True, save_fig_filename='', **kwargs)[source]#
Plot costs and revenues curves.
- Parameters:
- plot_inputpandas.DataFrame
Output of
ModelPlotPy.plotting_scope.- fixed_costsfloat
Fixed costs independent of selection size.
- currencystr
such as the dollar sign ($), euro sign (€), or pound sign (£). These symbols indicate monetary values in financial contexts.
- variable_costs_per_unitfloat
Variable cost per selected unit.
- profit_per_unitfloat
Revenue per positive unit.
- highlight_ntileint or Sequence[int] or None, default=None
Ntile index/indices to highlight (each in 1..ntiles).
- highlight_how{‘plot’, ‘text’, ‘plot_text’}, default=’plot_text’
Where to render highlight information.
- line_kws, ref_line_kws, legend_kws, grid_kws, axes_kws, annotation_kws, footer_kwsMapping[str, Any] or None
Per-component styling kwargs.
- **kwargsAny
Legacy alias for
line_kws.
- Returns:
- matplotlib.axes.Axes
Axes containing the plot.
- Other Parameters:
- show_figbool, default=True
Show the plot.
Added in version 0.4.0.
- save_figbool, default=False
Save the plot. Used by
save_plot_decorator.Added in version 0.4.0.
- save_fig_filenamestr, optional, default=’’
Specify the path and filetype to save the plot. If nothing specified, the plot will be saved as png inside
result_imagesunder to the current working directory. Defaults to plot image named to usedfunc.__name__. Used bysave_plot_decorator.Added in version 0.4.0.
- overwritebool, optional, default=True
If False and a file exists, auto-increments the filename to avoid overwriting.
Added in version 0.4.0.
- add_timestampbool, optional, default=False
Whether to append a timestamp to the filename. Default is False.
Added in version 0.4.0.
- verbosebool, optional
If True, enables verbose output with informative messages during execution. Useful for debugging or understanding internal operations such as backend selection, font loading, and file saving status. If False, runs silently unless errors occur.
Default is False.
Added in version 0.4.0: The
verboseparameter was added to control logging and user feedback verbosity.
- Raises:
- TypeError
If any financial parameter is not numeric.
- _PlotInputError
If plot_input lacks required columns.
- Parameters:
- Return type:
See also
Notes
Revenue is computed as
profit_per_unit * cumpos.Total costs are computed as
fixed_costs + variable_costs_per_unit * cumtot.
Highlight lines are standardized and use cumulative 1..N semantics.
Examples
>>> # ax = plot_costsrevs(plot_input, fixed_costs=100, variable_costs_per_unit=1, profit_per_unit=10)