Skip to content

Commit

Permalink
display the correct y_label, was ignored before...
Browse files Browse the repository at this point in the history
  • Loading branch information
artiom-matvei committed Oct 28, 2024
1 parent e291fc7 commit b11fd1d
Show file tree
Hide file tree
Showing 41 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion marginaleffects/comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def comparisons(
):
"""
`comparisons()` and `avg_comparisons()` are functions for predicting the outcome variable at different regressor values and comparing those predictions by computing a difference, ratio, or some other function. These functions can return many quantities of interest, such as contrasts, differences, risk ratios, changes in log odds, lift, slopes, elasticities, etc.
Parameters
----------
model : object
Expand Down
11 changes: 7 additions & 4 deletions marginaleffects/p9.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from plotnine import (
ggplot,
aes,
facet_wrap,
facet_grid,
geom_pointrange,
position_dodge,
geom_ribbon,
geom_line,
geom_point,
facet_wrap,
facet_grid,
ggplot,
labs,
position_dodge,
)
import polars as pl

Expand Down Expand Up @@ -61,4 +62,6 @@ def plot_common(model, dt, y_label, var_list):
elif len(var_list) == 4:
p = p + facet_grid(f"{var_list[3]} ~ {var_list[2]}", scales="free")

p = p + labs(y=y_label)

return p
Binary file modified tests/images/plot_comparisons/continuous_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_comparisons/continuous_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_comparisons/continuous_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_comparisons/discrete_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_comparisons/discrete_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_comparisons/discrete_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_comparisons/threenum_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_comparisons/threenum_horiz_axis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/by_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/by_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/condition_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/condition_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_114_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_114_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_114_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_114_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_114_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_114_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_114_07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_114_08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_57_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_57_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_predictions/issue_57_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_slopes/by_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_slopes/by_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_slopes/condition_01.png
Binary file modified tests/images/plot_slopes/condition_02.png
Binary file modified tests/images/plot_slopes/condition_03.png
Binary file modified tests/images/plot_slopes/condition_04.png
Binary file modified tests/images/plot_slopes/issue114_slopes_01.png
Binary file modified tests/images/plot_slopes/issue114_slopes_02.png
Binary file modified tests/images/plot_slopes/issue114_slopes_03.png
Binary file modified tests/images/plot_slopes/issue_114_03.png
Binary file modified tests/images/plot_slopes/issue_114_04.png
Binary file modified tests/images/plot_slopes/issue_114_05.png
Binary file modified tests/images/plot_slopes/issue_114_06.png
Binary file modified tests/images/plot_slopes/issue_114_07.png
Binary file modified tests/images/plot_slopes/issue_114_08.png
4 changes: 2 additions & 2 deletions tests/test_plot_slopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def test_by(self, penguins_mod_add):
fig = plot_slopes(penguins_mod_add, variables="species", by="island")
assert assert_image(fig, "by_01", FIGURES_FOLDER) is None

# fig = plot_slopes(mod, variables="bill_length_mm", by=["species", "island"])
# assert assert_image(fig, "by_02", FIGURES_FOLDER) is None
fig = plot_slopes(penguins_mod_add, variables="bill_length_mm", by=["species", "island"])
assert assert_image(fig, "by_02", FIGURES_FOLDER) is None

def test_condition(self, penguins_mod_add):
fig = plot_slopes(
Expand Down

0 comments on commit b11fd1d

Please sign in to comment.