{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ ":dep plotly = { version = \">=0.6.0\" }\n", ":dep itertools-num = \"0.1.3\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "extern crate plotly;\n", "extern crate rand_distr;\n", "extern crate itertools_num;\n", "extern crate itertools;" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "use itertools_num::linspace;\n", "use plotly::common::{\n", " ColorScale, ColorScalePalette, DashType, Fill, Font, Line, LineShape, Marker, Mode, Title,\n", "};\n", "use plotly::layout::{Axis, BarMode, Layout, Legend, TicksDirection};\n", "use plotly::{Bar, NamedColor, Plot, Rgb, Rgba, Scatter};\n", "use rand_distr::{Distribution, Normal, Uniform};" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fn simple_scatter_plot(show: bool) {\n", " let n: usize = 100;\n", " let t: Vec = linspace(0., 10., n).collect();\n", " let y: Vec = t.iter().map(|x| x.sin()).collect();\n", "\n", " let trace = Scatter::new(t, y).mode(Mode::Markers);\n", " let mut plot = Plot::new();\n", " plot.add_trace(trace);\n", " let layout = Layout::new().height(800);\n", " plot.set_layout(layout);\n", " plot.lab_display();\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "simple_scatter_plot(true)" ] } ], "metadata": { "kernelspec": { "display_name": "Rust", "language": "rust", "name": "rust" }, "language_info": { "codemirror_mode": "rust", "file_extension": ".rs", "mimetype": "text/rust", "name": "Rust", "pygment_lexer": "rust", "version": "" } }, "nbformat": 4, "nbformat_minor": 4 }