AlgebraOfGraphics.jl icon indicating copy to clipboard operation
AlgebraOfGraphics.jl copied to clipboard

Density force the same xaxis on wide data plots with multiple variable

Open DarioSarra opened this issue 1 year ago • 0 comments

I am trying to have a figure with the density plots of a variable and its log10 transform next to each other. I tried to pass the two variables as a string vector and call col = dims(1). I obtain the plot, but the x-axis's span is the same for both plots, even if they have very different min and max values. I was expecting the two plots to have independent x-axis spans. I tried using facet=(; linkxaxes=:none,), but it doesn't affect the result. It seems that the density was calculated taking the extrema from a combination of the 2 variables.

Here is an example:

v1 = rand(120)
v2 = log10.(v1)
testdf = DataFrame(v1 = v1,v2 = v2,cat = rand(["a","b","c"],120))
xvars = ["v1", "v2"]
plt = data(testdf) * AlgebraOfGraphics.density() * mapping(xvars, color = "cat", col = dims(1))
draw(plt, facet=(; linkxaxes=:none,))

density_example

DarioSarra avatar Nov 23 '23 16:11 DarioSarra