Makie don't use full color range in volume plots. (What am I doing wrong ?)

Hi. I plot at 3D array using:

f=volume(vol; colormap=:redsblues, colorrange=(-2.0,2.0), lowclip=:red, highclip=:blue)

But the plot doesn’t contain red. What is worng ?

1 Like

Ugh, we still haven’t implemented that and since we dont error right now, this just doesn’t use lowclip/highclip.
Guess you have to do this for now:

cmap = to_colormap(:redsblues)
cmap[1] = to_color(:red)
cmap[end] = to_color(:blue)
f=volume(vol; colormap=cmap, colorrange=(-2.0,2.0))
1 Like

I still don’t get any red.

It just looks like it completely ignores negative values.

Can you open an issue with an MWE?

Sure, for now. I did.

min, max = extrema(vol)
volume(nvol; colorrange=(0.1,1.2), colormap=cmap)

The red color is back, but its absorption is low.
What I think is happening is that the absorption is scaled with the value of the data and when the value is negative it becomes negative or zero, and you can see the red color. Scaling absorption with the abs() of the data would be better.

I am working on an example that shows the problem. But the best way to see the problem with intensity, is if you view it from an eye position that goes along with z=0. What is the easiest way to move the eye position ??

using GLMakie

xs, ys, zs = [-10:0.1:10 for d in range(1,3)]

vol = [z/sqrt(x^2+y^2+z^2+0.0001) for x in xs, y in xs, z in zs]


f=volume(xs,ys,zs,vol; colormap=:redsblues, colorrange=(min,max))



g=volume(xs,ys,zs,vol; colormap=:redsblues, colorrange=(0,max-min))


Adding algorithm=:absorption solves the problem.