plot_styles
frequenz.lib.notebooks.solar.maintenance.plot_styles ¤
Module for plot style strategies for the plot_functions module.
This module contains the PlotStyleStrategy abstract base class and its subclasses
for different types of solar production profiles. The subclasses implement the
get_plot_styles
method to return the plot styles based on the time frame and
additional parameters.
Classes¤
frequenz.lib.notebooks.solar.maintenance.plot_styles.CalendarPlotStyle ¤
Bases: PlotStyleStrategy
Plot style strategy for calendar production profile.
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
|
Functions¤
get_plot_styles ¤
get_plot_styles(
time_frame: str,
translation_manager: TranslationManager = TranslationManager(),
**kwargs: Any
) -> dict[str, str]
Return the plot styles for calendar profiles based on the time frame.
PARAMETER | DESCRIPTION |
---|---|
time_frame
|
The time frame for the calendar view. Valid options are 'day', 'month', 'year', '12month', 'all'.
TYPE:
|
translation_manager
|
Instance of TranslationManager to handle translations.
TYPE:
|
**kwargs
|
The following additional parameters: - timezone (str): (Required) Timezone for the plot. - current (datetime): (Required) Current time reference for the plot.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, str]
|
A dictionary containing plot styles for the calendar view. |
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
|
get_strategy
classmethod
¤
get_strategy(plot_type: str) -> PlotStyleStrategy
Return the appropriate strategy class based on plot type.
PARAMETER | DESCRIPTION |
---|---|
plot_type
|
The type of plot style strategy to use.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PlotStyleStrategy
|
The appropriate subclass of PlotStyleStrategy. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the plot type is unsupported. |
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
frequenz.lib.notebooks.solar.maintenance.plot_styles.PlotStyleStrategy ¤
Bases: ABC
Abstract base class for plot style strategies.
Subclasses must implement the get_plot_styles
method based on the time
frame and additional keyword arguments. The exact required parameters in
kwargs
will vary depending on the specific plot style.
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
Functions¤
get_plot_styles
abstractmethod
¤
get_plot_styles(
time_frame: str,
translation_manager: TranslationManager = TranslationManager(),
**kwargs: Any
) -> dict[str, Any]
Return the plot styles based on the time frame and other parameters.
PARAMETER | DESCRIPTION |
---|---|
time_frame
|
The time frame for the plot. The valid options will depend on the specific subclass implementation.
TYPE:
|
translation_manager
|
Instance of TranslationManager to handle translations.
TYPE:
|
**kwargs
|
Additional parameters required or optional by the specific subclass implementation.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, Any]
|
A dictionary containing plot styles relevant to the subclass. |
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
get_strategy
classmethod
¤
get_strategy(plot_type: str) -> PlotStyleStrategy
Return the appropriate strategy class based on plot type.
PARAMETER | DESCRIPTION |
---|---|
plot_type
|
The type of plot style strategy to use.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PlotStyleStrategy
|
The appropriate subclass of PlotStyleStrategy. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the plot type is unsupported. |
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
frequenz.lib.notebooks.solar.maintenance.plot_styles.RollingPlotStyle ¤
Bases: PlotStyleStrategy
Plot style strategy for rolling production profile.
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
Functions¤
get_plot_styles ¤
get_plot_styles(
time_frame: str,
translation_manager: TranslationManager = TranslationManager(),
**kwargs: Any
) -> dict[str, str | float]
Return the plot styles for rolling profiles based on the time frame.
PARAMETER | DESCRIPTION |
---|---|
time_frame
|
The time frame for the plot. Valid options are 'hours', 'days'.
TYPE:
|
translation_manager
|
Instance of TranslationManager to handle translations.
TYPE:
|
**kwargs
|
The following additional parameters: - timezone (str): (Required) Timezone for the plot. - current (datetime): (Required) Current time reference for the plot. - time (float): (Required) The time span for the rolling window. - timespan (timedelta): (Required) Total timespan for data aggregation. - rolling_average (bool): (Required) Flag to indicate if a rolling average is used. - colour (str): (Optional) Colour for the plot.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, str | float]
|
A dictionary containing plot styles for rolling averages. |
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
get_strategy
classmethod
¤
get_strategy(plot_type: str) -> PlotStyleStrategy
Return the appropriate strategy class based on plot type.
PARAMETER | DESCRIPTION |
---|---|
plot_type
|
The type of plot style strategy to use.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PlotStyleStrategy
|
The appropriate subclass of PlotStyleStrategy. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the plot type is unsupported. |
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
frequenz.lib.notebooks.solar.maintenance.plot_styles.StatisticalPlotStyle ¤
Bases: PlotStyleStrategy
Plot style strategy for statistical production profile.
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
116 117 118 119 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 225 226 227 228 229 |
|
Functions¤
get_plot_styles ¤
get_plot_styles(
time_frame: str,
translation_manager: TranslationManager = TranslationManager(),
**kwargs: Any
) -> dict[str, dict[str, Any]]
Return the plot styles for statistical profiles based on the time frame.
PARAMETER | DESCRIPTION |
---|---|
time_frame
|
The time frame for the plot. Valid options are 'grouped', 'continuous', '24h_continuous'.
TYPE:
|
translation_manager
|
Instance of TranslationManager to handle translations.
TYPE:
|
**kwargs
|
The following additional parameters: - data_index (pd.DatetimeIndex): (Required) The index of the data. - col_label (str): (Optional) Column label for the data being plotted. - cmap (Colormap): (Optional) The colormap to use for the plot.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, dict[str, Any]]
|
A dictionary containing axes parameters and plot styles for statistics. |
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
119 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 225 226 227 228 229 |
|
get_strategy
classmethod
¤
get_strategy(plot_type: str) -> PlotStyleStrategy
Return the appropriate strategy class based on plot type.
PARAMETER | DESCRIPTION |
---|---|
plot_type
|
The type of plot style strategy to use.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PlotStyleStrategy
|
The appropriate subclass of PlotStyleStrategy. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the plot type is unsupported. |
Source code in frequenz/lib/notebooks/solar/maintenance/plot_styles.py
Functions¤
frequenz.lib.notebooks.solar.maintenance.plot_styles.style_table ¤
style_table(df: DataFrame, show: bool = False) -> HTML
Convert the DataFrame to a styled HTML table.
PARAMETER | DESCRIPTION |
---|---|
df
|
The DataFrame to convert to an HTML table.
TYPE:
|
show
|
A flag to display the HTML table.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
HTML
|
An HTML object containing the styled table. |