Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic plot tests #4804

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Generic plot tests #4804

wants to merge 5 commits into from

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Feb 17, 2025

Description

I wanted to test that every plot correctly initializes and propagates transformation in #4792. I figured it would be good to do this in a more generalized way, so I worked on creating a function that produces a sample plot for everything we have. That should simplify writing tests a bit by making it easier to just get a plot for some random plot type.

Currently tests that every plot works in a Scene().

Fixes h/vlines, h/vspan, ablines and datashader (?) not working in Scene() due to projview_to_2d_limits not working without a Float32Convert.

Type of change

Delete options that do not apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • Added an entry in CHANGELOG.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@MakieBot
Copy link
Collaborator

MakieBot commented Feb 18, 2025

Benchmark Results

SHA: b46d5a95e733dfb0d2679b0b5ffd05e2a6ac914a

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

test/testplot.jl Outdated
CT = Makie.conversion_trait(PlotType)
f = Makie.MakieCore.plotfunc!(PlotType)

if CT === PointBased() || PlotType <: Union{Makie.Text, ABLines, BarPlot,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this multiple dispatch based, maybe so it returns aplotspec that can be decomposed to args and kwargs and then plotted?

That way it's easy to extend as we get more recipes, or for external recipes we may want to test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I guess multiple dispatch would be better if another library wants to reuse and extend the Code for testing. If it's just used here I don't think multiple dispatch matters much.

I'm not sure if PlotSpec is a good idea. It's calling to_value on kwargs/attributes and I'd assume it circumvents parts of the normal plot pipeline. It should probably be tested separately

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, maybe just returning a tuple (; args, kwargs) might work?

@ffreyer ffreyer added the skip-changelog Skips changelog enforcer label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Skips changelog enforcer
Projects
Status: Work in progress
Development

Successfully merging this pull request may close these issues.

3 participants