plot_inset_chart
This module contains methods for plotting channel reports (i.e. InsetChart).
create_title_string(reference, data_filenames)
Returns a string that contains the input file names where the color used in plotting is included in the name. This can be used as the title of the plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
name of the reference data file |
required |
data_filenames
|
list[str]
|
a list of the test data file names |
required |
Returns:
| Type | Description |
|---|---|
str
|
A string where each file name is on its own line and includes the color to be used in plotting in the name. |
Source code in emodpy_malaria/plotting/plot_inset_chart.py
get_color_name(idx)
Return name of color that should be returned by getColor() given the same input value. Needs to be synchronized with get_raw_color().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idx
|
int
|
index of the plot used to select color |
required |
Returns:
| Type | Description |
|---|---|
str
|
Color name |
Source code in emodpy_malaria/plotting/plot_inset_chart.py
get_list_of_channels(ref_data, test_data)
Returns a list of the unique channel names used in both the reference data and the test data. This should enable the display of all of the channels even when both reports do not have the same channels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref_data
|
dict
|
channel report, json dictionary consider to contain the baseline data |
required |
test_data
|
list[dict]
|
a list of channel reports (dictionaries) containing data to compare to |
required |
Returns:
| Type | Description |
|---|---|
list
|
Unique list of channels from all the channels in the input |
Source code in emodpy_malaria/plotting/plot_inset_chart.py
get_raw_color(idx)
When plotting the raw data as background, use a lighter color than the test data. Needs to be synchronized with get_color_name().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idx
|
int
|
index of the plot used to select color |
required |
Returns:
| Type | Description |
|---|---|
(str, float)
|
Tuple with color name and intensity |
Source code in emodpy_malaria/plotting/plot_inset_chart.py
plot_data(title, ref_data=None, test_data=None, raw_data_list_of_lists=None, test_filenames=None, subplot_index_min=0, subplot_index_max=100, img_dir=None, plot_name=None)
Plot the data such that there is a grid of subplots with each subplot representing a "channel" of data. Each subplot will have time on the x-axis and the units of that channel on the y-axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
The string to put at the top of the page |
required |
ref_data
|
dict
|
A channel report dictionary whose data will be plotted in red |
None
|
test_data
|
list[dict]
|
A list of channel report dictionaries whose data will be plotted in colors other than red |
None
|
test_filenames
|
list[str]
|
The list of file names in parallel to the test_data. |
None
|
subplot_index_min
|
int
|
The index of the first subplot to show based on the alphabetical order of the channels in the report. |
0
|
subplot_index_max
|
int
|
The index of the last subplot to show based on the alphabetical order of the channels in the report. |
100
|
img_dir
|
str
|
The name of the directory to save the images to. If not provided, it will open a window. |
None
|
plot_name
|
str
|
If provided the name of the file for the saved image. |
None
|
Returns:
Source code in emodpy_malaria/plotting/plot_inset_chart.py
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 | |
plot_inset_chart(dir_name=None, reference=None, comparison1=None, comparison2=None, comparison3=None, title=None, include_filenames_in_title=True, output=None)
Plot the inset chart using the provided parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_name
|
str
|
Directory containing channel reports with .json extension |
None
|
reference
|
str
|
Reference channel report filename |
None
|
comparison1
|
str
|
Comparison1 channel report filename |
None
|
comparison2
|
str
|
Comparison2 channel report filename |
None
|
comparison3
|
str
|
Comparison3 channel report filename |
None
|
title
|
str
|
Title of Plot |
None
|
include_filenames_in_title
|
bool
|
If true, includes the filenames in the title (needed for testing) |
True
|
output
|
str
|
If provided, a directory will be created and images saved to the folder. If not provided, it opens windows. |
None
|
Returns:
Source code in emodpy_malaria/plotting/plot_inset_chart.py
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 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |