raplan.plot
¶
RaPlan plotting module.
Compound
¶
A fictive compound of CFP carrying items.
members
¶
Generate all member subjects of this compound.
Source code in src/raplan/plot.py
PlottingProcedure
¶
A specific grouping of tasks to apply to a System.
Note
Mainly used for plotting purposes.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Name for this procedure. |
system |
str
|
System (name) to which the procedure should be applied. |
kind |
str
|
Kind of procedure (category name). |
time |
int | float
|
Time at which the procedure is scheduled. |
cost |
int | float
|
Cost of the procedure. |
duration |
int | float
|
Duration of the procedure. |
uuid |
UUID
|
Automatically generated unique identifier for this procedure. |
gantt_project_procedures
¶
gantt_project_procedures(
project: Project,
horizon: Horizon,
x_axis_title: str = "Time [year]",
y: str = "System",
y_axis_title: str = "System",
zero_margin: bool = True,
duration_scale: float = 1.0,
**args
) -> Figure
Create a Gantt chart for a given project's systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
RaPlan project. |
required |
horizon
|
Horizon
|
Time horizon for which to generate the figure. |
required |
x_axis_title
|
str
|
X-axis label. |
'Time [year]'
|
y
|
str
|
Column name of the data dictionary that is built in this function. (see below) |
'System'
|
y_axis_title
|
str
|
Y-axis label. |
'System'
|
zero_margin
|
bool
|
Whether to set all margins to zero. |
True
|
duration_scale
|
float
|
Conversion factor from task durations to scheduled time. The latter is in years, usually. |
1.0
|
The data dictionary contains the following columns:
- Start
- End
- System
- Tasks
- Cost
- Duration
Source code in src/raplan/plot.py
gantt_system
¶
gantt_system(
system: System,
horizon: Horizon | None = None,
x_axis_title: str = "Time [year]",
y: str = "Component",
y_axis_title: str = "Component",
zero_margin: bool = True,
**args
) -> Figure
Create a Gantt chart for a given system's components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
System
|
RaPlan |
required |
horizon
|
Horizon | None
|
Time horizon for which to generate the figure. |
None
|
x_axis_title
|
str
|
X-axis label. |
'Time [year]'
|
y
|
str
|
Column name of the data dictionary that is built in this function. (see below) |
'Component'
|
y_axis_title
|
str
|
Y-axis label. |
'Component'
|
zero_margin
|
bool
|
Whether to set all margins to zero. |
True
|
The data dictionary contains the following columns:
- Start
- End
- Component
- Task
- Cost
- Duration
Source code in src/raplan/plot.py
get_cfp_figure
¶
get_cfp_figure(
subject: (
Component
| System
| Project
| Compound
| Sequence[Component | System | Project | Compound]
),
xs: list[int | float],
horizon: Horizon | None = None,
compound: str | None = None,
thresholds: dict[str, float] = {"5%": 0.05},
x_axis_title: str = "Time",
y_axis_title: str = "CFP",
y_factor: int | float = 1,
) -> Figure
Get a figure displaying the CFP or CFPs of the subject(s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject
|
Component | System | Project | Compound | Sequence[Component | System | Project | Compound]
|
Planning object(s) with a CFP method. |
required |
xs
|
list[int | float]
|
Time values to calculate CFP values at. |
required |
horizon
|
Horizon | None
|
Optional horizon to apply. It's start is used as the X-axis offset to apply and the end is used to then set the upper bound of the X-axis. |
None
|
compound
|
str | None
|
Whether to show a compound CFP line for the subjects given. |
None
|
thresholds
|
dict[str, float]
|
Threshold lines to show. |
{'5%': 0.05}
|
x_axis_title
|
str
|
Title for the X-axis (time). |
'Time'
|
y_axis_title
|
str
|
Title for the Y-axis (CFP). |
'CFP'
|
y_factor
|
int | float
|
Factor to scale the Y-axis values by. |
1
|
Returns:
| Type | Description |
|---|---|
Figure
|
Plotly figure. |
Source code in src/raplan/plot.py
get_cost_figure
¶
get_cost_figure(
subject: (
Component
| System
| Project
| Compound
| Sequence[Component | System | Project | Compound]
),
horizon: Horizon | None = None,
bar_width: float | str = "unit",
x_axis_title: str = "Time",
y_axis_title: str = "Cost",
y_factor: int | float = 1,
**args
) -> Figure
Get a cost bar chart figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject
|
Component | System | Project | Compound | Sequence[Component | System | Project | Compound]
|
Planning object(s) with maintenance tasks with cost attached. |
required |
horizon
|
Horizon | None
|
Optional horizon to apply. It's start is used as the X-axis offset to apply and the end is used to then set the upper bound of the X-axis. |
None
|
bar_width
|
float | str
|
How to determine widths of bars shown. 'auto' for Plotly defaults, 'unit' for widths of 1, or a float for a decimal width w.r.t. axis values. |
'unit'
|
x_axis_title
|
str
|
Title for the X-axis (time). |
'Time'
|
y_axis_title
|
str
|
Title for the Y-axis (cost). |
'Cost'
|
y_factor
|
int | float
|
Factor to scale the Y-axis values by. |
1
|
Returns:
| Type | Description |
|---|---|
Figure
|
Cost bar chart figure. |
Source code in src/raplan/plot.py
get_duration_figure
¶
get_duration_figure(
subject: (
Component
| System
| Project
| Compound
| Sequence[Component | System | Project | Compound]
),
horizon: Horizon | None = None,
bar_width: float | str = "unit",
x_axis_title: str = "Time",
y_axis_title: str = "Duration",
y_factor: int | float = 1,
) -> Figure
Get a duration bar chart figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject
|
Component | System | Project | Compound | Sequence[Component | System | Project | Compound]
|
Planning object(s) with maintenance tasks with duration attached. |
required |
horizon
|
Horizon | None
|
Optional horizon to apply. It's start is used as the X-axis offset to apply and the end is used to then set the upper bound of the X-axis. |
None
|
bar_width
|
float | str
|
How to determine widths of bars shown. 'auto' for Plotly defaults, 'unit' for widths of 1, or a float for a decimal width w.r.t. axis values. |
'unit'
|
x_axis_title
|
str
|
Title for the X-axis (time). |
'Time'
|
y_axis_title
|
str
|
Title for the Y-axis (duration). |
'Duration'
|
y_factor
|
int | float
|
Factor to scale the Y-axis values by. |
1
|
Returns:
| Type | Description |
|---|---|
Figure
|
Duration bar chart figure. |
Source code in src/raplan/plot.py
get_overview_figure
¶
get_overview_figure(
subject: (
Component
| System
| Project
| Compound
| Sequence[Component | System | Project | Compound]
),
xs: list[int | float],
horizon: Horizon | None = None,
compound: str | None = None,
bar_width: float | str = "unit",
x_axis_title: str = "Time",
cfp_axis_title: str = "CFP",
cfp_factor: int | float = 1,
cost_axis_title: str = "Cost",
cost_log: bool = True,
cost_factor: int | float = 1,
duration_axis_title: str = "Duration",
duration_log: bool = True,
duration_factor: int | float = 1,
) -> Figure
Get an overview figure consisting of a CFP plot, as well as cost and duration bar charts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject
|
Component | System | Project | Compound | Sequence[Component | System | Project | Compound]
|
Planning subject(s) with CFP and maintenance tasks. |
required |
xs
|
list[int | float]
|
Values to calculate the CFP at. |
required |
horizon
|
Horizon | None
|
Optional horizon to apply. It's start is used as the X-axis offset to apply and the end is used to then set the upper bound of the X-axis. |
None
|
compound
|
str | None
|
If not |
None
|
bar_width
|
float | str
|
How to determine widths of bars shown. 'auto' for Plotly defaults, 'unit' for widths of 1, or a float for a decimal width w.r.t. axis values. |
'unit'
|
x_axis_title
|
str
|
Title for the X-axis (time). |
'Time'
|
cfp_axis_title
|
str
|
Title for the CFP Y-axis. |
'CFP'
|
cfp_factor
|
int | float
|
Scaling for the CFP values. |
1
|
cost_axis_title
|
str
|
Title for the cost Y-axis. |
'Cost'
|
cost_log
|
bool
|
Whether to display cost on a logarithmic axis. |
True
|
cost_factor
|
int | float
|
Scaling for the cost values. |
1
|
duration_axis_title
|
str
|
Title for the duration Y-axis. |
'Duration'
|
duration_log
|
bool
|
Whether to display duration on a logarithmic axis. |
True
|
duration_factor
|
int | float
|
Scaling for the duration values. |
1
|
Returns:
| Type | Description |
|---|---|
Figure
|
Subplots overview figure. |
Source code in src/raplan/plot.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
get_procedures_plot
¶
get_procedures_plot(
procedures: list[PlottingProcedure],
x_axis_title: str = "Time",
subject_axis_title: str = "Subject",
cost_axis_title: str = "Cost",
cost_log: bool = True,
cost_factor: int | float = 1,
duration_axis_title: str = "Duration",
duration_log: bool = True,
duration_factor: int | float = 1,
) -> Figure
Get a procedures plot where systems are to be plotted versus standardized procedures (groups of tasks) and their duration and cost.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
procedures
|
list[PlottingProcedure]
|
A list of procedures to be executed. |
required |
x_axis_title
|
str
|
Title for the X-axis (time). |
'Time'
|
subject_axis_title
|
str
|
Title for the subject Y-axis. |
'Subject'
|
cost_axis_title
|
str
|
Title for the cost Y-axis. |
'Cost'
|
cost_log
|
bool
|
Whether to display cost on a logarithmic axis. |
True
|
cost_factor
|
int | float
|
Factor to scale cost values by. |
1
|
duration_axis_title
|
str
|
Title for the duration Y-axis. |
'Duration'
|
duration_log
|
bool
|
Whether to display duration on a logarithmic axis. |
True
|
duration_factor
|
int | float
|
Factor to scale duration values by. |
1
|
Source code in src/raplan/plot.py
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | |