Hiding decorations and spines

You have several options for efficiently hiding decorations and axis spines in a plot.

Package input

using TopoPlots
using UnfoldMakie
using CairoMakie
using DataFrames

include("../../../example_data.jl")
data, pos = example_data("TopoPlots.jl")
dat, evts = UnfoldSim.predef_eeg(; noiselevel = 10, return_epoched = true)
([7.12373084717791 -14.643167664038257 … 8.770271520309837 4.669510193385215; -0.9585287421702547 -12.68184440485485 … 5.23123205493583 -3.3335410378671755; … ; -2.6268562502899666 -10.051459715119043 … 2.676949521564918 -17.07646482218065; 2.400191991285271 -1.743384615374093 … 10.213367335129892 -11.11547223244284], 2000×3 DataFrame
  Row │ continuous  condition  latency
      │ Float64     String     Int64
──────┼────────────────────────────────
    1 │   2.77778   car             62
    2 │  -5.0       face           132
    3 │  -1.66667   car            196
    4 │  -5.0       car            249
    5 │   5.0       car            303
    6 │  -0.555556  car            366
    7 │  -2.77778   car            432
    8 │  -2.77778   face           483
  ⋮   │     ⋮           ⋮         ⋮
 1994 │   3.88889   car         119798
 1995 │   0.555556  car         119856
 1996 │   0.555556  face        119925
 1997 │  -3.88889   face        119978
 1998 │  -3.88889   car         120030
 1999 │  -0.555556  face        120096
 2000 │  -1.66667   face        120154
                      1985 rows omitted)

Hiding

First, you can specify the axis settings with axis = (; ...).

Makie.Axis provides multiple variables for different aspects of the plot. This means that removing all decorations is only possible by setting many variables each time.

Second, Makie does provide methods like hidespines! and hidedecorations!. Unforunately, user may lose access to a plot after it is drawn in.

Third, hidespines! and hidedecorations! can be called by setting variables with layout = (; hidespines = (), hidedecorations = ()).

You still will able to specify it flexibly: hidespines = (:r, :t) will remove the top and right borders.

f = Figure()
plot_butterfly!(
    f[1, 1],
    data;
    positions = pos,
    topo_axis = (; height = Relative(0.4), width = Relative(0.4)),
    axis = (; title = "With decorations"),
)
plot_butterfly!(
    f[2, 1],
    data;
    positions = pos,
    topo_axis = (; height = Relative(0.4), width = Relative(0.4)),
    axis = (; title = "Without decorations"),
    layout = (; hidedecorations = (:label => true, :ticks => true, :ticklabels => true)),
)
f
Example block output

You can also completely remove all spines, decorations, color bars, and even padding.

f = Figure(; figure_padding = 0)
plot_erpimage!(
    f,
    dat;
    layout = (; hidespines = (), hidedecorations = (), use_colorbar = false),
)
Example block output

Showing

Some plots hide features by default. This could be reverted by setting the variables to nothing

data, positions = TopoPlots.example_data()
plot_topoplot(
    data[:, 340, 1];
    positions = positions,
    layout = (; hidespines = nothing, hidedecorations = nothing),
)
Example block output

For more information on the input of these functions refer to the Makie dokumentation on Axis.


This page was generated using Literate.jl.