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

Change coord name from x to channel in plot_channel_contribution_share_hdi plot #1183

Open
wd60622 opened this issue Nov 7, 2024 · 0 comments
Labels

Comments

@wd60622
Copy link
Contributor

wd60622 commented Nov 7, 2024

The plot_channel_contribution_share_hdi displays x for each forest plot. I believe the coord name can be change to channel to solve this.

Reference:

  • Source code:
    def plot_channel_contribution_share_hdi(
    self, hdi_prob: float = 0.94, **plot_kwargs: Any
    ) -> plt.Figure:
    """Plot the share of channel contributions in a forest plot.
    Parameters
    ----------
    hdi_prob : float, optional
    HDI value to be displayed, by default 0.94
    **plot_kwargs
    Additional keyword arguments to pass to `az.plot_forest`.
    Returns
    -------
    plt.Figure
    """
    channel_contributions_share: DataArray = (
    self._get_channel_contributions_share_samples()
    )
    ax, *_ = az.plot_forest(
    data=channel_contributions_share,
    combined=True,
    hdi_prob=hdi_prob,
    **plot_kwargs,
    )
    ax.xaxis.set_major_formatter(mtick.FuncFormatter(lambda y, _: f"{y: 0.0%}"))
    fig: plt.Figure = plt.gcf()
    fig.suptitle("channel Contribution Share", fontsize=16, y=1.05)
    return fig
  • Example plot: https://www.pymc-marketing.io/en/stable/notebooks/mmm/mmm_case_study.html#return-on-ads-spend-roas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant