Skip to content
/ Deplot Public

Simple and complete plot gui module for Deno local scripts to provide a helper for science computing.

Notifications You must be signed in to change notification settings

JOTSR/Deplot

Repository files navigation


Deplot

Simple and complete Plot gui module for Deno local scripts to provide a helper for science computing.

deno module deno compatibility vr scripts deno doc

Dependencies

Use WebUI for window managing and plots libraries for tracing.

Supports Plotly.js and Chart.js for plotting.

Usage

All the modules are exposed in mod.ts

import { Datas, Deplot, Plotly } from 'https://deno.land/x/deplot/mod.ts'

const barPlot = new Deplot(
	'Plotly',
	{
		title: 'My bar plot',
		size: { width: 800, height: 600 },
	},
)

const trace: Plotly.Data = {
	x: ['Zebras', 'Lions', 'Pelicans'],
	y: [90, 40, 60],
	type: 'bar',
	name: 'New York Zoo',
}

const layout: Partial<Plotly.Layout> = {
	title: 'Hide the Modebar',
	showlegend: true,
}

const datas: Datas = { data: [trace], layout, config: { editable: true } }

await barPlot.plot(datas)

const trace2: Plotly.Data = {
	x: [1, 2, 3, 4, 5],
	y: [4, 0, 4, 6, 8],
	mode: 'lines+markers',
	type: 'scatter',
}

const datas2 = { data: [trace2], layout }

new Deplot('Plotly').plot(datas)

Documentation

Examples

Plotly.js

deno run --allow-read --allow-write --allow-env --allow-ffi --unstable https://deno.land/x/deplot/examples/plotly.ts

Chart.js

deno run --allow-read --allow-write --allow-env --allow-ffi --unstable https://deno.land/x/deplot/examples/chartjs.ts

For flags see Deno WebUI/Security flags