BeautifulMakie
BeautifulMakie copied to clipboard
Request: Image histogram
I couldn't find a nice easy image histogram easily, so I wonder if it might be a nice addition to your beautiful collection?
I struggled to make this:
using CairoMakie
using StatsBase
using Images
using TestImages
function image_histogram()
img = testimage("lighthouse")
fig = Figure(); ax = Axis(fig[1, 1])
reds = vec(float.(red.(img)))
greens = vec(float.(green.(img)))
blues = vec(float.(blue.(img)))
for (i, col) = enumerate([:red, :green, :blue])
hist!(ax, (reds, greens, blues)[i], scale_to=-0.6, bins=60, offset=i, direction=:x, color=col)
end
fig
end
fig = with_theme(image_histogram, theme_black())
![Screenshot 2021-10-11 at 16 42 20](https://user-images.githubusercontent.com/52289/136818476-0d57a611-87d7-4c6c-9ca3-32bc7ae4988f.png)
I think a better version of this could be useful. People ask for it on stack overflow and discourse...
Thanks for the issue. I didn't see the issues (probably I'm not that active anymore :(, other duties). But, I did a bunch of different options for histogram here. Either way, I will add a nice version also in the gallery. Nowadays, I don't know what is missing, so please, if there are requests out there feel free to open more issues, I will try to add them as soon as I'm able to do so.
this example now live here