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

Subscript/superscript combinations #4489

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Subscript/superscript combinations #4489

wants to merge 6 commits into from

Conversation

jkrumbiegel
Copy link
Member

This PR adds the subsup and left_subsup rich text functions which allow to create combined sub/superscripts which are common in fields such as chemistry. Fixes #2718

You cannot have line breaks in them so I'm just avoiding the complications that would come from allowing that.

Looks like:

text(2, 2,
        text = rich(
        left_subsup("92", "238"), "U",
        "  ",
        left_subsup("13", "27"), "Al", superscript("3+"),
        "  ",
        left_subsup("53", "127"), "I", superscript(""),
        "  ",
        "x", subsup("tfk", "py"),
        "   ",
        "a", superscript("2"),
        "   ",
        "b", subscript("3"),
        "   ",
        "c", subsup("A", "B"),
    ),
    fontsize = 30,
    align = (:center, :center),
    axis = (; xscale = log10, yscale = log2, xgridvisible = false, ygridvisible = false),
)
image

@MakieBot
Copy link
Collaborator

MakieBot commented Oct 16, 2024

Compile Times benchmark

Note, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running:

using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(fig)
using create display create display
GLMakie 6.53s (6.47, 6.57) 0.03+- 163.40ms (161.85, 167.24) 1.87+- 483.69ms (475.16, 496.19) 6.90+- 8.40ms (8.28, 8.50) 0.07+- 26.12ms (26.05, 26.17) 0.04+-
master 6.51s (6.47, 6.54) 0.03+- 164.08ms (162.77, 167.59) 1.70+- 482.72ms (475.72, 495.69) 7.66+- 8.42ms (8.35, 8.49) 0.05+- 26.16ms (26.07, 26.36) 0.10+-
evaluation 1.00x invariant, 0.02s (0.71d, 0.21p, 0.03std) 1.00x invariant, -0.67ms (-0.38d, 0.49p, 1.79std) 1.00x invariant, 0.97ms (0.13d, 0.81p, 7.28std) 1.00x invariant, -0.02ms (-0.34d, 0.54p, 0.06std) 1.00x invariant, -0.04ms (-0.54d, 0.34p, 0.07std)
CairoMakie 6.22s (6.15, 6.38) 0.09+- 176.60ms (167.27, 181.24) 4.65+- 211.11ms (203.20, 220.02) 5.49+- 8.11ms (7.94, 8.42) 0.17+- 1.25ms (1.24, 1.28) 0.01+-
master 6.19s (6.11, 6.29) 0.06+- 176.97ms (172.87, 182.30) 3.32+- 209.19ms (206.34, 214.28) 2.55+- 8.19ms (8.07, 8.39) 0.11+- 1.24ms (1.23, 1.25) 0.01+-
evaluation 1.00x invariant, 0.03s (0.35d, 0.53p, 0.07std) 1.00x invariant, -0.37ms (-0.09d, 0.87p, 3.99std) 0.99x invariant, 1.92ms (0.45d, 0.43p, 4.02std) 1.01x invariant, -0.08ms (-0.53d, 0.34p, 0.14std) 0.99x slower X, 0.01ms (1.41d, 0.03p, 0.01std)
WGLMakie 6.69s (6.64, 6.74) 0.03+- 165.55ms (162.50, 178.60) 5.79+- 5.59s (5.49, 5.67) 0.06+- 12.44ms (12.34, 12.73) 0.14+- 134.28ms (130.31, 137.74) 2.81+-
master 6.66s (6.60, 6.87) 0.09+- 164.84ms (161.50, 169.34) 2.83+- 5.88s (5.81, 5.95) 0.05+- 13.21ms (12.30, 16.99) 1.68+- 133.08ms (128.84, 138.01) 3.46+-
evaluation 1.00x invariant, 0.03s (0.39d, 0.49p, 0.06std) 1.00x invariant, 0.7ms (0.15d, 0.78p, 4.31std) 1.05x faster✅, -0.3s (-5.33d, 0.00p, 0.06std) 1.06x noisy🤷‍♀️, -0.77ms (-0.65d, 0.27p, 0.91std) 0.99x invariant, 1.19ms (0.38d, 0.49p, 3.13std)

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.

Feature request: super-above-subscript
2 participants