在scala中使用plotly和zeppellin

ano*_*y29 5 scala histogram plotly apache-zeppelin

我想在 Zeppelin 中以直方图的形式显示我的结果。我遇到了阴谋。我的代码是用scala编写的,我想知道使用scala将plotly合并到zeppelin中的步骤。或者有没有更好的方法(库)可以用来在Zeppelin(Scala)中绘制直方图?

Cha*_*ley 5

如果您有一个名为plotTemp 的数据框,其中包含“id”、“ Degree”列,那么您可以执行以下操作:

  1. 在 scala 窗口中将数据帧注册为临时表

plotTemp.registerTempTable("plotTemp")

  1. 然后在新窗口中切换到SQL解释器

    %sql
    select degree, count(1) nInBin
    from plotTemp
    group by degree
    order by degree
    
    Run Code Online (Sandbox Code Playgroud)

然后,您可以单击条形图图标,您应该会看到您要查找的内容

Zeppelin 中绘制的分布图示例