Created
July 22, 2020 11:03
-
-
Save jkrumbiegel/e721eec3ebfdeb32ad4bc8d2d2ec8efb to your computer and use it in GitHub Desktop.
margin histogram in makielayout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AbstractPlotting | |
using AbstractPlotting.MakieLayout | |
using StatsBase | |
## | |
scene, layout = layoutscene(resolution = (600, 600)) | |
data = Node(randn(200, 2) * [1 2; 2 1]) | |
xhist = @lift(fit(Histogram, $data[:, 1], nbins = 20)) | |
yhist = @lift(fit(Histogram, $data[:, 2], nbins = 20)) | |
mainax = layout[2, 1] = LAxis(scene) | |
topax = layout[1, 1] = LAxis(scene) | |
rightax = layout[2, 2] = LAxis(scene) | |
colsize!(layout, 1, Relative(0.8)) | |
rowsize!(layout, 2, Relative(0.8)) | |
scatter!(mainax, data) | |
barplot!(topax, @lift(midpoints($xhist.edges[1])), @lift($xhist.weights)) | |
barplot!(rightax, @lift(midpoints($yhist.edges[1])), @lift($yhist.weights), direction = :x) | |
linkxaxes!(mainax, topax) | |
linkyaxes!(mainax, rightax) | |
scene |
Author
jkrumbiegel
commented
Jul 22, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment