liuyxpp / MakiePublication.jl

A Julia package for producing publication quality figures based on Makie.jl.
Other
112 stars 7 forks source link

Text at edges of plots lost #13

Open musoke opened 5 months ago

musoke commented 5 months ago

I have created a fresh environment

using Pkg
Pkg.activate(temp=true)
Pkg.add(["AlgebraOfGraphics", "CairoMakie", "MakiePublication"])
Pkg.status()
  [cbdf2221] AlgebraOfGraphics v0.6.18
  [13f3f980] CairoMakie v0.11.10
  [dde8697e] MakiePublication v0.3.5

and generated simple plot

using AlgebraOfGraphics
using CairoMakie
using MakiePublication

df = (x = [1, 2, 3, 4, 5], y = [1, 2, 3, 4, 5], c=[1, 2, 3, 1, 4])
layers = data(df) * mapping(:x, :y, color=:c => "bpqj") * visual(Scatter)

Rendering it with the default theme results in

draw(layers)

image

However, MakiePublication's theme_acs_2col results in the following figure:

with_theme(theme_acs_2col()) do    
    draw(layers)
end

image

This has two issues:

This behaviour is consistent in other MakiePublication themes I have tried.

liuyxpp commented 5 months ago

I can reproduce this. The cutting seems caused by the following line in the acs theme

theme_args = (figure_padding=0,

Change figure_padding to 4, the cutting is gone.

The purpose of this line is to produce a tight layout. However, it seems with colorbars, the Makie padding algo fails.

I am not familiar with AlgebraOfGraphics, but with normal Makie code, figure_padding can be reset when creating the figure object. Or, we can add a new keyword argument tight=true. When tight=false, set figure_padding=4.

musoke commented 5 months ago

Thanks for checking this out.

I would expect that figure_padding=0 does not cut off any of a figures's content. Is it possible that this is a bug in Makie? If so, the best solution may be a bug report there.

On Thu, May 9, 2024, 09:06 Yi-Xin Liu @.***> wrote:

I can reproduce this. The cutting seems caused by the following line in the acs theme

theme_args = (figure_padding=0,

Change figure_padding to 4, the cutting is gone.

The purpose of this line is to produce a tight layout. However, it seems with colorbars, the Makie padding algo fails.

I am not familiar with AlgebraOfGraphics, but with normal Makie code, figure_padding can be reset when creating the figure object. Or, we can add a new keyword argument tight=true. When tight=false, set figure_padding=4.

— Reply to this email directly, view it on GitHub https://github.com/liuyxpp/MakiePublication.jl/issues/13#issuecomment-2102623385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7ET7C6ETHV7ANFNF2DH7LZBNYEDAVCNFSM6AAAAABHJRYU4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBSGYZDGMZYGU . You are receiving this because you authored the thread.Message ID: @.***>