Interface: LayoutYaxis
A y axis. yaxis2, yaxis3, … declare further y axes, referenced from traces as 'y2', 'y3', ….
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
anchor? | "x" | "free" | `x${number}` | "x" | The x axis this axis is drawn against, or free. Defaults to the x axis of the first subplot using this axis. |
automargin? | | boolean | "left" | "right" | "top" | "bottom" | "height" | "width" | `left+${string}` | `right+${string}` | `top+${string}` | `bottom+${string}` | `height+${string}` | `width+${string}` | false | Grow the figure margins so tick labels and the title fit (E4.2). true allows every direction; flags restrict it. |
autorange? | boolean | "reversed" | "min reversed" | "max reversed" | "min" | "max" | true | Whether the range is computed from the data. reversed autoranges with the axis flipped. min/max autorange only that end and take the other from range (min reversed/max reversed also flip the axis). Defaults to false when a full range is given, to min/max when one end of range is null, and to reversed on a y axis only image traces use (row 0 at the top, as in Plotly). |
autorangeoptions? | LayoutYaxisAutorangeoptions | undefined | Constraints applied to the computed autorange. |
autoshift? | boolean | undefined | y axes with anchor: 'free' only: move the axis sideways so it does not overlap other free axes on the same side (and default position to the overlaid plot's edge, automargin to true, shift to ∓3 px). Plotly semantics. |
autotickangles? | readonly number[] | [0,30,90] | Candidate angles, in order of preference, for tickangle: auto. |
autotypenumbers? | "convert types" | "strict" | "convert types" | How type detection treats numeric strings: convert types counts '12' as a number; strict counts only real numbers, so numeric strings make a category axis. |
categoryarray? | DataArray | undefined | Category order for categoryorder: array. Categories not listed follow in trace order. |
categoryorder? | | "array" | "trace" | "category ascending" | "category descending" | "total ascending" | "total descending" | "min ascending" | "min descending" | "max ascending" | "max descending" | "sum ascending" | "sum descending" | "mean ascending" | "mean descending" | "median ascending" | "median descending" | undefined | Order of categories: as they first appear in the traces (trace), alphabetical/numerical (`category ascending |
color? | string | "#444" | Base color of the axis: the default for linecolor, tickcolor, zerolinecolor, dividercolor and (when changed) the tick-label and title font colors. |
constrain? | "range" | "domain" | "range" | How a scaleanchor / matches constraint is met on this axis: range widens the range, domain shrinks the axis (and its subplot) inside its domain. Default domain on the axes of image traces (Plotly). |
constraintoward? | "left" | "center" | "right" | "top" | "middle" | "bottom" | undefined | Which end stays put when a constraint changes the range or domain: left/center/right for x axes (default center), bottom/middle/top for y axes (default middle). |
dividercolor? | string | undefined | Multicategory divider color. Defaults to color. |
dividerwidth? | number | 1 | Multicategory divider width in px. Minimum: 0 |
domain? | readonly number[] | [0,1] | Fraction of the plot area [start, end] this axis spans. |
dtick? | unknown | undefined | Tick step. Linear axes: a positive number. Log axes: an integer n (a tick every n decades), L<f> (linear steps of f in data units, e.g. L0.5), D1 (every digit) or D2 (1, 2 and 5). Date axes: milliseconds, or M<n> for n months (M12 for years). |
exponentformat? | "none" | "e" | "E" | "power" | "SI" | "B" | "B" | How large and small numbers are written: none (1000000), e (1e+6), E (1E+6), power (1×10⁶), SI (1M), B (like SI but 1B for 10⁹). |
fixedrange? | boolean | false | Disables zoom and pan on this axis (drag, scroll, and modebar zoom leave its range alone). |
gridcolor? | string | "#eee" | Grid line color. |
griddash? | string | "solid" | Dash style: solid, dot, dash, longdash, dashdot, longdashdot, or a CSS-like list of dash lengths in px (5px,10px,2px,2px). |
gridwidth? | number | 1 | Grid line width in px. Minimum: 0 |
hoverformat? | string | "" | Format of this axis’ values in hover labels (same syntax as tickformat). Empty uses the tick format with extra precision. |
layer? | "above traces" | "below traces" | "above traces" | Draw the axis line, ticks and labels above or below the traces. Grid lines are always below. |
linecolor? | string | undefined | Axis line color. Defaults to color. |
linewidth? | number | 1 | Axis line width in px. Minimum: 0 |
matches? | string | undefined | Link this axis' range to another axis of the same type ('x', 'x2', 'y', …): they autorange together over all their data, and zoom, pan and relayout of one move all. The linked axes share range, autorange, rangemode, rangebreaks, constrain and the category order. An axis that would create a loop, or a target of another type, is ignored. |
maxallowed? | unknown | undefined | Highest value zoom and pan may reach, in range units (like range: exponents on log axes). Also caps the autorange. |
minallowed? | unknown | undefined | Lowest value zoom and pan may reach, in range units (like range: exponents on log axes). Also caps the autorange. |
minexponent? | number | 3 | Smallest decimal exponent written in exponent form (SI/B and exponent formats); smaller magnitudes are written out in full. Minimum: 0 |
minor? | LayoutYaxisMinor | undefined | Minor ticks and grid lines between the major ticks. |
minorloglabels? | "none" | "small digits" | "complete" | "small digits" | Log axes whose automatic ticks fall between powers of ten (2, 5 or every digit): small digits labels them with a small digit (2, 5), complete with the full value in the tick font, with tickprefix/ticksuffix (20, 50, 200), none leaves them unlabelled. |
mirror? | boolean | "all" | "ticks" | "allticks" | false | Repeat the axis line on the opposite side of the plot area: true (line), ticks (line and ticks); all/allticks do the same on every subplot sharing this axis. |
nticks? | number | 0 | Maximum number of ticks for tickmode: auto (the actual number may be lower so steps stay round). 0 picks it from the axis length. Minimum: 0 |
overlaying? | "y" | `y${number}` | "free" | "y" | Draw this axis over another y axis ('y', 'y2', …), sharing its domain (this axis' own domain is ignored), e.g. a secondary y axis with side: 'right'. Unset (or free) by default. The target must exist and must not overlay another axis itself; otherwise this is ignored. Templates cannot set it, since it names specific axes. |
position? | number | 0 | Position of the axis in paper coordinates (0–1 across the x direction). Only used when anchor is free. Range: 0 – 1 |
range? | readonly unknown[] | undefined | Visible range [start, end] in data units (numbers, dates or category names; exponents on log axes, as in Plotly). Setting it turns autorange off; null for one end autoranges that end only. |
rangebreaks? | readonly LayoutYaxisRangebreak[] | undefined | Spans hidden from the axis (plan E3.8): the axis skips them, so a weekday-only stock chart has no gaps for weekends or nights. Date and linear axes; data inside a break is not drawn. Ticks never land in a break; hover, zoom and pan work across breaks. |
rangemode? | "normal" | "tozero" | "nonnegative" | "normal" | Linear axes only. tozero extends the autorange to include 0; nonnegative keeps it ≥ 0. |
scaleanchor? | unknown | undefined | Lock the scale (px per unit) of this axis to another axis ('x', 'y2', …) of the same type, times scaleratio: yaxis: { scaleanchor: 'x' } keeps one unit the same length on both axes, e.g. for maps or square plots. Zooming either axis zooms the other. false or unset for none (the y axis of an image trace defaults to its anchor, for square pixels, as in Plotly); ignored with matches or when it would create a loop. |
scaleratio? | number | 1 | With scaleanchor: px per unit of this axis divided by px per unit of the anchor axis (2 makes one unit here twice as long). Minimum: 0 |
separatethousands? | boolean | false | Always separate thousands (1,000). By default only numbers with 5 or more integer digits are separated. |
shift? | number | undefined | y axes with anchor: 'free' only: extra horizontal offset in px (negative to the left). Defaults to -3 on the left and 3 on the right when autoshift is on, else 0. |
showdividers? | boolean | true | Multicategory axes: draw divider lines between groups. |
showexponent? | "none" | "all" | "first" | "last" | "all" | Which tick labels show the exponent. |
showgrid? | boolean | true | Draw grid lines at each tick. |
showline? | boolean | false | Draw the axis line. |
showspikes? | boolean | undefined | Draw a spike line from the hovered point to this axis. Defaults to false, or true when any other spike* attribute is set or hovermode is this axis' unified mode (x unified for x axes). |
showticklabels? | boolean | true | Show tick labels. |
showtickprefix? | "none" | "all" | "first" | "last" | "all" | Which tick labels get tickprefix. |
showticksuffix? | "none" | "all" | "first" | "last" | "all" | Which tick labels get ticksuffix. |
side? | "left" | "right" | "left" | Which side of the plot area the axis is drawn on. |
spikecolor? | string | undefined | Spike line color. Defaults to the hovered point's color (or a contrasting color when that is too close to the background). |
spikedash? | string | "dash" | Spike line dash (dot in unified hover). Dash style: solid, dot, dash, longdash, dashdot, longdashdot, or a CSS-like list of dash lengths in px (5px,10px,2px,2px). |
spikemode? | | "toaxis" | "across" | "marker" | "toaxis+across" | "toaxis+marker" | "across+toaxis" | "across+marker" | "marker+toaxis" | "marker+across" | "toaxis+across+marker" | "toaxis+marker+across" | "across+toaxis+marker" | "across+marker+toaxis" | "marker+toaxis+across" | "marker+across+toaxis" | "toaxis" | toaxis: from the point to the axis; across: across the whole plot area; marker: a dot on the axis. Combine with + (across+marker). Unified hover defaults to across. |
spikesnap? | "data" | "cursor" | "hovered data" | "hovered data" | hovered data: the spike follows the hovered point; data: the closest point within spikedistance, even when no label shows; cursor: the pointer position. |
spikethickness? | number | 3 | Spike line width in px (1.5 in unified hover). |
tick0? | unknown | undefined | Position of one tick for tickmode: linear (data units; a date on date axes, an exponent on log axes unless dtick is L<f>). Defaults to 0, or 2000-01-01 on date axes. |
tickangle? | number | "auto" | "auto" | Tick-label rotation in degrees. auto rotates x-axis labels by the first autotickangles entry that avoids overlap. |
tickcolor? | string | undefined | Tick color. Defaults to color. |
tickfont? | LayoutYaxisTickfont | undefined | Tick-label font. Defaults to layout.font. |
tickformat? | string | "" | Tick-label format: a d3-format specifier for numbers (.2f, ~s, $,) or a d3-time-format specifier for dates (%b %Y), plus %{n}f for n digits of fractional seconds and %h for the half year. Empty picks a format automatically. |
tickformatstops? | readonly LayoutYaxisTickformatstop[] | undefined | Zoom-dependent tick formats: the first enabled stop whose dtickrange contains the current tick step replaces tickformat. |
ticklabelmode? | "instant" | "period" | "instant" | Date axes: instant labels the tick instant; period centers each label in the period that starts at its tick (e.g. month names between month ticks). |
ticklabeloverflow? | "allow" | "hide past div" | "hide past domain" | undefined | What to do with labels that overflow: keep them, or hide those past the figure or the axis domain. Defaults to hide past div for outside labels and hide past domain for inside labels. |
ticklabelposition? | | "outside" | "inside" | "outside top" | "inside top" | "outside left" | "inside left" | "outside right" | "inside right" | "outside bottom" | "inside bottom" | "outside" | Tick labels outside or inside the plot area, optionally shifted to one side of the tick (top/bottom for y axes, left/right for x axes). |
ticklabelshift? | number | 0 | Shift of tick labels along the axis, in px. |
ticklabelstandoff? | number | 0 | Extra distance between tick labels and ticks, in px. |
ticklabelstep? | number | 1 | Label every n-th tick only (tickmode auto and linear). Minimum: 1 |
ticklen? | number | 5 | Tick length in px. Minimum: 0 |
tickmode? | "auto" | "linear" | "array" | "sync" | undefined | auto picks up to nticks round ticks; linear places ticks from tick0 every dtick; array uses tickvals/ticktext; sync aligns with the overlaid axis (reserved; behaves as auto). Defaults to array when tickvals is set, linear when dtick is set, else auto. |
tickprefix? | string | "" | Text before each tick label. |
ticks? | "" | "outside" | "inside" | "" | Draw tick marks outside or inside the plot area, or not at all (''). |
ticksuffix? | string | "" | Text after each tick label. |
ticktext? | DataArray | undefined | Tick labels for tickvals. Missing entries are formatted as usual. |
tickvals? | DataArray | undefined | Tick positions for tickmode: array (data units). |
tickwidth? | number | 1 | Tick width in px. Minimum: 0 |
title? | LayoutYaxisTitle | undefined | Axis title. |
type? | "linear" | "-" | "log" | "date" | "category" | "multicategory" | "-" | Axis type. '-' detects the type from the data of the first trace on this axis (Plotly's rules: mostly dates → date; more than twice as many distinct strings as numbers → category; two-level [[groups], [items]] arrays → multicategory; otherwise linear). |
visible? | boolean | true | Draw the axis (line, ticks, labels, grid and title). A hidden axis still maps data to pixels. |
zeroline? | boolean | true | Draw a line at 0 (linear axes whose range contains 0). |
zerolinecolor? | string | undefined | Zero line color. Defaults to color. |
zerolinewidth? | number | 1 | Zero line width in px. Minimum: 0 |