{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ ":dep plotly = { version = \">=0.6.0\" }\n", ":dep itertools-num = \"0.1.3\"" ] }, { "cell_type": "code", "execution_count": 3, "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": 6, "metadata": { "scrolled": true }, "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": 9, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "
\n", " \n", "
" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "let n: usize = 100;\n", "let t = vec![1,2,3,4,5,6,7,8,9,10];\n", "let y = t.iter().map(|v| (*v as f64).powf(2.0)).collect::>();\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(525);\n", "plot.set_layout(layout);\n", "plot.notebook_display();" ] } ], "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 }