Plot marker colors to match the data values

Hi, I’m still new to Julia and I have a seemingly simple task that I haven’t been able to figure out:

  1. Display a group of RGB pixels as a 3D plot with r, g, b components as values on x, y, z axes (I’ve done that).
  2. Select the marker colors to match the RGB pixel values (I’m struggling with this).

My code looks like this:

using Images
using Plots

# image as a 3D Array of size (num_channels, height, width)
plot_img = channelview(load("/some/image.png"))

plotly()
gui(
    scatter(
        plot_img[1, :, :],
        plot_img[2, :, :],
        plot_img[3, :, :];
        markersize=0.5,
        markerstrokewidth=0,
        markeralpha=0.5,
        legend=false,
        size=(1000, 1000),
    )
)

I’m using Plotly to render the 3D plot as interactive in the browser.

I found the marker_z option I can use when calling scatter which should look like f(x, y, z) -> z_val. However, rather than being a RGB color, the z_val seems to be a pointer to a palette/gradient. So I think I would need to:
a) generate a function that maps a RGB pixel value to a 1D value
b) generate a gradient that converts back the 1D value into the original RGB value

So yeah, I’m not really sure how to do that, or is there some more straightforward solution?

Thanks!