All Projects → brentp → Nim Plotly

brentp / Nim Plotly

Licence: mit
plotting library for nim-lang

Programming Languages

nim
578 projects

Projects that are alternatives of or similar to Nim Plotly

Go Chartjs
golang library to make https://chartjs.org/ plots (this is vanilla #golang, not gopherjs)
Stars: ✭ 42 (-65.29%)
Mutual labels:  chart, plotting, plot
Highcharts Chart
Polymer Element wrapper for highcharts library. Seamlessly create various types of charts from one element.
Stars: ✭ 97 (-19.83%)
Mutual labels:  chart, plotting, plot
Uplot
📈 A small, fast chart for time series, lines, areas, ohlc & bars
Stars: ✭ 6,808 (+5526.45%)
Mutual labels:  chart, plotting, plot
Clip
Create charts from the command line
Stars: ✭ 5,111 (+4123.97%)
Mutual labels:  chart, plotting
Chartpy
Easy to use Python API wrapper to plot charts with matplotlib, plotly, bokeh and more
Stars: ✭ 426 (+252.07%)
Mutual labels:  chart, plotting
Plotly
Plotly for Rust
Stars: ✭ 433 (+257.85%)
Mutual labels:  chart, plot
Termplotlib
Plotting on the command line
Stars: ✭ 294 (+142.98%)
Mutual labels:  plotting, plot
Adjusttext
A small library for automatically adjustment of text position in matplotlib plots to minimize overlaps.
Stars: ✭ 731 (+504.13%)
Mutual labels:  plotting, plot
Scottplot
Interactive Plotting Library for .NET
Stars: ✭ 736 (+508.26%)
Mutual labels:  plotting, plot
Highcharts trendline
HighCharts demo of scatter plot, including a trend line
Stars: ✭ 79 (-34.71%)
Mutual labels:  chart, plot
Asciichart
Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
Stars: ✭ 1,107 (+814.88%)
Mutual labels:  chart, plot
Proc
Display and analyze ROC curves in R and S+
Stars: ✭ 85 (-29.75%)
Mutual labels:  plotting, plot
Implot
Immediate Mode Plotting
Stars: ✭ 2,014 (+1564.46%)
Mutual labels:  plotting, plot
Aachartcore Kotlin
📈📊⛰⛰⛰An elegant modern declarative data visualization chart framework for Android . Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types.极其精美而又强大的 Android 数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图等各种类型的多达几十种的信息图图表,完全满足工作所需.
Stars: ✭ 332 (+174.38%)
Mutual labels:  chart, plot
Ttyplot
a realtime plotting utility for terminal/console with data input from stdin
Stars: ✭ 532 (+339.67%)
Mutual labels:  chart, plot
Plotlib
Data plotting library for Rust
Stars: ✭ 308 (+154.55%)
Mutual labels:  chart, plot
asciichart-sharp
C# port of asciichart
Stars: ✭ 27 (-77.69%)
Mutual labels:  chart, plot
sr graph
A simple, one-file, header-only, C++ utility for graphs, curves and histograms.
Stars: ✭ 67 (-44.63%)
Mutual labels:  plot, plotting
Ggthemes
Additional themes, scales, and geoms for ggplot2
Stars: ✭ 1,107 (+814.88%)
Mutual labels:  plotting, plot
Plotters
A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely 🦀 📈🚀
Stars: ✭ 1,287 (+963.64%)
Mutual labels:  plotting, plot

nim-plotly: simple plots in nim

Docs Build Status

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

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 = Trace[int](mode: PlotMode.LinesMarkers, `type`: PlotType.Scatter)
var size = @[16.int]
d.marker =Marker[int](size:size, color: colors)
d.xs = @[1, 2, 3, 4, 5]
d.ys = @[1, 2, 1, 9, 5]
d.text = @["hello", "data-point", "third", "highest", "<b>bold</b>"]

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 = Plot[int](layout:layout, traces: @[d])
p.show()

simple scatter

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

source

sizes and colors

Multiple plot types

source

multiple plot types

Stacked Histogram

source

stacked histogram

Other examples

in 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:

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].