plotting
plotting
¶
Utilities for plot creation.
Plotter
¶
Plot creator class.
Source code in cssfinder/reports/plotting.py
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 188 189 190 191 |
|
__init__
¶
Initialize plot creator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
corrections |
DataFrame
|
A DataFrame containing the distance decay corrections. The DataFrame should have an "index" column and a "value" column. |
required |
Source code in cssfinder/reports/plotting.py
plot_corrections
¶
Create a plot of distance decay corrections.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
axes |
Optional[Axes]
|
Optional axes object to reuse, when none is given, new figure is created, by default None |
None
|
Returns:
Type | Description |
---|---|
Plot
|
Plot object containing plot axes. |
Notes
The function creates a line plot of the distance decay corrections, with the "index" column on the x-axis and the "value" column on the y-axis. The plot includes a grid and axis labels, and a title indicating that it shows distance decay.
The function returns the Plot object granting access to axes for the created plot, which can be further customized or saved using the methods of the matplotlib API.
Source code in cssfinder/reports/plotting.py
plot_corrections_inverse
¶
Create a plot offsets inverse of distance decay corrections.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
axes |
Optional[Axes]
|
Optional axes object to reuse, when none is given, new figure is created, by default None |
None
|
Returns:
Type | Description |
---|---|
Plot
|
Plot object containing plot axes. |
Notes
The function creates a line plot of the inverse of distance decay corrections, with the "index" column on the x-axis and the "value" column inverse on the y-axis. The plot includes a grid and axis labels, and a title indicating that it shows distance decay.
The function returns the Plot object granting access to axes for the created plot, which can be further customized or saved using the methods of the matplotlib API.
Source code in cssfinder/reports/plotting.py
plot_iteration
¶
Create a plot of iteration linear corrections.
Returns:
Type | Description |
---|---|
Axes
|
The axes object for the created plot. |
Notes
The function creates a line plot of the iteration linear corrections,
with the "iteration" column on the x-axis and the correction values on
the y-axis. The correction values are calculated using the
SlopeProperties
class, which takes the "index" column as input and
returns the corresponding correction values for each iteration.
The plot includes a grid and axis labels, but no title. The function returns the axes object for the created plot, which can be further customized or saved using the methods of the matplotlib API.
Source code in cssfinder/reports/plotting.py
Plot
dataclass
¶
Container class for plots generated with Plotter class.
Source code in cssfinder/reports/plotting.py
configure
¶
Set the size of the current figure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width |
int
|
The width of the figure in inches. Default is 10. |
8
|
height |
int
|
The height of the figure in inches. Default is 10. |
6
|
Returns:
Type | Description |
---|---|
Self
|
Returns the instance of the object to allow for method chaining. |
Source code in cssfinder/reports/plotting.py
save_plot
¶
Save figure to file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dest |
Path | BytesIO
|
Path to file or writable BytesIO. |
required |
dpi |
int
|
Plot output dpi, by default 150 |
300
|
file_format |
Optional[str]
|
File format, when None, deduced from file path, by default None |
None
|
Source code in cssfinder/reports/plotting.py
base64_encode
¶
Encode plot as base64 string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_format |
Optional[str]
|
Preferred file format, by default None |
None
|
Returns:
Type | Description |
---|---|
str
|
Encoded image. |