加入新推出的
Discord 社区,展开实时讨论,获得同行支持,并直接与 Meridian 团队互动!
绘制媒体可视化图表
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您可以通过 MediaSummary
和 MediaEffects
类查看媒体效应的可视化图表。每个类都有不同的图表来显示每个渠道的媒体指标。因此,您可以创建标准 HTML 输出中没有的自定义图表。例如,您可以绘制特定渠道、更改或删除可信区间、添加 Adstock 衰减,以及添加 Hill 饱和度曲线。
在 MediaSummary
类下,您可以绘制以下图表:
在 MediaEffects
类下,您可以绘制以下曲线:
贡献面积图
贡献面积图以堆叠面积的形式显示各个营销渠道对总结果(收入或 KPI)的贡献随时间的变化。在特定时间点,每个彩色条带的高度表示相应渠道的贡献。某一时间点所有条带的总高度表示总结果。条带厚度随时间变化的情况表明渠道贡献的变化趋势。
运行以下命令可绘制渠道贡献面积图:
media_summary.plot_channel_contribution_area_chart()
输出示例:
贡献排名变化图
贡献排名变化图根据增量结果显示各渠道(含基准)的贡献在一段时间内的相对排名变化。每条线代表一个渠道,其在给定时间点的垂直位置表示其排名。排名第 1 表示贡献最大。上升线表示排名提升,下降线表示排名下降,交叉线突出显示了各个渠道之间的相对表现变化。排名可每周显示一次或在每个季度末显示。
运行以下命令可绘制渠道贡献排名变化图:
media_summary.plot_channel_contribution_bump_chart()
输出示例:
贡献瀑布图
贡献瀑布图向用户展示了每个渠道对总增量收入或 KPI 的贡献。基准显示的是没有任何媒体效应时的收入或 KPI。
运行以下命令可绘制贡献瀑布图:
media_summary.plot_contribution_waterfall_chart()
输出示例:
贡献饼图
您可以查看所有渠道带来的增量收入或 KPI 贡献的饼图,并将其与没有任何媒体效应时的基准进行比较。
运行以下命令可绘制贡献饼图:
media_summary.plot_contribution_pie_chart()
输出示例:
支出与贡献对比图
支出与贡献对比图比较了不同渠道间的支出与增量收入或 KPI 比例。这一可视化图表显示了各渠道所用的媒体支出百分比,以及各渠道对总增量收入或 KPI 的贡献百分比。100% 的收入(或 KPI)是媒体带来的总增量收入(或 KPI),不包括基准。最后,绿条突出显示了每个渠道的投资回报率 (ROI)。
运行以下命令可绘制支出与贡献对比图:
media_summary.plot_spend_vs_contribution()
输出示例:
各渠道的投资回报率图
比较不同渠道的投资回报率 (ROI) 有助于了解每个渠道的支出对收入的影响。投资回报率是指单位支出带来的收入。此图显示了可信区间。
如果您的数据包含货币单位值未知的非收入型 KPI,您可以改为比较单位增量 KPI 的费用 (CPIK)。
运行以下命令可绘制各渠道的 CPIK 图:
media_summary.plot_cpik()
投资回报率与效果对比图
您可以绘制投资回报率 (ROI) 与效果对比图,比较每个渠道的投资回报率与效果。效果是根据每个媒体单位获得的增量收入来衡量的。在此图中,每个渠道的规模与支出水平相对应。圆圈越大,说明渠道支出越多。
投资回报率与边际投资回报率对比图
您可以将投资回报率 (ROI) 与边际投资回报率 (mROI) 进行比较,其中边际投资回报率是指额外支出单位费用所带来的投资回报。圆圈的大小与相应渠道的支出金额相对应。支出越多,圆圈就越大。
运行以下命令可绘制投资回报率与边际投资回报率对比图:
media_summary.plot_roi_vs_mroi()
输出示例:
您可以选择要查看的具体渠道,并选择显示同等大小的投资回报率轴和边际投资回报率轴。您也可以停用大小差异。
以下命令示例选择了特定渠道,并将轴设置为同等大小:
media_summary.plot_roi_vs_mroi(
selected_channels=["Channel1", "Channel4"],
equal_axes=True
)
输出示例:
响应曲线
响应曲线显示了您当前的支出水平,以及每个渠道的支出回报从哪里开始递减。
您可以查看每个渠道的响应曲线,这些曲线可以显示在一张图表中,也可以单独绘制。图表中的阴影区域显示的是可信区间,而点则表示当前支出。
在独立图表中查看各条响应曲线:
media_effects = visualizer.MediaEffects(meridian)
media_effects.plot_response_curves()
输出示例:(点击图片可放大。)

