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

x tick labels can cut off in certain settings #4658

Open
3 tasks done
daviehh opened this issue Dec 11, 2024 · 1 comment
Open
3 tasks done

x tick labels can cut off in certain settings #4658

daviehh opened this issue Dec 11, 2024 · 1 comment
Labels

Comments

@daviehh
Copy link
Contributor

daviehh commented Dec 11, 2024

  • what version of Makie are you running? (]st -m Makie)
(@v1.11) pkg> st -m Makie
Status `~/.julia/environments/v1.11/Manifest.toml`
  [ee78f7c6] Makie v0.21.17

(@v1.11) pkg> st -m GLMakie
Status `~/.julia/environments/v1.11/Manifest.toml`
  [e9467ef8] GLMakie v0.10.17

(@v1.11) pkg> st -m CairoMakie
Status `~/.julia/environments/v1.11/Manifest.toml`
  [13f3f980] CairoMakie v0.12.17

julia> versioninfo()
Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M1 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 6 default, 0 interactive, 3 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 1
  JULIA_MATHLINK = /Applications/Mathematica.app/Contents/Frameworks/mathlink.framework
  JULIA_MATHKERNEL = /Applications/Mathematica.app/Contents/MacOS/MathKernel
  JULIA_PROJECT = @.
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 6
  • can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie)
    yes

  • What platform + GPU are you on?
    macos, both CairoMakie and GLMakie

MWE:

using GLMakie
using CairoMakie

# switch between for test
# GLMakie.activate!()
CairoMakie.activate!()

plt_theme = Theme(
    Axis=(
        xminorticks=IntervalsBetween(2), xminorticksvisible=true,
        yminorticks=IntervalsBetween(2), yminorticksvisible=true,
        xtickalign=1, xminortickalign=1,
        ytickalign=1, yminortickalign=1,
    )
)

x = 0:1400

with_theme(plt_theme) do
    fig = Figure(; size=(600, 400), fontsize=21)
    ax = Makie.Axis(fig[1, 1];
        xautolimitmargin=(0.0, 0.0),
        # yautolimitmargin=(0.05, 0.05),
        xticks=0:200:1400,
        yticks=WilkinsonTicks(3; k_min=3, k_max=4),
        xlabel="x",
        # alignmode=Mixed(
        #     left=Makie.Protrusion(90),
        #     right=Makie.Protrusion(10),
        #     bottom=Makie.Protrusion(30),
        #     top=Makie.Protrusion(0),
        # ),
        ylabel="y",
    )
    xlims!(0, 1400)
    lines!(x, sin.(x / 1400 * 3))
    fig
end

The last digit of 1400 is cut off in the plot.

Image

Manually set the alignmode can 'fix' but should be handled automatically?

@daviehh daviehh added the bug label Dec 11, 2024
@jkrumbiegel
Copy link
Member

jkrumbiegel commented Dec 26, 2024

This is not a "bug" in that sense but simply a known caveat of the layout algorithm. A layout element can only report static protrusions, but in general, the amount that an xticklabel might stick out at the side depends on its size, its relative location on the xaxis and the size of the axis. So it's a cyclical dependency, xticklabel changes space for axis, changes axis size, changes xticklabel protrusion, etc. That's why the amount the xticklabels stick out at the side is not hooked up to the layout.

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

No branches or pull requests

2 participants