common
plot_histogram(df, column, title=None, xrange=None, yrange=None, xbins=None, histnorm='percent', show=False, output=None, output_size=(1600, 900))
Plot histogram figure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
Data to plot. |
required |
column |
str
|
DataFrame column to plot. |
required |
title |
Optional[str]
|
Title of figure. Defaults to None. |
None
|
xrange |
Optional[Tuple[int, int]]
|
Range in axis X. Defaults to None. |
None
|
yrange |
Optional[Tuple[int, int]]
|
Range in axis Y. Defaults to None. |
None
|
xbins |
Optional[Dict[str, Any]]
|
Width of X bins. Defaults to None. |
None
|
histnorm |
Optional[str]
|
Histnorm. Defaults to "percent". |
'percent'
|
show |
bool
|
Whether to show the figure or not. Defaults to False. |
False
|
output |
Optional[str]
|
Output path folder. Defaults to None. |
None
|
output_size |
Tuple[int, int]
|
Size of saved images. Defaults to (1600, 900). |
(1600, 900)
|
Returns:
Type | Description |
---|---|
go.Figure
|
Histogram figure. |
Source code in pyodi/plots/common.py
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 |
|
plot_scatter_with_histograms(df, x='width', y='height', title=None, show=True, output=None, output_size=(1600, 900), histogram=True, label='category', colors=None, legendgroup=None, fig=None, row=1, col=1, xaxis_range=None, yaxis_range=None, histogram_xbins=None, histogram_ybins=None, kwargs)
Allows to compare the relation between two variables of your COCO dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
COCO annotations generated DataFrame. |
required |
x |
str
|
Name of column that will be represented in x axis. Defaults to "width". |
'width'
|
y |
str
|
Name of column that will be represented in y axis. Defaults to "height". |
'height'
|
title |
Optional[str]
|
Plot name. Defaults to None. |
None
|
show |
bool
|
Whether to show the figure or not. Defaults to True. |
True
|
output |
Optional[str]
|
Output path folder. Defaults to None. |
None
|
output_size |
Tuple[int, int]
|
Size of saved images. Defaults to (1600, 900). |
(1600, 900)
|
histogram |
bool
|
Whether to draw a marginal histogram distribution of each axis or not. Defaults to True. |
True
|
label |
str
|
Name of the column with class information in df_annotations. Defaults to 'category'. |
'category'
|
colors |
Optional[List]
|
List of rgb colors to use. If None default plotly colors are used. Defaults to None. |
None
|
legendgroup |
Optional[str]
|
When present legend is grouped by different categories (see https://plotly.com/python/legend/). |
None
|
fig |
Optional[go.Figure]
|
When figure is provided, trace is automatically added on it. Defaults to None. |
None
|
row |
int
|
Subplot row to use when fig is provided. Defaults to 1. |
1
|
col |
int
|
Subplot col to use when fig is provided. Defaults to 1. |
1
|
xaxis_range |
Optional[Tuple[float, float]]
|
range of values for the histogram's horizontal axis |
None
|
yaxis_range |
Optional[Tuple[float, float]]
|
range of values for the histogram's vertical axis |
None
|
histogram_xbins |
Optional[Dict[str, Any]]
|
number of bins for the histogram's horizontal axis |
None
|
histogram_ybins |
Optional[Dict[str, Any]]
|
number of bins for the histogram's vertical axis |
None
|
Returns:
Type | Description |
---|---|
go.Figure
|
Plotly figure. |
Source code in pyodi/plots/common.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 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 |
|
save_figure(figure, output_name, output_dir, output_size)
Saves figure into png image file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
figure |
go.Figure
|
Figure to save. |
required |
output_name |
str
|
Output filename. |
required |
output_dir |
str
|
Output directory. |
required |
output_size |
Tuple[int, int]
|
Size of saved image. |
required |
Source code in pyodi/plots/common.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|