Permutation Feature Importance Plot in Makie.jl (Julia)

The same plot in 14 other libraries — Python: Altair, Bokeh, lets-plot, Matplotlib, Plotly, plotnine, Pygal, Seaborn; R: ggplot2; JavaScript: Chart.js, D3.js, Apache ECharts, Highcharts, MUI X Charts. Compare all 15 side by side: Permutation Feature Importance Plot in Python, R, Julia and JavaScript.

A horizontal bar chart displaying permutation feature importance from machine learning models, showing the decrease in model score when each feature is randomly shuffled. Unlike model-specific feature importances, permutation importance is model-agnostic and measures how much the model's performance degrades when a feature's relationship with the target is broken. Error bars indicate variability across multiple shuffles, providing a confidence measure for each importance score.

Permutation Feature Importance Plot rendered with Makie.jl

Renders

Julia source (Makie.jl)

# anyplot.ai
# bar-permutation-importance: Permutation Feature Importance Plot
# Library: makie 0.21.9 | Julia 1.11.9
# Quality: 92/100 | Created: 2026-08-26

using CairoMakie
using Colors
using Random

Random.seed!(42)

# --- Theme tokens -----------------------------------------------------------
const THEME    = get(ENV, "ANYPLOT_THEME", "light")
const PAGE_BG  = THEME == "light" ? colorant"#FAF8F1" : colorant"#1A1A17"
const INK      = THEME == "light" ? colorant"#1A1A17" : colorant"#F0EFE8"
const INK_SOFT = THEME == "light" ? colorant"#4A4A44" : colorant"#B8B7B0"

# Imprint sequential colormap — single-polarity continuous data
const ANYPLOT_SEQ = cgrad([colorant"#009E73", colorant"#4467A3"])

# --- Data: permutation importance for a churn-prediction gradient-boosting model
features = [
    "monthly_charges", "tenure_months", "contract_type", "total_charges",
    "num_support_tickets", "internet_service", "payment_method",
    "avg_data_usage_gb", "customer_age", "paperless_billing",
    "has_multiple_lines", "senior_citizen", "partner_status", "dependents_count",
]
importance_mean = [
    0.182, 0.146, 0.098, 0.081, 0.063, 0.047, 0.038,
    0.029, 0.021, 0.014, 0.009, 0.005, 0.002, -0.004,
]
importance_std = 0.10 .* abs.(importance_mean) .+ 0.004 .* rand(length(features))

n = length(features)
y_positions = collect(n:-1:1)  # highest importance at the top

# --- Plot ---------------------------------------------------------------
fig = Figure(
    size            = (1600, 900),
    fontsize        = 14,
    backgroundcolor = PAGE_BG,
)

ax = Axis(
    fig[1, 1];
    title              = "bar-permutation-importance · julia · makie · anyplot.ai",
    titlesize          = 20,
    titlecolor         = INK,
    xlabel             = "Decrease in Accuracy When Feature Is Shuffled",
    xlabelsize         = 14,
    xlabelcolor        = INK,
    xticklabelsize     = 12,
    yticklabelsize     = 12,
    xticklabelcolor    = INK_SOFT,
    yticklabelcolor    = INK_SOFT,
    xtickcolor         = INK_SOFT,
    ytickcolor         = INK_SOFT,
    backgroundcolor    = PAGE_BG,
    topspinevisible    = false,
    rightspinevisible  = false,
    leftspinecolor     = INK_SOFT,
    bottomspinecolor   = INK_SOFT,
    xgridcolor         = RGBAf(INK.r, INK.g, INK.b, 0.15),
    ygridvisible       = false,
    yticks             = (1:n, reverse(features)),
)

vlines!(ax, 0; color = INK_SOFT, linewidth = 1.5, linestyle = :dash)

barplot!(
    ax, y_positions, importance_mean;
    direction = :x,
    color = importance_mean,
    colormap = ANYPLOT_SEQ,
    colorrange = (minimum(importance_mean), maximum(importance_mean)),
    strokewidth = 0,
)

errorbars!(
    ax, importance_mean, y_positions, importance_std;
    direction = :x,
    color = INK_SOFT,
    whiskerwidth = 8,
    linewidth = 1.5,
)

Colorbar(
    fig[1, 2];
    limits = (minimum(importance_mean), maximum(importance_mean)),
    colormap = ANYPLOT_SEQ,
    label = "Importance",
    labelcolor = INK,
    labelsize = 12,
    ticklabelsize = 11,
    ticklabelcolor = INK_SOFT,
    tickcolor = INK_SOFT,
)
colsize!(fig.layout, 2, Relative(0.03))

# --- Save -------------------------------------------------------------------
save("plot-$(THEME).png", fig; px_per_unit = 2)

Retrieve this implementation

Runnable source as JSON, for any HTTP client: https://api.anyplot.ai/specs/bar-permutation-importance/makie/code. Any spec id and library id listed in llms-full.txt fit the same URL shape; every URL below is complete and callable.

{
  "spec_id": "bar-permutation-importance",
  "language": "julia",
  "library": "makie",
  "page": "https://anyplot.ai/bar-permutation-importance/julia/makie",
  "hub": "https://anyplot.ai/bar-permutation-importance",
  "code_json": "https://api.anyplot.ai/specs/bar-permutation-importance/makie/code",
  "spec_json": "https://api.anyplot.ai/specs/bar-permutation-importance",
  "render_light_png": "https://storage.googleapis.com/anyplot-images/plots/bar-permutation-importance/julia/makie/plot-light.png",
  "render_dark_png": "https://storage.googleapis.com/anyplot-images/plots/bar-permutation-importance/julia/makie/plot-dark.png",
  "quality_score": 92.0,
  "license": "MIT",
  "guide": "https://anyplot.ai/llms.txt"
}

Part of Permutation Feature Importance Plot on anyplot.ai.

Other implementations