Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #12

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Develop #12

wants to merge 18 commits into from

Conversation

danmcgib
Copy link
Owner

No description provided.

mputlek and others added 18 commits September 23, 2024 18:13
Argument Handling: The update checks if the first argument (formula) is actually a DataFrame. If it is, the function treats it as the data parameter and sets formula to None. This ensures that the function can handle both a formula and a DataFrame as the first argument.
This update enhances the hist() function by adding proper support for subplots. Previously, the subplot argument was not handled correctly, and multiple histograms could not be displayed within a single figure. Now, users can specify subplots using the subplot argument, which allows for seamless integration of multiple histograms within a grid of subplots.

Key Changes:

Subplot Handling:
Added a subplot argument to allow plotting within specific subplots (subplot=(nrows, ncols, index)).
If a subplot is provided, the histogram will be plotted in the specified subplot. If no subplot is provided, a new figure will be created.
Improved Layout:
Added a check to automatically adjust the layout when multiple subplots are used (plt.tight_layout()).
Updated hist() Function with Subplot Support
Summary:
This update adds support for subplots to the hist_res function, allowing users to specify a subplot position within a larger figure grid. If a subplot argument is provided (as a tuple, e.g., (nrows, ncols, index)), the histogram of residuals will be plotted in the specified location within the subplot grid. If no subplot is provided, a new figure is created.

Changes Made:

Added a subplot argument to hist_res, enabling it to position the histogram and normal distribution curve within a specified subplot.
Modified the function to use plt.subplot(*subplot) if a subplot argument is passed, or plt.figure() to create a new figure when subplot is None.
Summary:
This update adds subplot support to the plot_res function, allowing users to specify a subplot location within a grid of plots. If a subplot argument is provided (as a tuple, e.g., (nrows, ncols, index)), the residual plot will be displayed in the specified subplot position. If no subplot is provided, a new figure will be created.

Changes Made:

Added a subplot parameter to plot_res, enabling it to be positioned within a specified subplot grid.
Implemented plt.subplot(*subplot) to place the plot in a grid when subplot is provided, or plt.figure() to generate a new figure when subplot is None.
New Parameters:
main specifies the title of the histogram plot.
xlab sets the x-axis label.
ylab sets the y-axis label.

Usage of New Parameters:
plt.title(main) sets the plot’s title.
plt.xlabel(xlab) and plt.ylabel(ylab) set the x-axis and y-axis labels, respectively.
hists(), plot_cook(), plot_cor()
added main, xlab, and ylab arguments
1. main: This sets the main title of the scatter plot matrix.
2. xcolor: Sets the color of the scatter points for independent (X) variables.
3. ycolor: Sets the color of the scatter points where the dependent (Y) variable is involved.
4. lines: A boolean argument that, if True, adds regression lines to each plot in the matrix.
5. linescolor: Specifies the color of the regression lines if lines=True.
fit.py
summary.py
barplot, hist, hist_res, plot_res
1. New input_data Argument:
Replaced formula_or_data with a more intuitive input_data argument, allowing the function to handle:
- A DataFrame for plotting all numeric columns.
- A Series for generating a single histogram.
- A list of Series (vector-like input) to plot multiple histograms.
- A formula for specifying dependent and independent variables.

2. Support for Vector-like Input:
Added the ability to handle lists of Series (e.g., input_data = [df['XOM'], df['MSFT']]). The function concatenates these into a DataFrame and creates histograms for each.

3. Expanded Input Flexibility:
Maintains support for:
- DataFrame input (plots all numeric columns).
- Formula input (plots dependent and independent variables).
- Vector-like input (plots specific columns).
- Single Series input (plots one numeric column).

4. Enhanced Error Handling:
Improved robustness by adding error checks for invalid input types, making the function more reliable.

5.  Code Refinements:
- Improved readability and layout calculations for easier maintenance and usage.
- Optimized logic for handling diverse inputs, ensuring smooth transitions between different input types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants