Editing a chart

Every chart in the Output log has an Edit chart… button in its card header. It opens the chart editor: a live preview with the presentation controls that chart actually supports — legend placement, series colours, line width, bar stacking and spacing, axis limits and reference lines, text size, logarithmic axes, and the title.

The editor changes how a chart looks. It never changes what it measures: no control in it can alter a variable, a filter, a bin count or a statistic. To change the analysis, re-run the command.

The one thing worth understanding

An edit is a command, not a decoration.

When you press Apply, ChakataStat does not store your colours somewhere beside the chart. It rewrites the chart's own line in the command journal to include what you chose, and swaps the restyled chart into the same slot in the Output log:

bar_chart category=Region, cluster=Treatment

becomes, after you stack the bars, move the legend and pick two colours:

bar_chart category=Region, cluster=Treatment, stacked=true, legend=bottom, colors=["#1f77b4", "#d62728"]

(One command per line, however long — see Reproducibility.)

That is the whole design. Re-run the script tomorrow, hand it to a colleague, or replay it on next year's data, and the chart comes back styled exactly as you left it — because the styling is part of the analysis you recorded, not a layer on top of it. Nothing you can do in the editor is unreproducible.

It also means the editor and the console are two views of one thing: anything the editor can set, you can type; anything you type, the editor picks up when you open it.

What you can edit

The editor asks the chart's own command what arguments it takes and offers exactly those controls — so it never shows you a control that would do nothing. A bar chart has no Line width; a histogram has one colour rather than a series list; a violin plot has no Legend, because it labels its groups on the axis instead.

Control What it does Charts that offer it
Title Renames the chart. Clear the field to get the analysis's own title back. Every chart tool except Kaplan-Meier (see below)
Legend Auto (top-right, inside the plot), Right, Bottom, or hidden The charts that draw a legend
Series colours One swatch per series, overriding the palette Every chart; single-colour charts show one swatch
Line width Stroke width of the plotted lines Line chart, ECDF, survival curves
Stacked / Stacking Clustered bars stacked part-to-whole, as values or normalised to 100% Bar chart
Bar gap How much of each category's slot is left empty Bar chart
X axis label / Y axis label Renames an axis. Clear the field to get the analysis's own label back Charts that draw that axis title
X min / X max / Y min / Y max Fixes an axis's limits. Leave a box empty to let that end fit the data Charts whose axis is a numeric scale
Horizontal lines at / Vertical lines at Dashed reference lines at the values you type — a mean, a threshold, a target. Separate several with commas As above, per axis
Marker / Marker size The shape and size drawn at each data point: circle, square, triangle, diamond or cross Scatter, Q-Q, line chart, item information curves
Gridlines Draws the plot's gridlines, or not Every chart the editor opens for
Height The plot's height in pixels Every chart the editor opens for
Text size Scales every piece of text on the chart at once — tick labels, axis titles, legend, annotations — from 0.5× to 3×. The gutters grow with it so larger labels still fit Every chart the editor opens for
Logarithmic x axis / Logarithmic y axis Draws that axis on a base-10 log scale, labelled at the decades with minor ticks between Scatterplot (both axes), line chart (both), histogram (x), Kaplan-Meier (the time axis)

Why a control appears on some charts and not others. The right-hand column above is not a rule of thumb — each control is offered only where it would actually do something:

  • An axis label appears where that axis has a title to rename. A boxplot and a violin plot draw no x-axis title, so they offer only Y axis label; a dot plot is the mirror image. A scatterplot matrix offers neither, because a grid of panels has no single pair of axes.
  • Axis limits and reference lines need a numeric axis. A bar chart's x axis lists categories and a histogram's counts bins, so neither takes an X min; an ECDF's y axis is a proportion that already runs 0 to 1, so it takes no Y min. Kaplan-Meier is finer still: the cumulative-hazard curve takes a y limit, the survival curve does not, because clipping a probability axis would misrepresent the estimate rather than reframe the view.
  • Markers appear only where a chart draws a mark at each data point.
  • A logarithmic axis needs an axis that is a measured quantity — never a bar chart's categories, a Q-Q plot's theoretical quantiles or a survival curve's probability. It also needs every plotted value on that axis to be positive, because zero and negatives have no logarithm. When the chart's data includes one, the switch is shown disabled with the offending value named beneath it, and the same request typed in the console is refused with the same message — the points are never silently dropped to make the axis fit. An X min or Y min on a log axis must be positive for the same reason. On a Kaplan-Meier plot the curve's start at time 0 does not count: it is drawn from the axis edge, and only the event times must be positive.

A reference line outside the axis range is simply not drawn — the axis is not stretched to reach it, because that would quietly undo a limit you set.

Three deliberate gaps, all for the same reason — an option that cannot be stated honestly is not offered:

  • Kaplan-Meier plots take no title. One kaplan_meier command can draw two different charts (the survival curve and the cumulative hazard), and a single title argument cannot name both. Their other controls all work — including the axis labels, because both charts share a time axis and the y label follows the curve kind.
  • Charts embedded in an analysis's output — a regression's diagnostic panels, a scree plot, a dendrogram — have no Edit button. They are byproducts of an analysis command rather than charts you asked for, and styling them would mean putting presentation arguments on statistical procedures.

Direct manipulation

Two things on the preview respond to the mouse:

  • Drag the legend. It snaps to the nearest of its allowed positions when you drop it. There is no free placement by design: the legend's position is a named setting in the command, and a legend pinned to a pixel would not survive a window resize honestly. Use Legend → Hidden to remove it.
  • Click a legend row to select that series; its row lights up in the colour list, so you can recolour the series you pointed at rather than counting rows.

Charts without a legend — the violin plot, the single-colour charts — are edited entirely from the panel, which always works.

Split File: one edit, the whole set

Under Split File, one command produces one chart per group. They share a command, so they share a style: editing any one of them restyles all of them, and the editor says so before you apply. Per-group styling is not something the command can express, so it is not something the editor pretends to do.

Titles are the exception that proves the rule. Rename a split chart "Blood pressure" and each group keeps its own qualifier — Blood pressure [region = North], Blood pressure [region = South] — because otherwise a renamed set would be several identical-looking charts with nothing to tell them apart.

When the journal gains a line instead

Applying an edit normally replaces the chart's existing line. Two cases append a new line instead, and the chart's note says so when it happens:

  • A chart the AI assistant made. The assistant runs tools directly and does not record them, so there is no line to amend — styling one of its charts is what finally gives it a command in the journal. That is the journal doing its job, not an error.
  • A line you edited away. If you have since rewritten or deleted the command the chart came from, ChakataStat will not guess which line you meant. It appends the styled command and tells you, so the script still reproduces what you are looking at.

Either way the journal keeps its meaning: the script that reproduces the current output, styled as seen.

What the editor does not do

By design, and recorded rather than merely missing: no annotations or free-standing text, no free-pixel legend placement, no per-group styling of a split set, no per-element text sizes (one Text size scales everything, on purpose — a chart with three type sizes chosen by hand rarely reads better than one), and no editing of data or of what is plotted. The editor edits what the recorded command can express — exactly that, so that everything it can do survives a re-run.

(Axis ranges, tick control, font scaling and a log axis were all on this list until 0.22.0, which added axis limits, reference lines, step-aware tick labels, Text size and the two Logarithmic axis switches.)

See also

  • Graphs — the chart dialogs and what each chart is for, and exporting one chart to PNG, SVG or PDF. Everything you set here is part of the chart, so it is part of every export.
  • Reproducibility — the command journal the editor writes into, and the presentation arguments you can type directly.
  • Settings — the palette every chart starts from.