Changelog
Version 0.0.6
Added validation for Plot Type Parameter in KDE Distributions Function
This release adds a validation step for the plot_type
parameter in the kde_distributions
function. The allowed values for plot_type
are "hist"
, "kde"
, and "both"
. If an invalid value is provided, the function will now raise a ValueError
with a clear message indicating the accepted values. This change improves the robustness of the function and helps prevent potential errors due to incorrect parameter values.
# Validate plot_type parameter
valid_plot_types = ["hist", "kde", "both"]
if plot_type.lower() not in valid_plot_types:
raise ValueError(
f"Invalid plot_type value. Expected one of {valid_plot_types}, "
f"got '{plot_type}' instead."
)
Version 0.0.5
Ensure Consistent Font Size and Text Wrapping Across Plot Elements
This PR addresses inconsistencies in font sizes and text wrapping across various plot elements in the stacked_crosstab_plot
function. The following updates have been implemented to ensure uniformity and improve the readability of plots:
Title Font Size and Text Wrapping: - Added a
text_wrap
parameter to control the wrapping of plot titles. - Ensured that title font sizes are consistent with axis label font sizes by explicitly setting the font size usingax.set_title()
after plot generation.Legend Font Size Consistency: - Incorporated
label_fontsize
into the legend font size by directly setting the font size of the legend text usingplt.setp(legend.get_texts(), fontsize=label_fontsize)
. - This ensures that the legend labels are consistent with the title and axis labels.
Testing
Verified that titles now wrap correctly and match the specified
label_fontsize
.Confirmed that legend text scales according to
label_fontsize
, ensuring consistent font sizes across all plot elements.
Version 0.0.4
Stable release
No new updates to the codebase.
Updated the project
description
variable insetup.py
to re-emphasize key elements of the library.Minor README cleanup:
Added icons for sections that did not have them.
Version 0.0.3
Stable release
Updated logo size, fixed citation title, and made minor README cleanup:
Added an additional section for documentation, cleaned up verbiage, moved acknowledgments section before licensing and support.
Version 0.0.2
- First stable release
No new updates to the codebase; minimal documentation updates to README and
setup.py
files.Added logo, badges, and Zenodo-certified citation to README.
Version 0.0.1rc0
No new updates to the codebase; minimal documentation updates to README and
setup.py
files.
Version 0.0.1b0
New Scatter Fit Plot and Additional Updates
Added new
scatter_fit_plot()
, removed unuseddata_types()
, and added comment section headers.
Added xlim and ylim Inputs to KDE Distribution
kde_distribution()
:Added
xlim
andylim
inputs to allow users to customize axes limits inkde_distribution()
.
Added xlim and ylim Params to Stacked Crosstab Plot
stacked_crosstab_plot()
:Added
xlim
andylim
input parameters tostacked_crosstab_plot()
to give users more flexibility in controlling axes limits.
Added x and y Limits to Box and Violin Plots
box_violin_plot()
:Changed function name from
metrics_box_violin()
tobox_violin_plot()
.Added
xlim
andylim
inputs to control x and y-axis limits ofbox_violin_plot()
(formerlymetrics_box_violin
).
Added Ability to Remove Stacks from Plots, Plot All or One at a Time
Key Changes
Plot Type Parameter -
plot_type
: This parameter allows the user to choose between"regular"
,"normalized"
, or"both"
plot types.Remove Stacks Parameter -
remove_stacks
: This parameter, when set toTrue
, generates a regular bar plot using only thecol
parameter instead of a stacked bar plot. It only works whenplot_type
is set to “regular”. Ifremove_stacks
is set toTrue
whileplot_type
is anything other than “regular”, the function will raise an exception.
Explanation of Changes
Plot Type Parameter
Provides flexibility to the user, allowing specification of the type of plot to generate:
"regular"
: Standard bar plot."normalized"
: Normalized bar plot."both"
: Both regular and normalized bar plots.
Remove Stacks Parameter -
remove_stacks
: Generates a regular bar plot using only thecol
parameter, removing the stacking of the bars. Applicable only whenplot_type
is set to “regular”. An exception is raised if used with any otherplot_type
.
These changes enhance the flexibility and functionality of the stacked_crosstab_plot
function, allowing for more customizable and specific plot generation based on user requirements.
Version 0.0.1b0
Refined KDE Distributions
Key Changes
Alpha Transparency for Histogram Fill - Added a
fill_alpha
parameter to control the transparency of the histogram bars’ fill color. - Default value is0.6
. An exception is raised iffill=False
andfill_alpha
is specified.Custom Font Sizes - Introduced
label_fontsize
andtick_fontsize
parameters to control font size of axis labels and tick marks independently.Scientific Notation Toggle - Added a
disable_sci_notation
parameter to enable or disable scientific notation on axes.Improved Error Handling - Added validation for the
stat
parameter to ensure valid options are accepted. - Added checks for proper usage offill_alpha
andhist_edgecolor
whenfill
is set toFalse
.General Enhancements - Updated the function’s docstring to reflect new parameters and provide comprehensive guidance on usage.
Version 0.0.1b0
Enhanced KDE Distributions Function
Added Parameters
Grid Figsize and Single Figsize - Control the size of the overall grid figure and individual figures separately.
Hist Color and KDE Color` - Allow customization of histogram and KDE plot colors.
Edge Color - Allows customization of histogram bar edges.
Hue - Allows grouping data by a column.
Fill - Controls whether to fill histogram bars with color.
Y-axis Label` - Customizable y-axis label.
Log-Scaling - Specifies which variables to apply log scale.
Bins and Bin Width - Control the number and width of bins.
``stat``: - Allows different statistics for the histogram (
count
,density
,frequency
,probability
,proportion
,percent
).
Improvements
Validation and Error Handling - Checks for invalid
log_scale_vars
and throws aValueError
if any are found. - Throws aValueError
ifedgecolor
is changed whilefill
is set toFalse
. - Issues aPerformanceWarning
if bothbins
andbinwidth
are specified, warning of potential performance impacts.Customizable Y-Axis Label - Allows users to specify custom y-axis labels.
Warning for KDE with Count - Issues a warning if KDE is used with
stat='count'
, as it may produce misleading plots.
Updated Function to Ensure Unique IDs and Index Check
Ensured that each generated ID in
add_ids
starts with a non-zero digit.Added a check to verify that the DataFrame index is unique.
Printed a warning message if duplicate index entries are found.
These changes improve the robustness of the function, ensuring that the IDs generated are always unique and valid, and provide necessary feedback when the DataFrame index is not unique.
Check for Unique Indices - Before generating IDs, the function now checks if the DataFrame index is unique. - If duplicates are found, a warning is printed along with the list of duplicate index entries.
Generate Non-Zero Starting IDs
The ID generation process is updated to ensure that the first digit of each ID is always non-zero.
Ensure Unique IDs
A set is used to store the generated IDs, ensuring all IDs are unique before adding them to the DataFrame.
Fix Int Conversion for Numeric Columns, Reset Decimal Places
Fixed integer conversion issue for numeric columns when
decimal_places=0
in thesave_dataframes_to_excel
function.Reset
decimal_places
default value to0
.
These changes ensure correct formatting and avoid errors during conversion.
Contingency Table Updates
Error Handling for Columns - Added a check to ensure at least one column is specified. - Updated the function to accept a single column as a string or multiple columns as a list. - Raised a
ValueError
if no columns are provided or ifcols
is not correctly specified.Function Parameters - Changed parameters from
col1
andcol2
to a single parametercols
which can be either a string or a list.Error Handling - Renamed
SortBy
tosort_by
to standardize nomenclature. - Added a check to ensuresort_by
is either 0 or 1. - Raised aValueError
ifsort_by
is not 0 or 1.
Sorting Logic - Updated the sorting logic to handle the new
cols
parameter structure.Handling Categorical Data - Modified code to convert categorical columns to strings to avoid issues with
fillna("")
.Handling Missing Values - Added
df = df.fillna('')
to fill NA values within the function to account for missing data.Improved Function Documentation - Updated function documentation to reflect new parameters and error handling.
Version 0.0.1b0
Contingency Table Updates
fillna('')
added to output so that null values come through, removed'All'
column name from output, sort options0
and1
, updated docstring documentation. Tested successfully onPython 3.7.3
.
Compatibility Enhancement
Added a version check for
Python 3.7
and above.Conditional import of
datetime
to handle different Python versions.
if sys.version_info >= (3, 7):
from datetime import datetime
else:
import datetime