bs_plots module¶
General plotting utilities.
set_axis
: set the axis limits, with a margindrawArrow_2dim
: draw an arrow between two points in a 2D Matplotlib plot.
drawArrow_2dim(ax, xA, xB, yA, yB, c='k', ls='-')
¶
Draw an arrow between two points in a 2D Matplotlib plot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
Axes
|
the axis object |
required |
xA |
float
|
the x coordinate of the starting point |
required |
xB |
float
|
the x coordinate of the ending point |
required |
yA |
float
|
the y coordinate of the starting point |
required |
yB |
float
|
the y coordinate of the ending point |
required |
c |
str
|
the color of the arrow |
'k'
|
ls |
str
|
the line style of the arrow |
'-'
|
Returns:
Type | Description |
---|---|
None
|
nothing |
Source code in bs_python_utils/bs_plots.py
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 |
|
set_axis(x, margin=0.05)
¶
sets the axis limits with a margin
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ndarray
|
the values of the variable |
required |
margin |
float
|
the margin to add, a fraction of the range of the variable |
0.05
|
Returns:
Type | Description |
---|---|
tuple[float, float]
|
the min and max for the axis. |
Source code in bs_python_utils/bs_plots.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|