scala-chart is a wrapper for JFreeChart that provides a more convenient interface for working with JFreeChart than using the Java library directly. It allows you to accomplish everything that JFreeChart does with fewer lines of code and at the same time using idiomatic Scala, a definite feel-good factor. In this section, we will see how to replicate the plots from the previous section using this library. The website for scala-chart is given here:
https://github.com/wookietreiber/scala-chart
Create a build.sbt
file in your project directory like we have done through most of this book. Then, add the following lines to it to pull-in the required dependencies:
libraryDependencies += "com.github.wookietreiber" %% "scala-chart" % "latest.integration" libraryDependencies += "com.itextpdf" % "itextpdf" % "5.5.6" libraryDependencies += "org.jfree" % "jfreesvg" % "3.0"
The last two lines will let you export your plots to the PDF and SVG formats. PDF is...