Two y-axes in AoG/Makie?

Nosferican
Wed, 29 Dec 2021 19:42:28 +0000
General Usage

How can create a plot with two y-axes using AoG / Makie? I want to have two “marks” / geometries with different y-axes. Here is an example using VegaLite.jl.

plt =
    @vlplot(
        data = data0,
            mark = {
                :errorband,
                cornerRadiusTopLeft = 3,
                cornerRadiusTopRight = 3,
                color = "#004c97",
        x = {
            "Year:o",
            axis = {
                title = "Year",
                labelAlign = "center",
                labelAngle = 0,
                titleFontSize = 30,
                labelFontSize = 20,
                dx = 200,
                }},
        height = 800,
        width = 800,
        resolve = {scale = {y = "independent"},
           },
        y = {
            "investment",
            axis = {
                title = "Current Dollars (\$B)",
                titleFontSize = 30,
                labelFontSize = 20,
                titlePadding = 10,
                }},
	    y2 = {"ub"},
        ) +
    @vlplot(
        data = data1,
        mark = {
            :bar,
            cornerRadiusTopLeft = 3,
            cornerRadiusTopRight = 3,
            fillOpacity = 0.25,
            color = "#d86018",
            },
        y = {
            "value",
            axis = {
                title = "Growth Rate (%)",
                titleFontSize = 30,
                labelFontSize = 20,
                titlePadding = 10,
                },
            stack = nothing,
            color = :variable,
            },
    )

4 posts - 4 participants