Picta
A graphing library for the Scala Programming language
Picta is a graphing library for the Scala. It has an easy to use API that is close to natural language, making it easy to visualize different types of data.
Picta comes with many different plot types, adding extensive charting functionality to the Scala ecosystem.
Plots are composed from smaller, simpler components, and combined together to create plots of varying complexity.
The library is written in Scala, and cross-compiles to versions 2.12 and 2.13.
Picta is also able to run inside a Jupyter Notebook, thanks to it's integration with the Almond kernel.
All plots created by Picta are valid HTML. More information about the library can be found at the Documentation site.
Contents
Running The Unit Testing Framework
Repository Structure
The following are the main folders and files for the project. Files or folders not listed here are simply used for compilation, and can be ignored.
1. /src/
This folder contains all the main code for the library, and consists of of two further directories:
/src/main/
This folder contains all the code that implements Picta. In this folder you will find the case classes that represent each plot component.
All code associated with actually rendering plots on screen can be found in the /render/
folder.
The /conus/
folder contains code for all the Picta helper functions that help a user visualize forward-models.
The remaining folders implement various functionality useful to the library.
/src/test/
This folder contains the unit tests for the library. Generally each class corresponds to a test suite that tests a specific part of the library.
To see how to set up the unit testing framework, please see Running The Unit Testing Framework below.
/src/test/resources
This folder contains the Javascript files that are used to run the Node.js specific unit testing code.
node_modules
contains all the dependencies downloaded by theNPM
package manager to run the Node.js specific unit testing code.
2. /Documentation/
This folder simply contains a README.md file that contains details on where to find the in depth documentation.
3. /build.sbt
This file tells SBT
how to build and compile the project. The file also contains all the dependencies this project will automatically pull in when
it is being compiled and built.
4. /COPYING.md
This contains a copy of the GNU general public license, version 3.
5. /license.md
This contains information on how the project is licensed. It goes hand in hand with the COPYING.md
listed file above.
6. /Picta-Examples-Notebook.ipynb
This is a Jupyter notebook that contains many different examples of charts that are created using the Picta library.
7. /rootdoc.txt
This file is used to create the start page for the API documentation, which can be found hosted at Picta API.
8. Other Files
Picta was written from scratch, except for the following files:
src/main/resources/macy.min.js
src/main/resources/merge-image.js
src/main/resources/plotly.min.js
src/main/resources/require.min.js
These files simply contain code from open source libraries used in the creation of Picta.
Maven Repository
This library is hosted on Maven for an easy installation on your machine.
You can find the Maven repository: https://mvnrepository.com/artifact/org.carbonateresearch/picta
Requirements
To use this project, you need to have installed Scala version 2.12.12 or greater. You will also need the appropriate version of the JDK. You can use the openjdk.
Running The Unit Testing Framework
If you wish to run the unit tests, you will also need to install Node.js.
If you have NPM installed, you can simply navigate to /src/test/resources/javascript/
and run the following command:
npm install
This should install all the necessary dependencies to get the unit-testing framework working.
To run the tests, simply open an SBT shell and use the following command:
+ test
This will run the unit tests, which should all pass.
You can find more information on how to contribute using the unit-testing framework in the main documentation here.
Installation
SBT
If you are using SBT, add the following to your build.sbt file:
resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies ++= Seq(
// Last release
"org.carbonateresearch" %% "picta" % "0.1.1"
)
Almond Jupyter Notebook
To use inside an Almond Jupyter Notebook, add the following to the top of the notebook:
interp.repositories() ++= Seq(coursierapi.MavenRepository.of(
"https://jitpack.io"
))
import $ivy. `org.carbonateresearch::picta:0.1.1`
Documentation
Main Documentation Site
The documentation site for the project can be found here:
The documentation site contains extensive examples on how to use the Picta library.
The documentation is built with Jekyll, using the theme by Tom Johnson here.
API Documentation
In addition to the documentation site above, there is also an API documentation site, built with Scaladoc here:
The API docs contain detailed information about the source code, such as function signatures and types of the various elements in the library.
A Long List of Examples
You can find an extensive list of plot examples here.
Credit
The Picta logo was created by design_league.