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

Feature Request: Rich text for contour labels #4806

Open
briochemc opened this issue Feb 19, 2025 · 0 comments
Open

Feature Request: Rich text for contour labels #4806

briochemc opened this issue Feb 19, 2025 · 0 comments
Labels
enhancement Feature requests and enhancements

Comments

@briochemc
Copy link
Contributor

Feature description

I'd like to be able to use rich text for contour labels. Here is a MWE taken from the docs where I just add a labelformatter that simply converts values to strings, but which throws if said formatter uses rich text.

using CairoMakie
himmelblau(x, y) = (x^2 + y - 11)^2 + (x + y^2 - 7)^2
x = y = range(-6, 6; length=100)
z = himmelblau.(x, y')

levels = 10.0.^range(0.3, 3.5; length=10)
colorscale = ReversibleScale(x -> x^(1 / 10), x -> x^10)
labelformatter(z) = map(x -> "$z", z)       # convert to string, works as expected
labelformatter(z) = map(x -> rich("$z"), z) # convert to rich text, throws line below
f, ax, ct = contour(x, y, z; labels=true, labelformatter, levels, colormap=:hsv, colorscale)
f
@briochemc briochemc added the enhancement Feature requests and enhancements label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and enhancements
Projects
None yet
Development

No branches or pull requests

1 participant