nucml.plot package¶
Submodules¶
nucml.plot.utilities module¶
-
nucml.plot.utilities.
cat_plot
(features, df, groupby, top=10, reverse=False, save=False, path='')[source]¶ Plots a categorical bar plot.
- Parameters
features (list) – List of feature names to plot. Every single feature will be plotted individually.
df (pd.DataFrame) – Dataframe containing the features and data to be plotted.
groupby (str) – Feature by which the dataframe will be grouped for each bar plot.
top (int, optional) – In cases where there are a lot of categories, it is a good idea to limit the number of bars in the plot. This argument specifies the maximum number of categories to render. Defaults to 10.
reverse (bool, optional) – If True, the lowest frequent items are plotted rather than the most popular. Defaults to False.
save (bool, optional) – If True, the figure will be saved. Defaults to False.
path (str, optional) – Path-like string where the figure will be saved in case save=True. Defaults to ‘’.
- Returns
None
-
nucml.plot.utilities.
create_gif
(directory, extension, name, duration=2)[source]¶ Gathers all images in a directory and creates a GIF file.
- Parameters
directory (str) – Path-like string where all images are saved.
extension (str) – Extension of images to be gathered (i.e. jpg).
name (str) – Name to save the GIF file as.
duration (int, optional) – Duration of the GIF file. Defaults to 2.
- Returns
None
-
nucml.plot.utilities.
kdeplot
(x, labels=[''], xlabel='', ylabel='', title='', figsize=(15, 10), save=False, path='')[source]¶ Creates a KDE plot for a given array.
- Parameters
x (np.array or list) – Numpy array or list of numpy arrays. If a list is given, all provided arrays will be ploted in the same figure.
labels (list, optional) – If x is a list, this argument represents the labels that will be plotted. Defaults to [‘’].
xlabel (str, optional) – Label for the X-axis. Defaults to ‘’.
ylabel (str, optional) – Label for the Y-axis. Defaults to ‘’.
title (str, optional) – Title of the plotted figure. Defaults to ‘’.
figsize (tuple, optional) – Figure size. Defaults to (15,10).
save (bool, optional) – If True, the figure will be saved. Defaults to False.
path (str, optional) – Path-like string where the figure will be saved in case save=True. Defaults to ‘’.
- Returns
None
-
nucml.plot.utilities.
plotly_converter
(plotly_object, convert_to='pil')[source]¶ Converts a Plotly figure into a PIL image object or a numpy array.
- Parameters
plotly_object (object) – Plotly object to convert.
convert_to (str, optional) – Type of file to return. Type can be “pil” or “array”. Defaults to “pil”.
- Returns
Pil image or numpy array
- Return type
object