当前位置: 首页>>代码示例>>Python>>正文


Python PlotFactory.plot_stacked_graph方法代码示例

本文整理汇总了Python中pythalesians.graphics.graphs.plotfactory.PlotFactory.plot_stacked_graph方法的典型用法代码示例。如果您正苦于以下问题:Python PlotFactory.plot_stacked_graph方法的具体用法?Python PlotFactory.plot_stacked_graph怎么用?Python PlotFactory.plot_stacked_graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pythalesians.graphics.graphs.plotfactory.PlotFactory的用法示例。


在下文中一共展示了PlotFactory.plot_stacked_graph方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ticker

# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_stacked_graph [as 别名]
            tickers=tickers,  # ticker (Thalesians)
            fields=["close"],  # which fields to download
            vendor_tickers=vendor_tickers,  # ticker (Bloomberg)
            vendor_fields=["PX_LAST"],  # which Bloomberg fields to download
            cache_algo="internet_load_return",
        )  # how to return data

        daily_vals = ltsf.harvest_time_series(time_series_request)

        # resample for year end
        daily_vals = daily_vals.resample("A")

        daily_vals = daily_vals / daily_vals.shift(1) - 1
        daily_vals.index = daily_vals.index.year
        daily_vals = daily_vals.drop(daily_vals.head(1).index)

        pf = PlotFactory()

        gp = GraphProperties()

        gp.source = "Thalesians/BBG"
        gp.title = "Yearly changes in spot"
        gp.scale_factor = 3
        gp.y_title = "Percent Change"

        daily_vals = daily_vals * 100

        # plot using PyThalesians (stacked & then bar graph)
        pf.plot_stacked_graph(daily_vals, adapter="pythalesians", gp=gp)
        pf.plot_bar_graph(daily_vals, adapter="pythalesians", gp=gp)
开发者ID:swaraj007,项目名称:pythalesians,代码行数:32,代码来源:plotfactory_examples.py


注:本文中的pythalesians.graphics.graphs.plotfactory.PlotFactory.plot_stacked_graph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。