在一张图表中查看多条曲线并隐藏可信区间:
media_effects = visualizer.MediaEffects(meridian)
media_effects.plot_response_curves(
plot_separately=False,
include_ci=False
)
输出示例:
仅查看支出排名靠前的渠道的响应曲线:
media_effects = visualizer.MediaEffects(meridian)
media_effects.plot_response_curves(
plot_separately=False,
num_channels_displayed=1
)
输出示例:
Adstock 衰减曲线
Adstock 衰减可视化图表显示了媒体效应的衰减率,Meridian 使用的几何 Adstock 衰减会在第一天达到峰值。这种方法还考虑了广告在展示后对消费者的影响。
如果后验高于先验,那么在该媒体渠道投放广告的效应持续时间会比假设的更长。
显示的时间单位数只能为 max_lag
值,在以下输出示例中,该值设置为 8 个时间单位。时间单位通常设置为周,但也可以改用天。
运行以下命令可绘制 Adstock 衰减曲线:
media_effects.plot_adstock_decay()
输出示例:(点击图片可放大。)

Hill 饱和度曲线
Hill 饱和度曲线显示了广告展示对消费者的回报递减情况。该模型使用 C 型曲线来表示效果降低或饱和情况。在下例中,Y 轴表示展示无限量广告的相对效果。X 轴表示人均展示次数,其中展示是指客户看到广告。这种组合显示了每个媒体渠道的饱和度。
此图表还显示了数据的直方图,即在数据的所有可用时间段和地理位置,广告的人均展示次数。
运行以下命令可绘制 Hill 饱和度曲线:
media_effects.plot_hill_curves()
输出示例:(点击图片可放大。)

