This is truly fantastic. Thanks for all the hard work going into makie.
The syntax mapping(x, y) * visual(Lines)
passing vectors directly is already taken for pre-grouped data, but maybe it is more natural to use it for the usecase you are suggesting. Pre-grouped data should have to be signaled explicitly by the user (as was the case in a previous version). This will require a little bit of thought, but itâs an interesting point to consider.
PS sorry for hijacking the thread on Beautiful Makie with this side discussion
At this point, there is almost nothing that I need that Makie canât do. There are a few things that arenât as convenient as in, say, ggplot, but the number of things (especially w/r/t figure generation) that are either much harder or impossible to do in other libraries is staggering. I cannot imagine going backâŚ
Here is something, I think Makie still cannot do. Here is a challenge for anyone to reproduce this kind of graphics in Makie
Yeah, fair enough - I donât do any 3D plotting, so canât comment on that front.
That seems similar to surface + contour3d. Same as http://juliaplots.org/MakieReferenceImages/gallery//surface___contour3d/index.html but with the plots overlaid on top of each other with contour lines colored black?
a very similar version is here [with a lot more options to customise],
https://lazarusa.github.io/BeautifulMakie/surfWireLines/surfWireContour/
the black contour 3d lines will be easy to put on top.
Some common things I didnât find in the gallery :
- Scatter with an histogram/density on the side
- Double axis
- Insets
Is it possible to do those ?
I usually find double-axis plots confusing because they break the one-to-one correspondence between data space and figure space. Though they can be handy for expressing two linearly related units like cm and inches.
Can parallel coordinates plots be done using Makie?
They still keep the one-to-one correspondence in higher dimensional data and are very useful to show parameter limits.
- Scatter with an histogram/density on the side
using CairoMakie
using StatsBase
##
set_theme!()
fig = Figure(resolution = (600, 600))
data = randn(200, 2) * [1 2; 2 1]
mainax = Axis(fig[2, 2])
hidedecorations!(mainax, grid=false)
hidespines!(mainax)
topax = Axis(fig[1, 2])
hidexdecorations!(topax, grid=false)
hideydecorations!(topax)
rightax = Axis(fig[2, 3])
hideydecorations!(rightax, grid=false)
hidexdecorations!(rightax)
bottomax = Axis(fig[3, 2], yticks=[0.0, 0.25])
hideydecorations!(bottomax)
bottomax.yreversed = true
leftax = Axis(fig[2, 1], xticks=[0.0, 0.25])
hidexdecorations!(leftax, grid=false)
leftax.xreversed = true
colsize!(fig.layout, 2, Relative(0.8))
rowsize!(fig.layout, 2, Relative(0.8))
colgap!(fig.layout, 0)
rowgap!(fig.layout, 0)
scatter!(mainax, data)
hist!(topax, data[:, 1])
hist!(rightax, data[:, 2], direction = :x)
density!(bottomax, data[:, 1])
density!(leftax, data[:, 2], direction = :y)
linkxaxes!(mainax, topax)
linkxaxes!(mainax, bottomax)
linkyaxes!(mainax, rightax)
linkyaxes!(mainax, leftax)
fig
Arbitrarily stylable of course
@feanor12 Itâs just a lineplot, so why not?
The main work will be to style the axis, but I donât see anything in there, that doesnât look like itâs possible with all the axis customizations:
https://makie.juliaplots.org/stable/makielayout/axis.html
I did not see an option to place the axis inside the plot.
Maybe it is possible by putting multiple line plots adjacent to each other with no gap?
What option did you have in mind?
- Scatter with an histogram/density on the side
ok. here a smaller version, compared to @sdanisch
https://lazarusa.github.io/BeautifulMakie/ScattersLines/ScatterHistDensitySides/
and here a twin axis
https://lazarusa.github.io/BeautifulMakie/ScattersLines/twinAxis/
This is a basic way you could do that in makie, of course with a bit of work that could be a nicely packaged up plot command:
using CairoMakie
CairoMakie.activate!(type = "svg")
let
s = Scene(camera = campixel!)
n = 5
k = 20
data = [randn(k) .* (rand() + 1) * 10 for _ in 1:n]
limits = extrema.(data)
scaled = [(d .- mi) ./ (ma - mi) for (d, (mi, ma)) in zip(data, limits)]
width = 600
height = 400
offset = 100
for i in 1:n
x = (i - 1) / (n - 1) * width
MakieLayout.LineAxis(s, limits = limits[i],
spinecolor = :black, labelfont = "Arial",
ticklabelfont = "Arial", spinevisible = true,
minorticks = IntervalsBetween(2),
endpoints = Point2f0[(offset + x, offset), (offset + x, offset + height)],
ticklabelalign = (:right, :center), labelvisible = false)
end
for i in 1:k
values = map(1:n, data, limits) do j, d, l
x = (j - 1) / (n - 1) * width
Point2f0(offset + x, (d[i] - l[1]) ./ (l[2] - l[1]) * height + offset)
end
lines!(s, values, color = get(Makie.ColorSchemes.inferno, (i - 1) / (k - 1)),
show_axis = false)
end
s
end
Hi @lazarusA. Fantastic work, putting all these plots together. I am a newbie to Makie. Usually, I have used Plots, PGFPlotsX, and PlotlyJS, depending on the job. I tried some of your examples (by directly copying your code), and many of them donât work. What does it mean to get the following error:
ERROR: LoadError: UndefVarError: Axis not defined
The same type of error appears with 3D plotting
ERROR: LoadError: UndefVarError: Axis3 not defined
Thanks.
Looks great thanks. I mean the code is a bit long, but it should be easy enough to write a helper function so itâs not a problem.
most probably is that you donât have the proper dependencies. All examples have at the end the versions needed to reproduce the examples. Something like:
Status `~/Documents/BeaufitulMakie/Project.toml`
[e9467ef8] GLMakie v0.3.2
Yeah, I know. The point is to be as pedagogical as possible, to see what you are actually doing and to be able to customise the plot as you wish afterwards if necessary. Probably a lot of examples could have been done in fewer lines, but IMO here you can see each step more or less clear.
@jzr, double axes can be essential, in particular for non-linear monotonic relations, as in this PyPlot example.
@lazarusA , yes it appears that I have a problem with the Makie dependencies. I up
GLMakie, CairoMakie and Makie. The last two were up updated to Makie v0.13.12, CairoMakie to 0.5.7 but GLMakie gets stuck in v0.1.30. I tried to force the installation of GLMakie v0.3.4, but, apparently, there is a conflict with WebIO and PLotlyJS. Is there a way to turn around this problem? Thank you.
@v1.6) pkg> add https://github.com/JuliaPlots/GLMakie.jl
Cloning git-repo `https://github.com/JuliaPlots/GLMakie.jl`
Updating git-repo `https://github.com/JuliaPlots/GLMakie.jl`
Updating registry at `C:\Users\Utilizador\.julia\registries\General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Updating registry at `C:\Users\Utilizador\.julia\registries\JuliaPOMDP`
Updating git-repo `https://github.com/JuliaPOMDP/Registry`
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package WebIO [0f1e0344]:
WebIO [0f1e0344] log:
ââpossible versions are: 0.2.5-0.8.15 or uninstalled
âârestricted to versions 0.8 by PlotlyJS [f0f68f2c], leaving only versions 0.8.0-0.8.15
â ââPlotlyJS [f0f68f2c] log:
â ââpossible versions are: 0.14.1 or uninstalled
â âârestricted to versions * by CryptoDashApp [8f55a569], leaving only versions 0.14.1
â â ââCryptoDashApp [8f55a569] log:
â â ââpossible versions are: 0.1.0 or uninstalled
â â ââCryptoDashApp [8f55a569] is fixed to version 0.1.0
â ââPlotlyJS [f0f68f2c] is fixed to version 0.14.1
âârestricted by compatibility requirements with Blink [ad839575] to versions: [0.8.0-0.8.5, 0.8.7-0.8.15]
â ââBlink [ad839575] log:
â ââpossible versions are: 0.8.0-0.12.5 or uninstalled
â âârestricted to versions 0.12 by PlotlyJS [f0f68f2c], leaving only versions 0.12.0-0.12.5
â ââPlotlyJS [f0f68f2c] log: see above
âârestricted by compatibility requirements with Requires [ae029012] to versions: 0.8.3-0.8.15 or uninstalled, leaving only versions: [0.8.3-0.8.5, 0.8.7-0.8.15]
â ââRequires [ae029012] log:
â ââpossible versions are: 0.5.0-1.1.3 or uninstalled
â âârestricted to versions 1 by PlotlyJS [f0f68f2c], leaving only versions 1.0.0-1.1.3
â ââPlotlyJS [f0f68f2c] log: see above
âârestricted by compatibility requirements with Observables [510215fc] to versions: uninstalled â no versions left
ââObservables [510215fc] log:
ââpossible versions are: 0.2.0-0.4.0 or uninstalled
âârestricted to versions 0.4 by GLMakie [e9467ef8], leaving only versions 0.4.0
ââGLMakie [e9467ef8] log:
ââpossible versions are: 0.3.4 or uninstalled
ââGLMakie [e9467ef8] is fixed to version 0.3.4