Giter Club home page Giter Club logo

nspl's Introduction

documentation

2d Plotting Library for Scala and Scala.js

Creates scatter, line, contour, raster, barplots and boxplots, histograms, density plots. Composite figure of multiple plots.

Renders to

Usage

See the documentation website at https://pityka.github.io/nspl/ .

This library is built for Scala 2.13 and Scala 3.2.

Maven coordinates:

  • For jvm: libraryDependencies += "io.github.pityka" %% "nspl-awt" % "0.0.???"
  • For canvas (Scala.js): libraryDependencies += "io.github.pityka" %% "nspl-canvas-js" % "0.0.???"

Version policy

nspl uses the recommended versioning scheme enforced with https://github.com/scalacenter/sbt-version-policy.

How to build the website

The website is built with hugo and the hugo-book theme.

The theme is a git submodule. It must be initialized.

git submodule update --init 

Create and serve the site with:

sbt docs/mdoc docs/unidoc && cd website && hugo

nspl's People

Contributors

pityka avatar scala-steward avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nspl's Issues

How to render plot o file?

I have looked at the examples in the file:

https://github.com/pityka/nspl/blob/master/saddle/src/test/scala/plots/plots.test.scala

But cannot get rendering to a file to work. I have the following code:

    import org.nspl.xyplot
    import org.nspl.scalatagrenderer
    import org.nspl.ColumnLayout

    import org.nspl.awtrenderer._
    import org.nspl.group


    val x : Seq[Double] = Seq(1d,2d,3d)
    val y : Seq[Double] = Seq(6d,7d,10d)
    val plot = xyplot(x -> y)(
      ylab = "y",
      xlab = "x",
      main = "main"
    )
    show(plot)

    val gallery: Build[_root_.org.nspl.Elems1[_root_.org.nspl.Elems2[_root_.org.nspl.XYPlotArea, _root_.org.nspl.Legend]]] = group(
      plot,
      ColumnLayout(3)
    )
    show(gallery)

    import org.nspl.awtrenderer.renderToFile

    renderToFile(gallery, 1000, "image/svg")

    renderToFile(plot, 1000, "image/svg")

The show call. The last two calls fail with:

[error] UFSpec.scala:1893: inferred type arguments [org.nspl.Build[org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.Legend]]]] do not conform to method renderToFile's type parameter bounds [K <: org.nspl.Renderable[K]]
[error]     renderToFile(gallery, 1000, "image/svg")
[error]     ^
[error] UFSpec.scala:1893: type mismatch;
[error]  found   : org.nspl.Build[org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.Legend]]]
[error]     (which expands to)  ((Option[org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.ElemList[org.nspl.Elems2[org.nspl.ShapeElem,org.nspl.TextBox]]]]], org.nspl.Event)) => org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.ElemList[org.nspl.Elems2[org.nspl.ShapeElem,org.nspl.TextBox]]]]
[error]  required: K
[error]     renderToFile(gallery, 1000, "image/svg")
[error]                  ^
[error] UFSpec.scala:1896: inferred type arguments [org.nspl.Build[org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.Legend]]]] do not conform to method pngToFile's type parameter bounds [K <: org.nspl.Renderable[K]]
[error]     pngToFile(gallery)
[error]     ^

Here is my SBT build file

lazy val root = (project in file(".")).
  settings(
    inThisBuild(List(
      organization := "com.example",
      scalaVersion := "2.12.4",
      version      := "0.1.0-SNAPSHOT"
    )),
    name := "UFD",
    libraryDependencies ++= Seq(
      "com.github.pathikrit" %% "better-files" % "3.2.0",
      "io.github.pityka" %% "nspl-awt" % "0.0.19",
      "io.github.pityka" %% "nspl-scalatags-jvm" % "0.0.19",
      "org.scalatest" %% "scalatest" % "3.0.4" % "test")
)

Can anyone tell me what I am doing wrong?
BTW, is their a support forum or mailing list for nspl?

TIA

Parameters

Hey,

Any reason trait SimplePlots's class Parameters() is not a simple case class Params() ?

It seems you would benefit from the case class copy function, and Parameters does not need to be called by reference (at least I couldn't find where it would).

Not really an issue, just curious of this factory pattern.

Thanks in advance for your answer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.