如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-31。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-31。"],[[["\u003cp\u003eThe \u003ccode\u003eMediaSummary\u003c/code\u003e and \u003ccode\u003eMediaEffects\u003c/code\u003e classes offer visualizations for media metrics, enabling customized plots beyond the standard HTML output, such as plotting specific channels and modifying credible intervals.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eMediaSummary\u003c/code\u003e allows you to generate charts such as contribution waterfall and pie charts, spend versus contribution, ROI by channel, ROI versus effectiveness, and ROI versus marginal ROI.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eMediaEffects\u003c/code\u003e provides capabilities to plot response curves, Adstock decay curves, and Hill saturation curves, offering insights into media effect dynamics.\u003c/p\u003e\n"],["\u003cp\u003eUsers can customize plots within both classes by selecting specific channels, adjusting credible intervals, disabling size differences, or viewing plots independently or together.\u003c/p\u003e\n"],["\u003cp\u003eThe visualizations can provide insights on the effectiveness of the channels, showing ad impact on consumers, how much each channel contributed to incremental revenue or KPI, or even how the spend on each channel has impacted the revenue.\u003c/p\u003e\n"]]],["The `MediaSummary` and `MediaEffects` classes provide media effect visualizations. `MediaSummary` offers charts like contribution waterfall/pie, spend vs. contribution, ROI by channel, ROI vs. effectiveness, and ROI vs. marginal ROI. `MediaEffects` allows plotting response, Adstock decay, and Hill saturation curves. These visualizations enable customized plots, such as plotting specific channels, adjusting credible intervals, adding Adstock decay, and Hill saturation curves. Commands are provided to run and plot each chart type.\n"],null,["You can view the visualizations for the media effects through the `MediaSummary`\nand `MediaEffects` classes. Each has different plots to show the media metrics\nper channel. These let you create customized plots that are not available in the\nstandard HTML output. For example, you can plot specific channels, change or\ndelete the credible interval, add Adstock decay, and add Hill saturation curves.\n\nUnder the `MediaSummary` class, you can plot the following charts:\n\n- [Contribution area chart](/meridian/docs/user-guide/plot-media-visualizations#area-chart)\n- [Contribution bump chart](/meridian/docs/user-guide/plot-media-visualizations#bump-chart)\n- [Contribution waterfall chart](/meridian/docs/user-guide/plot-media-visualizations#waterfall-chart)\n- [Contribution pie chart](/meridian/docs/user-guide/plot-media-visualizations#pie-chart)\n- [Spend versus contribution](/meridian/docs/user-guide/plot-media-visualizations#spend-vs-contribution)\n- [ROI by channel](/meridian/docs/user-guide/plot-media-visualizations#roi-channel)\n- [ROI versus effectiveness](/meridian/docs/user-guide/plot-media-visualizations#roi-vs-effectiveness)\n- [ROI versus marginal ROI](/meridian/docs/user-guide/plot-media-visualizations#roi-mroi)\n\nUnder the `MediaEffects` class, you can plot the following curves:\n\n- [Response curves](/meridian/docs/user-guide/plot-media-visualizations#response-curves)\n- [Adstock decay curves](/meridian/docs/user-guide/plot-media-visualizations#adstock-decay)\n- [Hill saturation curves](/meridian/docs/user-guide/plot-media-visualizations#hill-saturation)\n\nContribution area chart\n\nThe Contribution Area Chart shows the contribution of each marketing channel to\nthe total outcome (revenue or KPI) over time as a stacked area. The height of\neach colored band at a specific time point represents that channel's\ncontribution. The total height of all bands at a time point represents the total\noutcome. Changes in band thickness over time indicate shifts in a channel's\ncontribution.\n\nRun the following command to plot the channel contribution area chart: \n\n media_summary.plot_channel_contribution_area_chart()\n\n**Example output:**\n\nContribution bump chart\n\nThe Contribution Bump Chart illustrates the relative rank of each channel's\ncontribution, including the baseline, based on incremental outcome over time.\nEach line represents a channel, and its vertical position at a given time point\nindicates its rank. Rank 1 signifies the highest contribution. Lines moving up\nshow an improving rank, while lines moving down indicate a declining rank.\nCrossing lines highlight changes in relative performance between channels. Ranks\ncan be displayed weekly or at the end of each quarter.\n\nRun the following command to plot the channel contribution bump chart: \n\n media_summary.plot_channel_contribution_bump_chart()\n\n**Example output:**\n\nContribution waterfall chart\n\nThe Contribution waterfall chart shows users how much each channel contributed\nto the total amount of incremental revenue or KPI. The baseline displays the\namount of revenue or KPI without any media effects.\n\nRun the following command to plot the contribution waterfall chart: \n\n media_summary.plot_contribution_waterfall_chart()\n\n**Example output:**\n\nContribution pie chart\n\nYou can view a pie chart representation of the incremental revenue or KPI\ncontribution coming from all of the channels, which is compared to the baseline\nwithout any media effects.\n\nRun the following command to plot the contribution pie chart: \n\n media_summary.plot_contribution_pie_chart()\n\n**Example output:**\n\nSpend versus contribution\n\nThe spend versus contribution chart compares the spend and incremental revenue\nor KPI split between channels. This visualization shows the percentage of media\nspend used by each channel and the percent each channel contributed to the total\nincremental revenue or KPI. 100% of revenue (or KPI) is the total incremental\nrevenue (or KPI) from media, not including the baseline. Lastly, the green bar\nhighlights the return on investment (ROI) for each channel.\n\nRun the following command to plot the spend versus contribution: \n\n media_summary.plot_spend_vs_contribution()\n\n**Example output:**\n\nROI by channel\n\nComparing the return on investment (ROI) between channels helps you understand\nhow spending on each channel has impacted revenue. ROI is calculated by revenue\nper dollar spent. This is plotted showing the credible interval.\n\n- Run the following command to plot ROI by channel:\n\n media_summary.plot_roi_bar_chart()\n\n **Example output:**\n\n- You can also remove the credible interval (`ci`) or update it to a different\n credible interval.\n\n The following example shows how to remove the credible interval: \n\n media_summary.plot_roi_bar_chart(include_ci=False)\n\n **Example output:**\n\nFor the case where your data contains a non-revenue KPI type with an unknown\nmonetary unit value, you can compare the cost per incremental KPI (CPIK)\ninstead.\n\n- Run the following command to plot CPIK by channel:\n\n media_summary.plot_cpik()\n\nROI versus effectiveness\n\nYou can compare how each channel's return on investment (ROI) is against the\nchannel's effectiveness by plotting ROI versus effectiveness. Effectiveness is\nmeasured by how much incremental revenue is gained per media unit. For this\nplot, the size of each channel maps to the level of spend. The larger the\ncircle, the more that was spent on the channel.\n\n- Run the following command to plot the ROI versus effectiveness:\n\n media_summary.plot_roi_vs_effectiveness()\n\n **Example output:**\n\n- You can also customize the channels they want to compare and also choose to\n plot without the size differences.\n\n Run the following command to disable the size differences: \n\n media_summary.plot_roi_vs_effectiveness(disable_size=True)\n\n **Example output:**\n\nROI versus marginal ROI\n\nYou can compare the return on investment (ROI) to marginal return on investment\n(mROI), where mROI is the return on investment from an additional unit spent.\nThe size of the circle maps to the amount spent on the channel. The larger the\nspend, the larger the circle.\n\n- Run the following command to plot ROI versus mROI:\n\n media_summary.plot_roi_vs_mroi()\n\n **Example output:**\n\n- You can select the specific channels to view and opt to display equally\n sized ROI and mROI axes. You can also disable the size differences.\n\n The following command example selects specific channels and sets the axes as\n equal: \n\n media_summary.plot_roi_vs_mroi(\n selected_channels=[\"Channel1\", \"Channel4\"],\n equal_axes=True\n )\n\n **Example output:**\n\nResponse curves\n\nResponse curves show your current spend level and where you start to see\ndiminishing returns on the spending per channel.\n\nYou can view each channels' response curves shown together in one plot or\nplotted independently. The shaded area of the plot shows the credible intervals\nwhile the point indicates the current spend.\n\n- To view response curves in independent plots:\n\n media_effects = visualizer.MediaEffects(meridian)\n media_effects.plot_response_curves()\n\n **Example output:** (*Click the image to enlarge.*)\n\n- To view the curves together in one plot and hide the credible intervals:\n\n media_effects = visualizer.MediaEffects(meridian)\n media_effects.plot_response_curves(\n plot_separately=False,\n include_ci=False\n )\n\n **Example output:**\n\n- To view response curves only for the top channels based on spend:\n\n media_effects = visualizer.MediaEffects(meridian)\n media_effects.plot_response_curves(\n plot_separately=False,\n num_channels_displayed=1\n )\n\n **Example output:**\n\nAdstock decay\n\nThe Adstock decay visualization shows the decay rate of the media effects, with\nthe monotonically decaying Adstock curves that Meridian uses having the peak\neffect on the first day. This method accounts for the impact an advertisement\nhas on a consumer even after the ad was shown.\n\nIf the posterior is higher than the prior, then the effects of running an ad on\nthat media channel last longer than was assumed.\n\nThe time units displayed are limited to the `max_lag` value, which is set to 8\ntime units in the following example output. Typically this is set to weeks, but\nyou can use days instead.\n\nRun the following command to plot Adstock decay: \n\n media_effects.plot_adstock_decay()\n\n**Example output:** (*Click the image to enlarge.*)\n\nHill saturation curves\n\nThe Hill saturation curves show the diminishing returns of ad impressions on a\nconsumer. The model uses a *C* shape curve to show the reduced effectiveness, or\nsaturation. In the following example, the Y-axis shows the relative\neffectiveness of showing infinite ads. The X-axis shows the impressions per\ncapita, where an impression is any time a customer sees the ad. This combination\nshows how saturated each media channel is.\n\nThis graph also displays the histogram of the data, with how many ads per capita\nwere shown over all of the available time periods and geos of data.\n\nRun the following command to plot Hill saturation curves: \n\n media_effects.plot_hill_curves()\n\n**Example output:** (*Click the image to enlarge.*)"]]