xlabel
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.
| Code | Input | Output | Description |
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 output | While 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")
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")
· 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)from start-here
plot(v, v .^ 2)
xlabel("x")
ylabel("x^2")
grid on
savefig("squares.pdf")
· 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)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.