Input UI components for the dumbbellPlot module
Source:R/dumbbellPlot_module_ui.R
dumbbellPlotInputsUI.RdThis should be placed in the UI where the inputs should be shown, with an id
that matches the id used in the dumbbellPlotServer() and dumbbellPlotOutputUI() functions.
Arguments
- id
The ID for the Shiny module.
- data
The data frame used for plot generation.
- defaults
A named list of default values for the inputs. An entry may also be a
shiny::reactive()orshiny::reactiveVal(); it is resolved withshiny::isolate()to seed the control, and the module then keeps it live (seesetup_reactive_defaults()).- title
An optional title for the UI grid.
- columns
Number of columns for the UI grid.
Details
The user inputs for this module are separated from the outputs to allow for more flexible UI design.
The inputs will automatically be organized into a grid layout via the organize_inputs() function,
with columns controlling the number of columns in the grid.
Defaults can be set for each input by providing a named list of values to the defaults argument.
Plot parameters not implemented or with altered functionality
The following dumbbellPlot() parameters are not exposed as UI inputs:
order.by- Order rows by a Y value; not currently wired to a UI input (usedefaultsto set)
Plot parameters and defaults
The following dumbbellPlot() parameters can be accessed via UI inputs:
x- X values (UI: "X Values (max 2)", defaults key:x.value, multiple: TRUE, max 2 enforced)y- Y value (UI: "Y Value", defaults key:y.value, single selection)x.adjustment- X-axis transformation (UI: "X Adjustment", default: "")colour.by- Color by X or Y (UI: "Colour By", default: "X variables")facet.by- Faceting variable (UI: "Facet By", default: "")facet.scales- Facet scale behavior (UI: "Facet Scales", default: "fixed")line.colour- Color of connecting lines (UI: "Colour of Connectors", default: "gray30")point.size- Marker diameter in pixels (UI: "Point Size", default: 12)palette.selection- Color palette (UI: palette picker)
Parameters controlling additional functionality
The following parameters controlling plotly-specific features and styling are also available:
flip.x- Flip X-axis (UI: "Flip X Axis", default: FALSE)flip.y- Flip Y-axis (UI: "Flip Y Axis", default: FALSE)title.font.size- Plot title font size (UI: "Title Size", default: 26)title.font.family- Font family for title text (UI: "Title Font", default: "Arial")title.font.color- Color for plot title (UI: "Title Color", default: "#000000")axis.title.font.size- Axis title font size (UI: "Axis Title Size", default: 18)axis.title.font.color- Axis title font color (UI: "Axis Title Color", default: "#000000")axis.title.font.family- Axis title font family (UI: "Axis Title Font", default: "Arial")axis.showline- Show axis border lines (UI: "Show Axis Borders", default: TRUE)axis.mirror- Mirror axis lines on opposite side (UI: "Mirror Axis Borders", default: TRUE)show.grid.x- Show X-axis major gridlines (UI: "Show X Gridlines", default: TRUE)show.grid.y- Show Y-axis major gridlines (UI: "Show Y Gridlines", default: TRUE)grid.color- Gridline color (UI: "Gridline Color", default: "#CCCCCC")axis.linecolor- Color of axis lines (UI: "Axis Line Color", default: "black")axis.linewidth- Width of axis lines (UI: "Axis Line Width", default: 0.5)axis.tickfont.size- Size of tick labels (UI: "Tick Label Size", default: 12)axis.tickfont.color- Color of tick labels (UI: "Tick Label Color", default: "black")axis.tickfont.family- Font family for tick labels (UI: "Tick Label Font", default: "Arial")axis.tickangle.x- Rotation angle for X-axis tick labels (UI: "X Tick Label Angle", default: 0)axis.tickangle.y- Rotation angle for Y-axis tick labels (UI: "Y Tick Label Angle", default: 0)axis.ticks- Position of tick marks (UI: "Tick Position", default: "outside")axis.tickcolor- Color of tick marks (UI: "Tick Mark Color", default: "black")axis.ticklen- Length of tick marks (UI: "Tick Mark Length", default: 5)axis.tickwidth- Width of tick marks (UI: "Tick Mark Width", default: 1)axis.scientific- Write numeric tick labels in scientific notation (UI: "Scientific Notation Ticks", default: FALSE; when off they never switch to it). Seeapply_tick_notation()axis.padding.x- Space between the data and the plot area's edges along X, as a fraction of the data's extent at each end (UI: "X Axis Padding", default: NA = the plot's own). Seeapply_axis_padding()axis.padding.y- Space between the data and the plot area's edges along Y, as a fraction of the data's extent at each end (UI: "Y Axis Padding", default: NA = the plot's own). Seeapply_axis_padding()facet.title.font.size- Facet subplot title font size (UI: "Facet Subplot Title Size", default: 18)facet.title.font.color- Facet subplot title font color (UI: "Facet Title Color", default: "#000000")facet.title.font.family- Facet subplot title font family (UI: "Facet Title Font", default: "Arial")legend.show- Show the legend and any colorbar (UI: "Show Legend", default: TRUE)legend.font.family- Font family of the legend title and labels (UI: "Legend Font", default: "Arial")legend.font.color- Font color of the legend title and labels (UI: "Legend Font Color", default: "#000000")legend.title.size- Legend title font size (UI: "Legend Title Size", default: 14)legend.text.size- Legend entry label font size (UI: "Legend Text Size", default: 12)hline.intercepts- Y-coordinates for horizontal reference lines (UI: "Y-intercepts", default: "")hline.colors- Colors for horizontal lines (UI: "Colors", default: "#000000")hline.widths- Widths for horizontal lines (UI: "Widths", default: "1")hline.linetypes- Line types for horizontal lines (UI: "Line Types", default: "dashed")hline.opacities- Opacities for horizontal lines (UI: "Opacities (0-1)", default: "1")vline.intercepts- X-coordinates for vertical reference lines (UI: "X-intercepts", default: "")vline.colors- Colors for vertical lines (UI: "Colors", default: "#000000")vline.widths- Widths for vertical lines (UI: "Widths", default: "1")vline.linetypes- Line types for vertical lines (UI: "Line Types", default: "dashed")vline.opacities- Opacities for vertical lines (UI: "Opacities (0-1)", default: "1")abline.slopes- Slopes for diagonal reference lines (UI: "Slopes", default: "")abline.intercepts- Y-intercepts for diagonal lines (UI: "Y-intercepts", default: "")abline.colors- Colors for diagonal lines (UI: "Colors", default: "#000000")abline.widths- Widths for diagonal lines (UI: "Widths", default: "1")abline.linetypes- Line types for diagonal lines (UI: "Line Types", default: "dashed")abline.opacities- Opacities for diagonal lines (UI: "Opacities (0-1)", default: "1")margin.t- Top margin in pixels (UI: "Margin Top", default: 70)margin.b- Bottom margin in pixels (UI: "Margin Bottom", default: 70)margin.l- Left margin in pixels (UI: "Margin Left", default: 70)margin.r- Right margin in pixels (UI: "Margin Right", default: 70)subplot.margin.x- Horizontal spacing between facet panel columns (UI: "Subplot Spacing (Horizontal)")subplot.margin.y- Vertical spacing between facet panel rows (UI: "Subplot Spacing (Vertical)")shape.fill- Fill color for drawn shapes (UI: "Shape Fill", default: "rgba(0, 0, 0, 0)")shape.line.color- Outline color for drawn shapes (UI: "Shape Line Color", default: "black")shape.line.width- Outline width for drawn shapes (UI: "Shape Line Width", default: 4)shape.linetype- Line dash style for drawn shapes (UI: "Shape Linetype", default: "solid")shape.opacity- Opacity for drawn shapes (UI: "Shape Opacity", default: 1)palette.colours- Named character vector mapping group levels to colors, e.g.c(A = "#FF0000", B = "blue")(UI: "Plot colors"). Seeds the picker; unnamed groups fall back to the default palette and user edits take precedence.
Examples
if (FALSE) { # interactive()
library(VizModules)
data <- data.frame(
School = c("MIT", "Stanford", "Harvard"),
Women = c(94, 96, 112),
Men = c(152, 151, 165)
)
dumbbellPlotInputsUI("dumbbellPlot", data)
}