【问题标题】:Using a For Loop to generate scatter plots on Bokeh (with Pandas dataframe)使用 For 循环在 Bokeh 上生成散点图(使用 Pandas 数据框)
【发布时间】:2019-04-24 16:54:45
【问题描述】:

我正在尝试使用散景生成散点图并保存到 html 文件中。我正在制作的子图数量是一个非常数,我不能在散景中使用 p1=figure(...) p2=figure(...) 。我正在为下面的 pyplot 代码寻找等效的散景代码,

for i,j in df.groupby("IO"):        
    j.plot(kind='scatter',x='row_mod256',y='BitsAffected',edgecolors='r',s=5)
    plt.title(i)

plt.show()

基本上,我想将使用散景生成的多个 html 文件(绘图)合并到一个 html 文件中,其中绘图的数量随条目而变化,并且不是恒定的。有人可以帮忙吗?

【问题讨论】:

    标签: python pandas matplotlib bokeh rbokeh


    【解决方案1】:

    要在一个 HTML 文件中收集多个图,请将图 in a layoutshow 组合到最后:

    plots = []
    for i,j in df.groupby("IO"):    
        p = figure(...)
        p.circle(...)
    
        plots.append(p)
    
    show(column(*plots))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-14
      • 1970-01-01
      • 2018-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-25
      • 1970-01-01
      相关资源
      最近更新 更多