marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
2.03k stars 264 forks source link

How can I show the color bar using a logarithm method ? #531

Closed liuzg-23 closed 2 years ago

liuzg-23 commented 2 years ago

Hello, this is my code, can you tell me that how can I show the color bar using a logarithm method ? Thanks very much.

tet = TetMesh('initial.vtk')
msh=tet.slice(origin=(0,0,0),normal=(0,0,1))
msh.cmap("coolwarm", 'material', on='cells')
msh.addScalarBar3D(
    title='\beta_n',
    titleSize=1.5,
    sx=1000,
    sy=100000,
    titleXOffset=3,
)
axes_opt = dict(
    xtitle='Easting (m)',
    ytitle='Northing (m)',
    ztitle='',
    # xValuesAndLabels=xlabels,
    xTitlePosition=0.65,
    xLabelSize=0.018,
    yTitlePosition=0.65,
    yLabelRotation=90,
    yLabelSize=0.018,
    axesLineWidth=4,
    xrange=msh.xbounds(),
    yrange=msh.ybounds(),
)
size = [3940, 2160]
show(msh,axes=axes_opt, size=size, interactive=True, zoom=1.2)
marcomusy commented 2 years ago

sorry - that is not implemented, what you can do is to add an array and colorize that:

tet = TetMesh('initial.vtk')
msh=tet.slice(origin=(0,0,0),normal=(0,0,1))
logmat = np.log(msh.celldata['material'])

msh.cmap("coolwarm", logmat, on='cells')
msh.addScalarBar3D(
    title='log(\beta_n )',
)
liuzg-23 commented 2 years ago

Ok, I got it, thanks very much and best regards.