{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2021-01-14T18:47+0300", "start_time": "2021-01-14T18:47+0300" } }, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%use @file[plotly-experimental.json]\n", "import kotlin.math.*" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2021-01-14T18:47+0300", "start_time": "2021-01-14T18:47+0300" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
\n", " \n", "
\n", "
\n", "

A custom separator

\n", "
\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val x1 = (0..100).map { it.toDouble() / 100.0 }\n", "val y1 = x1.map { sin(2.0 * PI * it) }\n", "val y2 = x1.map { cos(2.0 * PI * it) }\n", "\n", "val trace1 = Trace(x1, y1) { name = \"sin\" }\n", "val trace2 = Trace(x1, y2) { name = \"cos\" }\n", "\n", "val fragment = Plotly.fragment { renderer ->\n", " plot(\"above\", renderer = renderer) {\n", " traces(trace1, trace2)\n", " layout {\n", " title = \"The plot above\"\n", " xaxis.title = \"x axis name\"\n", " yaxis.title = \"y axis name\"\n", " }\n", " }\n", " hr()\n", " h1 { +\"A custom separator\" }\n", " hr()\n", " div {\n", " plot(renderer = renderer) {\n", " traces(trace1, trace2)\n", " layout {\n", " title = \"The plot below\"\n", " xaxis.title = \"x axis name\"\n", " yaxis.title = \"y axis name\"\n", " }\n", " }\n", " }\n", "}\n", "fragment" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2021-01-14T18:47+0300", "start_time": "2021-01-14T18:47+0300" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
\n", " \n", "
\n", "
\n" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Plotly.plot {\n", " traces(trace1, trace2)\n", " layout {\n", " title = \"The plot below\"\n", " xaxis.title = \"x axis name\"\n", " yaxis.title = \"y axis name\"\n", " }\n", "}" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2021-01-14T18:48+0300", "start_time": "2021-01-14T18:48+0300" } }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "HTML(\"\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2021-01-14T18:47+0300", "start_time": "2021-01-14T18:47+0300" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
\n", " \n", "
\n", "
\n" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Plotly.plot {\n", " traces(trace1, trace2)\n", " layout {\n", " title = \"The plot below\"\n", " xaxis.title = \"x axis name\"\n", " yaxis.title = \"y axis name\"\n", " }\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "@webio": { "lastCommId": null, "lastKernelId": null }, "hide_input": false, "kernelspec": { "display_name": "Kotlin", "language": "kotlin", "name": "kotlin" }, "language_info": { "codemirror_mode": "text/x-kotlin", "file_extension": ".kt", "mimetype": "text/x-kotlin", "name": "kotlin", "nbconvert_exporter": "", "pygments_lexer": "kotlin", "version": "1.5.0-dev-1206" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": false, "sideBar": false, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": false, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }