-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clim kwarg in expressionPalette or expressionColors #14
Comments
maybe with using the |
palette = cgrad(:viridis)
scale(x::Number,y::StepRangeLen) = ( x - minimum(y) )/( maximum(y) - minimum(y) )
color = map( x->palette[scale(x,channelRange)], fcsdata[!,channel] ) |
Yes, this would help a lot. The scaling is now (partially) done by See https://github.com/LCSB-BioCore/GigaScatter.jl/blob/master/src/colors.jl#L114 for scaleMinMax. I didn't know about cgrad, I guess I can replace a bit of the code with that, e.g. this https://github.com/LCSB-BioCore/GigaScatter.jl/blob/master/src/colors.jl#L28 . |
I realised that calling channelRange, nlevels = range(-2,7,length=50), 10
palette = cgrad(:viridis,nlevels,categorical=true)
channels = names(fcsdata)
channel = Observable(first(channels))
function toIndex(x::AbstractVector{<:Number})
min,max = extrema(channelRange)
scaled = ( x .- min ) / ( max - min )
@. scaled[scaled<0] = 0
@. scaled[1<scaled] = 1
return @. trunc(Int,nlevels*scaled) + 1
end
colorIndex = combine(fcsdata,[ col => toIndex => col for col ∈ names(fcsdata) ] )
color = Observable(palette[ colorIndex[!,channel[]] ])
############################# update on channel change
on(channel) do channel
color[] = palette[ colorIndex[!,channel] ]
end here |
the slowness is quite likely because the float version is doing the interpolation with all colors; I guess I can do the same with our ColorPalette. I'll likely get to it tomorrow. |
I would like to more precisely control the dynamic range of the expressionPalette. For example my expressions range from -2 to 7, but the interesting region lies from -1 to 1. I want to adjust my colour range so any expression values outside of the limits [-1,1] are clipped to the boundary colours.
It is possible to to this by pre-processing the input data, which would re-calculate the inputs each time I change the colour range which doesn't seem to be necessary. It makes more sense to have to colour representation change, not the underlying data.
As you can imagine, this will eventually be used in an interactive figure :)
The text was updated successfully, but these errors were encountered: