A MoonBit plotting library with SVG output.

moon add Lampese/mathplotlib@0.2.1git clone https://github.com/moonbit-community/moonplot.git
cd moonplot
moon run cmd/preview --target native > chart.svg
moon build rabbita/cmd/demo --target js
python3 -m http.server 8765 --bind 127.0.0.1///|
import {
"Lampese/mathplotlib",
}///|
fn main raise {
let fig = @mathplotlib.figure(width=640, height=400)
fig.set_title("A MoonPlot chart")
fig.set_x_label("Sample")
fig.set_y_label("Value")
fig.set_x_limits(0.0, 4.0)
fig.set_y_limits(0.0, 20.0)
fig.set_x_ticks([0.0, 1.0, 2.0, 3.0, 4.0])
fig.set_y_ticks([0.0, 5.0, 10.0, 15.0, 20.0])
fig.set_x_tick_labels(["0", "1", "2", "3", "4"])
fig.set_y_tick_labels(["0", "5", "10", "15", "20"])
fig.plot(
[0.0, 1.0, 2.0, 3.0, 4.0],
[3.0, 7.0, 5.0, 13.0, 17.0],
color="#2563eb",
label="Measurements",
)
fig.legend(fig.legend_entries())
println(fig.to_svg_checked())
}moon run cmd/gallery --target native > gallery.svg
///|
import {
"Lampese/mathplotlib",
"Lampese/mathplotlib/rabbita" @plot_dom,
"moonbit-community/rabbita",
}
python3 tools/check_structure.py
moon check --target all
moon test --target all
moon info
moon fmtfn gridspec(rows : Int, columns : Int, hspace? : Double, vspace? : Double, width_ratios? : Array[Double], height_ratios? : Array[Double]) -> GridSpec raise LayoutErrorfn style(color : String, width? : Double, radius? : Double, fill? : String, font_size? : Double, marker? : String, line_alpha? : Double?, line_stroke? : LineStroke, line_gapcolor? : String?) -> Style