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")
(25600×7 DataFrame
   Row │ estimate      time     channel  coefname  topo_positions        se    ⋯
       │ Float64       Float64  Int64    String    Any                   Float ⋯
───────┼────────────────────────────────────────────────────────────────────────
     1 │  0.020321      -0.3          1  A         (0.493714, 0.544031)  0.122 ⋯
     2 │  0.017548      -0.298        1  A         (0.493714, 0.544031)  0.124
     3 │  0.0150747     -0.296        1  A         (0.493714, 0.544031)  0.124
     4 │  0.0127718     -0.294        1  A         (0.493714, 0.544031)  0.124
     5 │  0.0104138     -0.292        1  A         (0.493714, 0.544031)  0.122 ⋯
     6 │  0.00782599    -0.29         1  A         (0.493714, 0.544031)  0.119
     7 │  0.00500377    -0.288        1  A         (0.493714, 0.544031)  0.114
     8 │  0.00214393    -0.286        1  A         (0.493714, 0.544031)  0.105
   ⋮   │      ⋮           ⋮        ⋮        ⋮               ⋮                ⋮ ⋱
 25594 │  0.121127       0.486       64  A         (0.719221, 0.888091)  0.247 ⋯
 25595 │  0.119454       0.488       64  A         (0.719221, 0.888091)  0.247
 25596 │  0.11769        0.49        64  A         (0.719221, 0.888091)  0.250
 25597 │  0.116001       0.492       64  A         (0.719221, 0.888091)  0.256
 25598 │  0.114315       0.494       64  A         (0.719221, 0.888091)  0.261 ⋯
 25599 │  0.112385       0.496       64  A         (0.719221, 0.888091)  0.262
 25600 │  0.109979       0.498       64  A         (0.719221, 0.888091)  0.258
                                                2 columns and 25585 rows omitted, Point{2, Float32}[[0.49371386, 0.5440313], [0.5630452, 0.50400287], [0.5630452, 0.4239459], [0.49371386, 0.38391745], [0.4243825, 0.4239459], [0.4243825, 0.50400287], [0.5378472, 0.6178857], [0.61455333, 0.56901854], [0.6522695, 0.4862579], [0.6388263, 0.39630732]  …  [0.93907887, 0.6439135], [0.9450873, 0.29968786], [0.8333667, 0.12432156], [0.61803544, 1.9428903f-16], [0.3693923, 2.7755576f-17], [0.15406103, 0.12432156], [0.029739477, 0.3396528], [0.04834886, 0.6439135], [0.26820713, 0.88809085], [0.7192206, 0.88809085]])

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 = ()).

Same with spines: hidespines = (:r, :t) will remove the top and right borders.

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

Since some plots hide features by default, which can 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.