Skip to content

Adjusting fontsize of facet labels #653

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

Open
sethaxen opened this issue May 4, 2025 · 1 comment
Open

Adjusting fontsize of facet labels #653

sethaxen opened this issue May 4, 2025 · 1 comment

Comments

@sethaxen
Copy link

sethaxen commented May 4, 2025

Problem description

As far as I can tell, there is no way to directly adjust the fontsize of the facet labels. Sometimes the labels I'd like are a little too long, and it would be helpful to be able to adjust this.

Example

Currently the best option is to set the fontsize of the figure, which affects all other font sizes.

julia> using AlgebraOfGraphics, GLMakie

julia> layer = (
           data((; x=[1, 1], y=[1, 1], cat=["Short Name", "Really Long Category Name"])) *
           mapping(:x, :y; col=:cat)
       );

julia> fig = draw(layer; figure=(; size=(350, 200)))

Image

julia> fig = draw(layer; figure=(; size=(350, 200), fontsize=10))

Image

Proposed solution

I'm not certain the most AoG-ish way to do this.

@jkrumbiegel
Copy link
Member

jkrumbiegel commented May 6, 2025

There could be two places for this, either in draw(...; facet = (; ...) or in draw(..., scales(Col = (; ...) or Row, respectively. In principle, all scale settings should go to scales, however font size is not really an attribute of the scale itself. Compare to the Color scale where colorbar settings go into draw(...; colorbar = (; ... instead, or the x and y axes which have settings in draw(...; axis = (; ...). I have never found that 100% ideal because you can't change axis settings per facet this way, but it's also not easy to allow that level of drill-down from a simple interface. Also, the colorbar option for example predates the scales system, so it wasn't designed with that in mind. And most plots don't need that kind of control, anyway, although I like to err on the side of more options to not limit users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants