https://github.com/scinim/nim-plotly
plotly wrapper for nim-lang
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.9%) to scientific vocabulary
Keywords
Repository
plotly wrapper for nim-lang
Basic Info
- Host: GitHub
- Owner: SciNim
- License: mit
- Language: Nim
- Default Branch: master
- Homepage: https://scinim.github.io/nim-plotly/
- Size: 292 KB
Statistics
- Stars: 185
- Watchers: 9
- Forks: 16
- Open Issues: 23
- Releases: 0
Topics
Metadata Files
README.md
nim-plotly: simple plots in nim
This is a functioning plotting library. It supports, line (with fill below), scatter (with errors), bar , histogram, heatmap, candlestick and combinations of those plot types. More standard types can be added on request.
This is not specifically for the javascript nim target (but the javascript target is supported!).
Internally, it serializes typed nim datastructures to JSON that matches what plotly expects.
Examples
See a collection of real-world examples in the wiki
Simple Scatter plot
```Nim import plotly import chroma
var colors = @[Color(r:0.9, g:0.4, b:0.0, a: 1.0), Color(r:0.9, g:0.4, b:0.2, a: 1.0), Color(r:0.2, g:0.9, b:0.2, a: 1.0), Color(r:0.1, g:0.7, b:0.1, a: 1.0), Color(r:0.0, g:0.5, b:0.1, a: 1.0)] var d = Traceint var size = @[16.int] d.marker =Markerint d.xs = @[1, 2, 3, 4, 5] d.ys = @[1, 2, 1, 9, 5] d.text = @["hello", "data-point", "third", "highest", "bold"]
var layout = Layout(title: "testing", width: 1200, height: 400, xaxis: Axis(title:"my x-axis"), yaxis:Axis(title: "y-axis too"), autosize:false) var p = Plotint p.show() ```

The show call opens a browser pointing to a plot like above, but the actual plot will
be interactive.
Scatter with custom colors and sizes

Multiple plot types

Stacked Histogram

Other examples
Note about C & JS targets / interactive plots
The library supports both the C as well as Javascript targets of
Nim. In case of the C target, the data and layout is statically
parsed and inserted into a template Html file, which is stored in
/tmp/x.html. A call to the default browser is made, which loads said
file. The file is deleted thereafter.
This static nature has the implication that it is not possible to
update the data in the plots. However, thanks to Nim's ability to
compile to Javascript, this can still be achieved if needed. When
compiling to the JS target the native plotly functions are
available, including react and restyle, which allow to change the
data and / or layout of a plot defined in a div container. See the
fig8_js_interactive.nim for such an example.
Note about plotly under Windows Subsystem for Linux (WSL)
Starting from version v0.3.0 of plotly, WSL is supported. This
requires the user to define the BROWSER environment variable and
assumes the user wishes to use a normal Windows browser.
When setting the BROWSER variable, make sure to handle the possible
spaces (e.g. if browser installed in Program Files) by either
escaping spaces and parenthesis with a backslash or just putting the
whole path into quotation marks. E.g:
sh
export BROWSER="/mnt/c/Program Files (x86)/MyBrowserCompany/Browser.exe"
to set the variable for the local session.
TODO
- [X] add .show() method to plot which looks for and opens a browser (similar to python webbrowser module)
- [X] support multiple axes (2 y-axes supported).
- [ ] experiment with syntax for multiple plots (https://plot.ly/javascript/subplots/ or use separate divs.)
- [ ] better side-stepping of https://github.com/nim-lang/Nim/issues/7794
- [ ] convert
%procs into macros so I don't have to re-write the same code over and over. - [ ] more of plotly API
- [ ] ergonomics / plotting DSL
- [ ] custom interactivity.
Owner
- Name: SciNim
- Login: SciNim
- Kind: organization
- Repositories: 22
- Profile: https://github.com/SciNim
GitHub Events
Total
- Watch event: 7
Last Year
- Watch event: 7
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 36
- Total pull requests: 49
- Average time to close issues: 4 days
- Average time to close pull requests: 27 days
- Total issue authors: 20
- Total pull request authors: 14
- Average comments per issue: 3.03
- Average comments per pull request: 2.71
- Merged pull requests: 43
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- brentp (8)
- timotheecour (5)
- AngelEzquerra (3)
- cwpearson (2)
- Vindaar (2)
- sdmcallister (2)
- peheje (1)
- Clonkk (1)
- andreaferretti (1)
- mavavilj (1)
- Lecale (1)
- durdn (1)
- facorazza (1)
- bluenote10 (1)
- sheckman16 (1)
Pull Request Authors
- Vindaar (33)
- timotheecour (3)
- ringabout (2)
- cwpearson (2)
- Electrux (1)
- durdn (1)
- Stromberg90 (1)
- krux02 (1)
- danwhitford (1)
- juancarlospaco (1)
- narimiran (1)
- remigijusj (1)
- tmokazaki (1)
- DylanModesitt (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
- Total downloads: unknown
-
Total dependent packages: 0
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 10
proxy.golang.org: github.com/SciNim/nim-plotly
- Documentation: https://pkg.go.dev/github.com/SciNim/nim-plotly#section-documentation
- License: mit
-
Latest release: v0.3.3
published almost 2 years ago
Rankings
proxy.golang.org: github.com/scinim/nim-plotly
- Documentation: https://pkg.go.dev/github.com/scinim/nim-plotly#section-documentation
- License: mit
-
Latest release: v0.3.3
published almost 2 years ago
Rankings
Dependencies
- actions/checkout v2 composite
- alaviss/setup-nim 0.1.1 composite
- crazy-max/ghaction-github-pages v1 composite
- msys2/setup-msys2 v2 composite