visionforge/plotly/examples/notebooks/.ipynb_checkpoints/plotlykt-demo-checkpoint.ipynb

100 lines
2.2 KiB
Plaintext
Raw Normal View History

2024-06-04 22:47:56 +03:00
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ExecuteTime": {
"start_time": "2021-04-29T19:06:33.505Z"
}
},
"outputs": [],
"source": [
"%use plotly"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ExecuteTime": {
"start_time": "2021-04-29T19:05:34.298Z"
},
"tags": []
},
"outputs": [],
"source": [
"import kotlin.math.*\n",
"\n",
"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",
"Plotly.page { renderer ->\n",
" val plotConfig = PlotlyConfig{\n",
" responsive = true\n",
" imageFormat = \"svg\"\n",
" } \n",
" h1 { +\"A custom separator\" }\n",
" hr()\n",
" plot(\"below\", 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",
"}"
]
},
{
"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.30-dev-598"
},
"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
}