Skip to content
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

cornerplot and corrplot #210

Closed
juliohm opened this issue Jun 9, 2021 · 9 comments
Closed

cornerplot and corrplot #210

juliohm opened this issue Jun 9, 2021 · 9 comments

Comments

@juliohm
Copy link
Member

juliohm commented Jun 9, 2021

Any plans to add cornerplot and corrplot like in StatsPlots.jl? Perhaps it is already possible to achive similar result with AOG?

@piever
Copy link
Collaborator

piever commented Jun 9, 2021

Something like

df = (x = rand(100), y = rand(100), z = rand(100))
vars = [:x, :y, :z]
data(df) * (visual(Scatter) + linear()) * mapping([:x, :y, :z], [:x :y :z], col = dims(1), row = dims(2)) 

would do a "symmetric" corrplot. It's definitely planned to have the full corrplot functionality available, but the interface / implementation are not super clear. See also #187 and piever/SplitApplyPlot.jl#53 (comment)

@juliohm
Copy link
Member Author

juliohm commented Sep 8, 2021

@piever can you please clarify the col/row mechanism? Couldn't find it in the docs. I am having trouble creating the corner/corrplot using the snippet you shared above.

@filchristou
Copy link

I am also having some trouble undestanding how does this col, row, dims mechanism work.
In your example your diagonal will be just a straight line.
image

is there a way to substitute the diagonal plots with the density functions instead ?
image

@sethaxen
Copy link

Something like

df = (x = rand(100), y = rand(100), z = rand(100))
vars = [:x, :y, :z]
data(df) * (visual(Scatter) + linear()) * mapping([:x, :y, :z], [:x :y :z], col = dims(1), row = dims(2)) 

would do a "symmetric" corrplot.

@piever I have data in x and would like to split x by a categorical cycling variable group, plotting a 4x4 corner plot where subplot (i, j) compares x-values of group i with x-values of group j. Can this example be modified for something like this? e.g. data

df = (x = rand(100), group=repeat(1:4, 25))

@piever
Copy link
Collaborator

piever commented Jun 28, 2022

I think something like

data(df) * (visual(Scatter) + linear()) * mapping(:x, :x, col = :group => nonnumeric, row = :group => nonnumeric)

should do the trick in that case.

EDIT: as pointed out below, this does not do the desired thing.

The things that are not supported at the moment are adding marginal histograms in a simple way (either around the layout or in the diagonal) and doing asymmetric things (lower triangle is different from upper triangle). I'm not sure if there is a simple way to support that consistently within AoG, or whether one is better off adding some sort of "recipe with rich layout" to Makie, where a plot gets a subfigure instead of just an axis. There is a little bit of discussion on that around piever/SplitApplyPlot.jl#53 (comment)

@sethaxen
Copy link

I think something like

data(df) * (visual(Scatter) + linear()) * mapping(:x, :x, col = :group => nonnumeric, row = :group => nonnumeric)

should do the trick in that case.

This doesn't seem to:
tmp

@piever
Copy link
Collaborator

piever commented Jun 29, 2022

Ah yes, of course you are right... I'm afraid there is no way at the moment other than manually unstacking the data to pass to the wide format.

@pkofod
Copy link

pkofod commented Sep 19, 2023

Is this something you would be interested in adding as a feature? And have you already thought about the "AoG" interface for such a thing? Or do you think it should just be a Makie recipe with DataFrame input because it can't really leverage any AoG features?

@juliohm
Copy link
Member Author

juliohm commented Sep 19, 2023 via email

@juliohm juliohm closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants