Apply axis styling to all subplot axes in a plotly figure
Source:R/plot_axis.R
apply_subplot_axis_styling.RdWhen using plotly subplots (e.g., via split.by in dittoViz), axis styling must be applied to all subplot axes (xaxis, xaxis2, xaxis3, etc.) individually. This helper function detects how many subplots exist and applies the provided axis styling to all of them.
Details
The styling is queued with plotly::layout(), which merges it into each
axis when the figure is built, so the axes' other properties (range, domain,
title text, ...) are kept. Only the styling is queued, never a copy of the
axis as it stands, so a property written to the figure's layout after this
call (such as a range raised by apply_stat_annotations()) is not reverted
at build time.