plotting-basics
How to plot with plot_julia: native plotters, live windows, and seeing your own plots
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
How to plot with plot_julia: native plotters, live windows, and seeing your own plots
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
High-level Fimbul workflow, geothermal case factories, and result inspection
High-level JutulDarcy workflow, example discovery, and result unpacking
High-level Mocca workflow for adsorption-based CO2 capture simulations
Persistent Julia REPL workflow and live runtime introspection for Jutul-based work
Choose and customize BattMo cell parameter sets and cycling protocols
High-level BattMo workflow, example discovery, and output inspection
| name | plotting-basics |
| description | How to plot with plot_julia: native plotters, live windows, and seeing your own plots |
Use this skill whenever the user asks for a plot, chart, figure, or visualization, or when a plot would make simulation results easier to understand.
plot_julia captures whatever you drawUse plot_julia for anything that produces a figure — never build a Figure
in run_julia (that saves no artifact and the user can't see it). plot_julia:
Figure, returns a (fig, ax, plot) tuple, or calls a native plotter that opens
a window / calls display internally.So you do not need to end on fig, and you do not need to avoid display.
Just call the plotter.
Call your simulator's own documented plotters first — they are the canonical,
best-looking views, they run on GLMakie, and plot_julia captures them
automatically. The <sim>-overview skill lists the plotters for your simulator.
Build a Figure inline when no native plotter fits, or when you want a specific
custom view:
fig = Figure(size = (600, 400))
ax = Axis(fig[1, 1], title = "History match", xlabel = "t", ylabel = "rate")
lines!(ax, t, sim); scatter!(ax, t, obs)
fig
view=truePass view=true to get the (downscaled) image back so you can look at it —
to verify a curve overlays the data, spot an anomaly, or check a 3D view. Use it
deliberately, not on every plot (each image costs tokens). The user always sees
the saved artifact regardless of view.
plot_julia(code="<your plot code>", view=true) # then reason about what you see
plot_julia shows the figure to the user and saves a PNG record. How it is shown
depends on the interface you are driving (your interface note states it): a live
Makie window on the desktop they can rotate, zoom, and step; an interactive figure
pinned in a side panel on the web; or just the saved PNG on a headless/one-shot
run. You always just call plot_julia — you don't manage that difference, and
there's no separate "interactive" mode.
view is for you, not the user — it returns the image to you; it shows
them nothing extra.window=false only to compute/inspect a plot without surfacing it.gui=true):
that opens a separate desktop window outside plot_julia. Just call the plotter
normally — the tool already shows the figure the right way for the interface.run_julia
(use plot_julia) or set window=false — fix that, don't just re-describe it.Each plot is keyed by its slot — the same slot refreshes that view in place
(reuse it when iterating so you don't spawn a new view per attempt), and distinct
plots get distinct slots (slot="reservoir", slot="wells") so they stay
addressable as separate views. This applies on every interface (a desktop window,
or a tab in the web side panel).
Recapture and close act on desktop plot windows (they don't apply on the web, where the figure stays live in the browser):
recapture_plot(slot="reservoir") re-renders that plot's figure at its current
state and returns the image. Omit slot for the most recent. It renders the
figure jutul-agent still holds, so it works even if the user closed the window
(you get its last state); only close_plots discards it. You can't advance the
timestep yourself — ask the user to step the window, then recapture.close_plots(slot="reservoir") (one) or close_plots() (all).plot_solve_breakdown/plot_cumulative_solve family is
finicky about argument types — prefer this). reports = result.result.reports,
then per report step r: length(r[:ministeps]), r[:total_time], and per
ministep m: m[:linear_iterations], m[:convergence_time]. Plot vs report
step with Figure/Axis/lines! through plot_julia.plot_julia call, then call the plotter:
using GraphMakie, NetworkLayout, LayeredLayouts
plot_variable_graph(reservoir_model(model)) # per-variable dependencies
# or: plot_model_graph(model)
If it errors with "no method matching plot_variable_graph", the extension hasn't
loaded yet — re-run the using line and the plotter together in one call.size=(width, height) sets a specific resolution.slot="name" overwrites the same artifact path when refreshing a comparison
during calibration (e.g. slot="saturation_final").using CSV, DataFrames
obs = CSV.read("experiments/observations/data.csv", DataFrame) # workspace-relative, no leading slash
plot_julia if the REPL already holds
the result/arrays from a recent run_julia — plot from the cached objects.
Plotting should take seconds, not minutes.slot= for comparison plots you refresh during calibration.