简体   繁体   English

使用For循环在散景上生成散点图(使用Pandas数据框)

[英]Using a For Loop to generate scatter plots on Bokeh (with Pandas dataframe)

I am trying to generate scatter plots using bokeh and saving into a html file. 我正在尝试使用bokeh生成散点图并将其保存到html文件中。 The number of subplots I am making is a non-constant number and I cannot use p1=figure(...) p2=figure(...) in bokeh. 我要制作的子图的数量是一个非常数,因此我无法在bokeh中使用p1 = figure(...)p2 = figure(...)。 I am looking for an equivalent bokeh code for the pyplot code below, 我正在寻找以下pyplot代码的等效bokeh代码,

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()

Basically I want to merge multiple html files (plots) generated using bokeh to one html file where the number of plots changes with entries and is not constant. 基本上,我想将使用bokeh生成的多个html文件(图)合并到一个html文件中,其中图的数量随条目而变化,并且不是恒定的。 Can someone please help? 有人可以帮忙吗?

To collect multiple plots in one HTML file, assemble the plots in a layout and show that at the end: 要在一个HTML文件中收集多个图,请将这些图组合在一个布局中并在最后show

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

    plots.append(p)

show(column(*plots))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM