0

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

Oliver Prislan
  • 320
  • 4
  • 12
  • 1
    Bokeh doesn't have 3D directly, as @bigreddot indicates, but for 3D surface plots, you can use HoloViews+matplotlib or HoloViews+Plotly, or just use Plotly directly as you have below. If you normally use HoloViews with the Bokeh backend, you can use Panel to lay out any combination of the above types of plots into a single layout, so that you can mix and match whatever is supported by the various libraries to make your overall figure. – James A. Bednar Sep 11 '20 at 19:33

2 Answers2

0

Bokeh is a 2d plotting library, there is no built-in support for 3d plots. It's possible to wrap third-party 3d JS plotting tools as Bokeh custom extensions, but AFAIK Holoviews has not done this.

bigreddot
  • 33,642
  • 5
  • 69
  • 122
0

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()
Oliver Prislan
  • 320
  • 4
  • 12