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

Allow padding keyword for Textbox #3822

Open
Datseris opened this issue May 1, 2024 · 3 comments
Open

Allow padding keyword for Textbox #3822

Datseris opened this issue May 1, 2024 · 3 comments
Labels
enhancement Feature requests and enhancements

Comments

@Datseris
Copy link
Contributor

Datseris commented May 1, 2024

Feature description

Textbox brings a much needed feature to Makie: adding a text with surrounding box in the figure. It has all options necessary to style the textbox as you wish. Without Textbox, actually making text with a surrounding box can be very tedious and complex, and thus very hard to memorize, e.g., https://discourse.julialang.org/t/fill-a-bounding-box-behind-text-in-makie/101502/3.

The only thing I am misssing from Textbox is an additional padding argument, that controls the pad of the box borders themselves w.r.t. to their placement.

For plot types, please add an image of how it should look like

E.g., I have this nice figure:

image

where the labels top right are added with

        Textbox(fig[i, j];
            placeholder = string(round(rmi; sigdigits = 2)),
            textcolor_placeholder = :black, valign = :top, halign = :right,
            tellwidth = false, tellheight=false, boxcolor = (:white, 0.75),
            textpadding = (5, 5, 5, 5)
        )

where i, j iterates over the 10 axes locations. I would like to add an additional padding that would place the textbox futher away from the axis splines. textpadding controls the distance between text and the textbox borders so it is not that.

@Datseris Datseris added the enhancement Feature requests and enhancements label May 1, 2024
@jkrumbiegel
Copy link
Member

You could use alignmode = Outside(padding)

@Datseris
Copy link
Contributor Author

Datseris commented May 1, 2024

Fantastic, thank you. However, I do not understand the interaction between alignmodel = Outside(padding) and textpadding. For example, I have this setup:

            textpadding = (2, 2, 2, 2),
            alignmode = Outside(0, 5, 0, 5)

which does not align things properly and the text gets cut off:

image

while, without setting alignmode at all, the text very nicely fits into the box with the same textpadding keyword:

image

@jkrumbiegel
Copy link
Member

Ah ok then the alignmode seems to take away space from the inside. Hm I have to think about it

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

2 participants