"""Insert 2D and 3D scalarbars
in the rendering scene"""
from vedo import Mesh, dataurl, show

shape = Mesh(dataurl+"lamp.vtk")

ms = []
cmaps = ("jet", "PuOr", "viridis")
for i in range(3):
    s = shape.clone(deep=False).pos(0, i*2.2, 0)
    # colorize mesh
    scals = s.points()[:,2]
    s.cmap(cmaps[i], scals)
    ms.append(s)

# add 2D scalar bar to first mesh
ms[0].addScalarBar(title="my scalarbar\nnumber #0") #2D

# add 3D scalar bars
ms[1].addScalarBar3D(c="k", title="scalarbar #1", sy=3)

sc = ms[2].addScalarBar3D(pos=(1,0,-5),
                          c="k",
                          sy=2.8,                    # change y-size
                          title="A viridis 3D\nscalarbar to play with",
                          titleFont='Quikhand',
                          titleXOffset=-2,           # offset of labels
                          titleSize=1.5)
sc.scalarbar.rotateX(90) # make it vertical

show(ms, __doc__, axes=1, viewup='z').close()


7948639da31b2dff74b753c0ae9bab5b557de4dc
<mask token>

<mask token>
for i in range(3):
    s = shape.clone(deep=False).pos(0, i * 2.2, 0)
    scals = s.points()[:, 2]
    s.cmap(cmaps[i], scals)
    ms.append(s)
ms[0].addScalarBar(title="""my scalarbar
number #0""")
ms[1].addScalarBar3D(c='k', title='scalarbar #1', sy=3)
<mask token>
sc.scalarbar.rotateX(90)
show(ms, __doc__, axes=1, viewup='z').close()

<mask token>
shape = Mesh(dataurl + 'lamp.vtk')
ms = []
cmaps = 'jet', 'PuOr', 'viridis'
for i in range(3):
    s = shape.clone(deep=False).pos(0, i * 2.2, 0)
    scals = s.points()[:, 2]
    s.cmap(cmaps[i], scals)
    ms.append(s)
ms[0].addScalarBar(title="""my scalarbar
number #0""")
ms[1].addScalarBar3D(c='k', title='scalarbar #1', sy=3)
sc = ms[2].addScalarBar3D(pos=(1, 0, -5), c='k', sy=2.8, title=
    """A viridis 3D
scalarbar to play with""", titleFont='Quikhand',
    titleXOffset=-2, titleSize=1.5)
sc.scalarbar.rotateX(90)
show(ms, __doc__, axes=1, viewup='z').close()

<mask token>
from vedo import Mesh, dataurl, show
shape = Mesh(dataurl + 'lamp.vtk')
ms = []
cmaps = 'jet', 'PuOr', 'viridis'
for i in range(3):
    s = shape.clone(deep=False).pos(0, i * 2.2, 0)
    scals = s.points()[:, 2]
    s.cmap(cmaps[i], scals)
    ms.append(s)
ms[0].addScalarBar(title="""my scalarbar
number #0""")
ms[1].addScalarBar3D(c='k', title='scalarbar #1', sy=3)
sc = ms[2].addScalarBar3D(pos=(1, 0, -5), c='k', sy=2.8, title=
    """A viridis 3D
scalarbar to play with""", titleFont='Quikhand',
    titleXOffset=-2, titleSize=1.5)
sc.scalarbar.rotateX(90)
show(ms, __doc__, axes=1, viewup='z').close()

"""Insert 2D and 3D scalarbars
in the rendering scene"""
from vedo import Mesh, dataurl, show

shape = Mesh(dataurl+"lamp.vtk")

ms = []
cmaps = ("jet", "PuOr", "viridis")
for i in range(3):
    s = shape.clone(deep=False).pos(0, i*2.2, 0)
    # colorize mesh
    scals = s.points()[:,2]
    s.cmap(cmaps[i], scals)
    ms.append(s)

# add 2D scalar bar to first mesh
ms[0].addScalarBar(title="my scalarbar\nnumber #0") #2D

# add 3D scalar bars
ms[1].addScalarBar3D(c="k", title="scalarbar #1", sy=3)

sc = ms[2].addScalarBar3D(pos=(1,0,-5),
                          c="k",
                          sy=2.8,                    # change y-size
                          title="A viridis 3D\nscalarbar to play with",
                          titleFont='Quikhand',
                          titleXOffset=-2,           # offset of labels
                          titleSize=1.5)
sc.scalarbar.rotateX(90) # make it vertical

show(ms, __doc__, axes=1, viewup='z').close()

