JuliaGraphics/ColorSchemes.jl

Ct scan greys

jakubMitura14 opened this issue · 2 comments

Hello I am trying to create colorscheme that I want to use in the heatmap of makie for now I use greys and It works quite well but

I would like to implement windows
so pixels below given value a should be black
all above given value b should be white
different shades of grey for all values between a and b and proportional to those values

How to achieve this?

Thank you for help!

Below What Is already achieved but without windows

image

Hi Jakub! Assuming you can pass in normalised values from 0 to 1 in Makie, you can do this with ColorSchemeTools.jl:

using ColorSchemes, ColorSchemeTools

function f(n, a, b)
    if n < a
        return 0
    elseif n > b
        return 1
    else
        return ColorSchemes.remap(n, a, b, 0, 1)
    end
end

a = 0.3
b = 0.8

newscheme = make_colorscheme(n -> f(n, a, b), n -> f(n, a, b), n -> f(n, a, b), 
    length=100,
    category = " ... ",
    notes    = " ... ")

Screenshot 2021-05-29 at 09 27 45

Thanks !