Qu

xlabel

Builtin index · Plotting

xlabel(text, [align=])

Input: text, align · Output: no output

What it is

Labels the current panel's x-axis with text (string). align= (string, one of "left"/"center"/"right", default "center") sets the label's horizontal alignment. While xxaxis top is active, labels the *top* axis instead of the bottom one.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
xlabel(text, [align=])
text stringLabels the current panel's x-axis with text (string).
align string, optionalalign= (string, one of "left"/"center"/"right", default "center") sets the label's horizontal alignment.
no outputWhile xxaxis top is active, labels the *top* axis instead of the bottom one.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

xlabel("$\eta_{\mathrm{exc}}$, the excitation-dependent fraction")
-1.5 -1.0 -0.5 0 0.5 1.0 1.5 2.0 0 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 A 50 Hz tone, low-pass filtered ηexc, the excitation-dependent fraction amplitude measured filtered

from from-zero

scatterfit(t, y, 2)   # degree-2 polynomial fit through the scatter

xlabel("x")
ylabel("y")

from plotting

plot(t, noisy, color = "#b0b0b0")
plot(t, signal, color = "#0072BD")
xlabel("time [s]")
ylabel("amplitude")
savefig("my-first-figure.pdf")
output
· plot: figure 1 (1000 points)
· plot: figure 2 (1000 points)
· savefig my-first-figure.pdf
  note: this figure uses screen styling and may not hold up in print -- call theme("publication") before saving for a paper (said once per session)
-1.5 -1.0 -0.5 0 0.5 1.0 1.5 2.0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 time [s] amplitude

from start-here

plot(v, v .^ 2)
xlabel("x")
ylabel("x^2")
grid on
savefig("squares.pdf")
output
· plot: figure 1 (2 points)
· savefig squares.pdf
  note: this figure uses screen styling and may not hold up in print -- call theme("publication") before saving for a paper (said once per session)
100 150 200 250 300 350 400 10 11 12 13 14 15 16 17 18 19 20 x x^2

from fundamentals

How it works

While xxaxis top/yyaxis right is active, xlabel/ylabel label THAT side (xlabel2/ylabel2) instead of the primary bottom/left one — matches MATLAB's yyaxis + ylabel idiom. align= accepts "left"/"center"/"right" for title/xlabel, and additionally "bottom"/"top" for ylabel's rotated text (see plotting::parse_align); an unrecognized word is ignored, leaving the default alignment in place.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.