Plotting
superfish.plot
Classes
Functions:
superfish.plot.add_t7data_to_axes
add_t7data_to_axes(t7data, ax, field='E', cmap=None, vmin=1e-19, scale=1)
Add a field image from t7data to an axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t7data
|
FishT7Data or PoissonT7Data
|
Parsed T7 data, as returned by
:func: |
required |
ax
|
Axes
|
Axes to draw on. |
required |
field
|
str
|
Field to plot. |
'E'
|
cmap
|
Colormap
|
Color map. Defaults to :func: |
None
|
vmin
|
float
|
Minimum value for the color scale. |
1e-19
|
scale
|
float
|
Scales the extents, to account for different units.
Example: |
1
|
Returns:
| Type | Description |
|---|---|
Axes
|
The axes that was drawn on. |
Source code in superfish/plot.py
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 | |
superfish.plot.add_wall_segment_to_axes
add_wall_segment_to_axes(seg, ax, perp_scale=0, max_field=1, field='E', cmap=None, conv=1)
Add a wall segment to an axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seg
|
WallSegment
|
Parsed wall segment, as returned by
:func: |
required |
ax
|
Axes
|
Axes to draw on. |
required |
perp_scale
|
float
|
If > 0, the field strength is drawn as perpendicular lines of this maximum length. |
0
|
max_field
|
float
|
Maximum field value, used to normalize the perpendicular line lengths and colors. |
1
|
field
|
str
|
Wall field column to draw, e.g. |
'E'
|
cmap
|
Colormap
|
Color map for the perpendicular lines. Defaults to
:func: |
None
|
conv
|
float
|
Unit conversion factor used by Superfish. |
1
|
Source code in superfish/plot.py
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 | |
superfish.plot.get_cmap0
get_cmap0()
Get the default color map.
Returns:
| Type | Description |
|---|---|
Colormap
|
The |
Source code in superfish/plot.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
superfish.plot.perp
perp(x, y, scale=1)
Calculate lines perpendicular to the segments of a polyline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Coordinates of the polyline vertices. |
required |
y
|
ndarray
|
Coordinates of the polyline vertices. |
required |
scale
|
float or ndarray
|
Length of the perpendicular lines. An array gives a per-segment length. |
1
|
Returns:
| Type | Description |
|---|---|
PX, PY : ndarray
|
Endpoint coordinates of the perpendicular lines, each of shape
|
Examples:
>>> X = np.array([1, 2, 3, 4, 8])
>>> Y = np.array([4, 5, 6, 9, 10])
>>> PX, PY = perp(X, Y)
>>> fig, ax = plt.subplots()
>>> ax.set_aspect('equal')
>>> ax.plot(X, Y)
>>> for i in range(len(PX)):
... ax.plot(PX[i, :], PY[i, :])
Source code in superfish/plot.py
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 | |
superfish.plot.plot_wall
plot_wall(
wall_segments,
perp_scale=0,
field="E",
max_field=None,
cmap=None,
ax=None,
conv=1,
return_figure=False,
**kwargs,
)
Plot the wall from wall segments.
TODO: this is only for FISH problems so far
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wall_segments
|
list of WallSegment
|
Parsed wall segments, as returned in the |
required |
perp_scale
|
float
|
If > 0, the field is plotted as perpendicular lines along the wall. |
0
|
field
|
str
|
Wall field column to plot, e.g. |
'E'
|
max_field
|
float
|
Maximum field for normalization. Defaults to the maximum over all segments. |
None
|
cmap
|
Colormap
|
Color map for the field lines. Defaults to |
None
|
ax
|
Axes
|
Axes to draw on. If not given, a new figure is created. |
None
|
conv
|
float
|
Conversion factor to internal units (cm). |
1
|
return_figure
|
bool
|
Return the figure object. |
False
|
**kwargs
|
Any
|
Passed to |
{}
|
Returns:
| Type | Description |
|---|---|
Figure or None
|
The figure, if |
Source code in superfish/plot.py
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 | |