Skip to content

Comments

Complex Recipes for facets etc#5454

Open
SimonDanisch wants to merge 14 commits intomasterfrom
sd/complex-recipes
Open

Complex Recipes for facets etc#5454
SimonDanisch wants to merge 14 commits intomasterfrom
sd/complex-recipes

Conversation

@SimonDanisch
Copy link
Member

This is a prototype and enables:

using GLMakie

@recipe complex DualView (x, y) begin
    "Color for scatter plot"
    scatter_color = :blue
    "Color for line plot"
    line_color = :red
end

function Makie.plot!(cr::DualView)
    # cr[row, col] returns a RecipeSubfig that tracks created axes
    # cr.x, cr.y give access to converted arguments
    # cr.scatter_color gives access to attributes
    scatter(cr[1, 1], cr.x, cr.y; color=cr.scatter_color)
    lines(cr[1, 2], cr.x, cr.y; color=cr.line_color)
    return cr
end
fig, ax, cr = dualview(1:10, rand(10))  # Creates Figure + ComplexRecipe
dualview(fig[2, 1], 1:10, rand(10))     # Places in existing figure position

We still need to discuss the return type, corner cases and clean up the implementation.
I think theming already kind of works, but haven't really tested it.

@github-project-automation github-project-automation bot moved this to Work in progress in PR review Dec 3, 2025
@MakieBot
Copy link
Collaborator

MakieBot commented Dec 3, 2025

Benchmark Results

SHA: d52dd57e5e8b69c943c823c60aaa6a86eb8b6a8b

Warning

These results are subject to substantial noise because GitHub's CI runs on shared machines that are not ideally suited for benchmarking.

GLMakie
CairoMakie
WGLMakie

@asinghvi17
Copy link
Member

That seems broadly reasonable to me (looked over the code but have not yet tested it)

@jkrumbiegel jkrumbiegel changed the title Complex Recipes for facettes etc Complex Recipes for facets etc Dec 3, 2025
@ffreyer
Copy link
Collaborator

ffreyer commented Dec 3, 2025

We had some discussion internally about what these should return. [fig,] ax, complex_recipe matches up nicely with normal plots, but there can be multiple equally important axes to return. Or none. The other option would be to return [fig,] complex_recipe, where you are forced to grab the axis with complex_recipe[i, j].

@jkrumbiegel
Copy link
Member

The other option would be to return [fig,] complex_recipe, where you are forced to grab the axis with complex_recipe[i, j].

I like this better but like with Gridposition you'll have to use a content(recipe_object[i, j]) as there can be multiple objects in the same grid location

@ffreyer ffreyer mentioned this pull request Dec 13, 2025
11 tasks
@ffreyer ffreyer mentioned this pull request Jan 2, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Work in progress

Development

Successfully merging this pull request may close these issues.

5 participants