我正在尝试实现这个问题的答案:https://stackoverflow.com/questions/3704647/can-you-recommend-a-charting-library-for-scala/3704974#3704974
我已经从git hub下载并编译了Scalala,并将scalala_2.8.1-1.0.0.RC2-SNAPSHOT.jar放在我的lib文件夹中(我正在使用SBT进行构建)。代码如下:
import scalala.library.Plotting
object ScalalaTest extends Application
{
val x = Plotting.linspace(0,1);
}我得到以下错误:
[error] /src/main/scala/ScalalaTest.scala:6: value linspace is not a member of object scalala.library.Plotting
[error] val x = Plotting.linspace(0,1);
[error] ^
[error] one error found看起来我的scala编译器可以识别scalala包,但是不能识别Plotting的成员(除了linspace之外,我还尝试过其他的)。这很奇怪,因为根据the Scalala API的说法,linspace是Plotting的成员。
发布于 2011-05-22 06:25:51
这曾经很好用,很优雅--看起来current way是这样的:
val x = DenseVector.range(0,100) / 100.0;
plot.hold = true
plot(x, x :^ 2)
plot(x, x :^ 3, '.')
xlabel("x axis")
ylabel("y axis")
saveas("lines.png")这些需求包括:
import scalala.tensor.dense.DenseVector
import scalala.library.Plotting._SBT依赖项包括:
val scalaToolsSnapshots = "Scala Tools Snapshots" at "http://scala-tools.org/repo-snapshots/"
val ScalaNLPMaven2 = "ScalaNLP Maven2" at "http://repo.scalanlp.org/repo/"
val ondex = "ondex" at "http://ondex.rothamsted.bbsrc.ac.uk/nexus/content/groups/public/"
val scalala = "org.scalala" %% "scalala" % "1.0.0.RC2-SNAPSHOT"发布于 2011-05-21 13:58:54
linspace似乎是特征Plotting的成员,而不是伴生对象的成员。因此,您必须创建Plotting (或任何with Plotting)的实例才能访问该方法。
https://stackoverflow.com/questions/6079815
复制相似问题