Using Makie with Quarto

Author

Dheepak Krishnamurthy

Published

April 27, 2023

Here’s an example of a static image generated using CairoMakie:

Code
using CairoMakie, Random

Random.seed!(123)
n = 200
x, y, color = randn(n) / 2, randn(n), randn(n)
fig = Figure(size=(600, 400))
ax1 = Axis(fig[1, 1])
ax2 = Axis(fig[2, 1])
ax3 = Axis(fig[2, 2])
hist!(ax1, x; color=(:orangered, 0.5), strokewidth=0.5)
scatter!(ax2, x, y; color=color, markersize=10, strokewidth=0)
hist!(ax3, y; direction=:x, color=(:dodgerblue, 0.5),
  strokewidth=0.5)
xlims!(ax1, -4, 4)
limits!(ax2, -4, 4, -3, 3)
ylims!(ax3, -3, 3)
hideydecorations!(ax3, ticks=false, grid=false)
hidexdecorations!(ax1, ticks=false, grid=false)
colsize!(fig.layout, 1, Relative(2 / 3))
rowsize!(fig.layout, 1, Relative(1 / 3))
colgap!(fig.layout, 10)
rowgap!(fig.layout, 10)
current_figure()

Reuse

Citation

BibTeX citation:
@online{krishnamurthy2023,
  author = {Krishnamurthy, Dheepak},
  title = {Using {Makie} with {Quarto}},
  date = {2023-04-27},
  url = {https://kdheepak.com/blog/using-makie-with-quarto/},
  langid = {en}
}
For attribution, please cite this work as:
D. Krishnamurthy, “Using Makie with Quarto,” Apr. 27, 2023. https://kdheepak.com/blog/using-makie-with-quarto/.