20 KiB
20 KiB
In [2]:
%use plotly
In [4]:
Plotly.jupyter.notebook()
Line_4.jupyter-kts (1:8 - 15) Unresolved reference: jupyter
In [7]:
val x1 = (0..100).map { it.toDouble() / 100.0 } val y1 = x1.map { sin(2.0 * PI * it) } val y2 = x1.map { cos(2.0 * PI * it) } val trace1 = Trace(x1, y1) { name = "sin" } val trace2 = Trace(x1, y2) { name = "cos" } val fragment = Plotly.fragment { val plotConfig = PlotlyConfig{ responsive = true set("toImageButtonOptions.format", "svg") } plot(config = plotConfig) { traces(trace1, trace2) layout { title = "The plot above" xaxis.title = "x axis name" yaxis.title = "y axis name" } } hr() h1 { +"A custom separator" } hr() div { plot{ traces(trace1, trace2) layout { width = 450 title = "The plot below" xaxis.title = "x axis name" yaxis.title = "y axis name" } } } } fragment.toPage()
Out[7]:
In [8]:
Plotly.plot { traces(trace1, trace2) layout { title = "The plot below" xaxis.title = "x axis name" yaxis.title = "y axis name" } }.toPage()
Out[8]:
In [ ]: