Hi @piever, plot() doesn’t seem to help.
I found a bit of hacky way to partially do this using Axis(ae).block_limit_linking[] = true
like this:
using AlgebraOfGraphics, CairoMakie, DataFrames
CairoMakie.activate!(type = "svg")
set_aog_theme!()
df = DataFrame(x=rand(100), y=rand(100), i=rand(["a", "b", "c", "d", "e", "f"], 100))
plt = data(df) * histogram(normalization=:probability) * mapping(:x, layout=:i)
fig = draw(plt)
for ae in fig.grid
Axis(ae).block_limit_linking[] = true
Axis(ae).title[] == "a" ? Axis(ae).limits[] = ((-20,20),nothing) : Axis(ae).limits[] = ((1e-9,1e0),nothing)
Axis(ae).title[] == "a" ? Axis(ae).xscale[] = identity : Axis(ae).xscale[] = log10
end
fig
However, there’s still some issue because if I have any negative values in the data in the columns that are not on log10 then it doesn’t work as this example:
using AlgebraOfGraphics, CairoMakie, DataFrames
CairoMakie.activate!(type = "svg")
set_aog_theme!()
df = DataFrame(x=rand(100) .- 0.5, y=rand(100), i=rand(["a", "b", "c", "d", "e", "f"], 100))
df.x[df.i .== "a", :] = 1 .+ df.x[df.i .== "a", :].^2
plt = data(df) * histogram(normalization=:probability) * mapping(:x, layout=:i)
fig = draw(plt)
for ae in fig.grid
Axis(ae).block_limit_linking[] = true
Axis(ae).title[] == "a" ? Axis(ae).limits[] = ((-20,20),nothing) : Axis(ae).limits[] = ((1e-9,1e0),nothing)
Axis(ae).title[] == "a" ? Axis(ae).xscale[] = identity : Axis(ae).xscale[] = log10
end
fig
Display Error: ERROR: DomainError with -0.5:
NaN result for non-NaN input.
Stacktrace:
[1] nan_dom_err
@ ./math.jl:429 [inlined]
[2] log10
@ ./math.jl:576 [inlined]
[3] apply_transform(f::Tuple{typeof(log10), typeof(identity)}, point::Vec{2, Float32})
@ Makie ~/.julia/packages/Makie/gyI4W/src/layouting/transformation.jl:265
[4] project_position(scene::Scene, point::Vec{2, Float32}, model::StaticArrays.SMatrix{4, 4, Float32, 16})
@ CairoMakie ~/.julia/packages/CairoMakie/D0iNC/src/utils.jl:8
[5] etc...
Seems like something is still linked somewhere and in my actual code I do have negative values in plots that are on linear axis so this doesn’t work.
I work in biology research and I use Julia for modeling so I frequently find myself plotting things on log and linear axis on the same plot. For this particular plot, I’m plotting the distribution of bootstrapped parameters values that I got by fitting an equation describing rate of an enzyme to data using BlackBoxOptim.jl. Some of the parameters are energy and have physically reasonable range of (-20, 20) and other parameters are binding constants and have a range (1e-9,1000) so it’s easier to look at all of them if I plot histogram of some on linear and others on log x-axis. I think many people who use Julia for modeling/differential equations have to plot things on log and linear axis all the time so an easy way to do this in AlgebraOfGraphics should be broadly useful.
I like your package a lot and looking forward to seeing how it evolves. Thanks for all you hard work on this!