import panel as pn pn.extension('plotly') import numpy as np import plotly.graph_objs as go xx = np.linspace(-3.5, 3.5, 100) yy = np.linspace(-3.5, 3.5, 100) x, y = np.meshgrid(xx, yy) z = np.exp(-(x-1)**2-y**2)-(x**3+y**4-x/5)*np.exp(-(x**2+y**2)) surface = go.Surface(z=z) layout = go.Layout( title='Plotly 3D Plot', autosize=False, width=500, height=500, margin=dict(t=50, b=50, r=50, l=50) ) fig = dict(data=[surface], layout=layout) plotly_pane = pn.pane.Plotly(fig) plotly_pane surface.z = np.sin(z+1) plotly_pane.object = fig fig['layout']['width'] = 800 plotly_pane.object = fig from plotly import subplots heatmap = go.Heatmap( z=[[1, 20, 30], [20, 1, 60], [30, 60, 1]], showscale=False) y0 = np.random.randn(50) y1 = np.random.randn(50)+1 box_1 = go.Box(y=y0) box_2 = go.Box(y=y1) data = [heatmap, box_1, box_2] fig = subplots.make_subplots( rows=2, cols=2, specs=[[{}, {}], [{'colspan': 2}, None]], subplot_titles=('First Subplot','Second Subplot', 'Third Subplot') ) fig.append_trace(box_1, 1, 1) fig.append_trace(box_2, 1, 2) fig.append_trace(heatmap, 2, 1) fig['layout'].update(height=600, width=600, title='i <3 subplots') fig = fig.to_dict() subplot_panel = pn.pane.Plotly(fig) subplot_panel fig['layout']['title']['text'] = 'i <3 updating subplots' subplot_panel.object = fig import pandas as pd import plotly.express as px data = pd.DataFrame([ ('Monday', 7), ('Tuesday', 4), ('Wednesday', 9), ('Thursday', 4), ('Friday', 4), ('Saturday', 4), ('Sunday', 4)], columns=['Day', 'Orders'] ) fig = px.line(data, x="Day", y="Orders") fig.update_traces(mode="lines+markers", marker=dict(size=10), line=dict(width=4)) fig.layout.autosize = True responsive = pn.pane.Plotly(fig) pn.Column('# A responsive plot', responsive, sizing_mode='stretch_width') pn.Row(responsive.controls(jslink=True), responsive)