Search code examples
python3dbokehsurfaceholoviews

3d surface plot with holoviews and "bokeh"


as I use the holoviews library in conjunction with the bokeh backend, I would like to create a 3D surface plot, too. In the documentation I only found matplotlib and plotly backends. Can somebody share a code snippet how to use holoviews/bokeh for 3D surface plots?

Thank you


Solution

  • solved the issue using plotly. had to use graph_objects to render html output as I work in spyder

    import model as md
    import numpy as np
    
    import plotly.graph_objects as go
    import plotly.io as pio
    #pio.renderers.default = 'svg'
    pio.renderers.default = 'browser'
    
    TaRng  = np.arange(0,15,0.2)       # 75 values
    TwSRng = np.arange(12,15,0.2)      # 15 values
    mode   = 0.2
    Tw     = [md.Tw(ta,tws,mode) for ta in TaRng for tws in TwSRng]  
    Tw     = np.array(Tw).reshape(75,15)
    
    fig = go.Figure(data=[go.Surface(z=Tw)])
    
    fig.update_layout(title='free cooling', autosize=False,
                  width=500, height=500,
                  margin=dict(l=65, r=50, b=65, t=90))
    
    fig.show()