Plotting
pyextremes.plotting.extremes.plot_extremes(ts, extremes, extremes_method, extremes_type=None, block_size=None, threshold=None, r=None, figsize=(8, 5), ax=None)
¶
Plot extreme events.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ts |
Series
|
Time series from which |
required |
extremes |
Series
|
Time series of extreme events. |
required |
extremes_method |
str
|
Extreme value extraction method. Supported values: BM - Block Maxima POT - Peaks Over Threshold |
required |
extremes_type |
str
|
Type of |
None
|
block_size |
str or Timedelta
|
Block size, used only if |
None
|
threshold |
float
|
Threshold, used only if |
None
|
r |
pandas.Timedelta or value convertible to timedelta
|
Duration of window used to decluster the exceedances.
See pandas.to_timedelta for more information.
Used to show clusters. If None (default) then clusters are not shown.
Clusters are shown only if both |
None
|
figsize |
tuple
|
Figure size in inches in format (width, height). By default it is (8, 5). |
(8, 5)
|
ax |
Axes
|
Axes onto which extremes plot is drawn. If None (default), a new figure and axes objects are created. |
None
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Figure object. |
axes |
Axes
|
Axes object. |
Source code in src/pyextremes/plotting/extremes.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 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 |
|
pyextremes.plotting.return_values.plot_return_values(observed_return_values, modeled_return_values, ax=None, figsize=(8, 5))
¶
Plot return values and confidence intervals for given return periods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
observed_return_values |
DataFrame
|
DataFrame with observed return values. First column must have extreme values. Must have 'return period' column. |
required |
modeled_return_values |
DataFrame
|
DataFrame with modeled return values. Index has return periods. Must have the following columns: 'return value', 'lower ci', 'upper ci'. |
required |
ax |
Axes
|
Axes onto which the return value plot is drawn. If None (default), a new figure and axes objects are created. |
None
|
figsize |
tuple
|
Figure size in inches in format (width, height). By default it is (8, 5). |
(8, 5)
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Figure object. |
axes |
Axes
|
Axes object. |
Source code in src/pyextremes/plotting/return_values.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
pyextremes.plotting.probability_plots.plot_probability(observed, theoretical, ax=None, figsize=(8, 8))
¶
Plot a probability plot (QQ or PP).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
observed |
ndarray
|
Observed values. |
required |
theoretical |
ndarray
|
Theoretical values. |
required |
ax |
Axes
|
Axes onto which the probability plot is drawn. If None (default), a new figure and axes objects are created. |
None
|
figsize |
tuple
|
Figure size in inches in format (width, height). By default it is (8, 8). |
(8, 8)
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Figure object. |
axes |
Axes
|
Axes object. |
Source code in src/pyextremes/plotting/probability_plots.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
pyextremes.plotting.mcmc.plot_trace(trace, trace_map=None, burn_in=0, labels=None, figsize=None)
¶
Plot a trace plot for a given MCMC sampler trace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trace |
ndarray
|
Array with MCMC sampler trace. Has a shape of (n_walkers, n_samples, n_parameters). |
required |
trace_map |
tuple
|
Tuple with maximum aposteriori estimate of distribution parameters. If provided, MAP values are plotted as orange lines on top of the trace. If None (default) then MAP estimates are not plotted. |
None
|
burn_in |
int
|
Burn-in value (number of first steps to discard for each walker). By default it is 0 (no values are discarded). |
0
|
labels |
list of strings
|
Sequence of strings with parameter names, used to label axes. If None (default), then axes are labeled sequentially. |
None
|
figsize |
tuple
|
Figure size in inches.
If None (default), then figure size is calculated automatically
as 8 by 2 times number of parameters ( |
None
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Figure object. |
axes |
list
|
List with |
Source code in src/pyextremes/plotting/mcmc.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
pyextremes.plotting.mcmc.plot_corner(trace, trace_map=None, burn_in=0, labels=None, levels=None, figsize=(8, 8))
¶
Plot a corner plot for a given MCMC sampler trace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trace |
ndarray
|
Array with MCMC sampler trace. Has a shape of (n_walkers, n_samples, n_parameters). |
required |
trace_map |
tuple
|
Tuple with maximum aposteriori estimate of distribution parameters. If provided, MAP values are plotted as orange lines. If None (default) then MAP estimates are not plotted. |
None
|
burn_in |
int
|
Burn-in value (number of first steps to discard for each walker). By default it is 0 (no values are discarded). |
0
|
labels |
array - like
|
Sequence of strings with parameter names, used to label axes. If None (default), then axes are labeled sequentially. |
None
|
levels |
int
|
Number of Gaussian KDE contours to plot. If None (default), then not shown. |
None
|
figsize |
tuple
|
Figure size in inches. By default it is (8, 8). |
(8, 8)
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Figure object. |
axes |
list
|
2D list with Axes objects of size N by N, where N is |
Source code in src/pyextremes/plotting/mcmc.py
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 230 231 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 315 316 |
|