Multiple page plots

As shown in the following plot, Makie’s GridLayout is ideal for making a small multiple plot as described by Edward Tufte as a way to make plots more informative by increasing their “data density”. This is especially helpful with medical test results because a large amount of medical test results often lack a concise story.


To improve the graphical story, I would like to draw some causality arrows between some of the medical test results but some of the test results may be on different pages such that the arrow head may be out of view in one plot and that arrow tail may be out of view in another plot. Any suggestions on how to draw partial arrows so that they look whole when multiple plots are merged?

P.S., The Julia and Makie code for generating the above small multiple plot is listed in Appendix A of this draft essay (Seeing Causality in Medical Records).

1 Like

What exactly do you mean by “pages” and “when multiple plots are merged”? You can draw stuff across different Axis objects if that’s what you mean

1 Like

By “page” I meant the 14 axis plots in a small multiple plot (as shown above in the small multiple plot about kidney function) that is readable when printed to a paper page. However, there are other small multiple plots (e.g., about heart function) printed on other pages. I’m interested in drawing causality arrows that traverse multiple pages (i.e., multiple small multiple plots, each with about 14 axes plotted).

Are you expecting readers to print pages of a pdf that has some of these plots embedded, put them side by side and connect the arrows that way? I can give you a technical answer how to draw an arrow somewhere but I don’t get yet what your requirements for it are. Like how you imagine “drawing causality arrows that traverse multiple pages”

If you put your plot on some page in Word or LaTeX, wouldn’t it rather be the job of those tools to add arrows across pages? An arrow in a plot can’t go as far.

Yes. As a first step I would like to print a set of small multiple plot pages. When the set of pages are correctly arranged into a grid (e.g., 2 by 2), I’d like the causal arrows (that traverse individual small multiple plot boundaries) to line up.

Ok I see. Well you know the sizes of your figures, you can plot into the figure scene (which has a campixel camera, so no additional scaling) using those coordinates. You can draw a big arrow via poly with a polygon or a BezierPath and then add the same one twice, just adjusted for overall position in the “merged figure”.

Here I simulate this process by concatenating the images from four figures thought to be arranged in a square.

using CairoMakie
using LinearAlgebra

function arrowpoly(p1, p2, width)
    d = normalize(reverse(p2 - p1) .* (1, -1))
    [
        p1 + d * width/2,
        p2,
        p1 - d * width/2,
        p1 + d * width/2,
    ]
end

##

function makefig()
    fig = Figure(size = (500, 500), backgroundcolor = rand(RGBf))

    for i in 1:3, j in 1:3
        Axis(fig[i, j])
    end

    fig
end

# arrow starts at (100, 400) in top-left figure and ends in (300, 400) in bottom-right
p1 = Point2f(100, 400)
p2 = Point2f(300, 400)

f1 = makefig()
translate!(poly!(f1.scene, arrowpoly(p1, p2 + Point2f(500, -500), 50), color = :red), 0, 0, 100)

f2 = makefig()
translate!(poly!(f2.scene, arrowpoly(p1 + Point2f(-500, 0), p2 + Point2f(0, -500), 50), color = :red), 0, 0, 100)

f3 = makefig()
translate!(poly!(f3.scene, arrowpoly(p1 + Point2f(0, 500), p2 + Point2f(500, 0), 50), color = :red), 0, 0, 100)

f4 = makefig()
translate!(poly!(f4.scene, arrowpoly(p1 + Point2f(-500, 500), p2, 50), color = :red), 0, 0, 100)

save("test.png", ([
    colorbuffer(f1) colorbuffer(f2)
    colorbuffer(f3) colorbuffer(f4)
]))

I spent no effort on the arrow shape though :smiley:

3 Likes