Input UI components for the DensityPlot module
Source:R/plotthis_DensityPlot_module_ui.R
plotthis_DensityPlotInputsUI.RdThis should be placed in the UI where the inputs should be shown, with an id
that matches the id used in the plotthis_DensityPlotServer() and plotthis_DensityPlotOutputUI() 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.
Nearly all parameters for plotthis::DensityPlot() can be set via these inputs, so see the help
for that function for an exhaustive list.
Plot parameters not implemented or with altered functionality
The following plotthis::DensityPlot() parameters are not available via UI inputs:
xlab- X-axis label (plotly allows interactive editing)ylab- Y-axis label (plotly allows interactive editing)title- Plot title (plotly allows interactive editing)subtitle- Plot subtitle (not supported in plotly)legend.position- Legend positioning (plotly allows interactive repositioning)group_by_sep- Separator for group columns (not applicable in UI context)group_name- Group legend name (handled by plotly)xtrans- X-axis transformation (not implemented in UI)ytrans- Y-axis transformation (not implemented in UI)split_by- Split variable (returns a patchwork object, not supported in plotly), usefacet_byinsteadsplit_by_sep- Only applies ifsplit_byis usedtheme- ggplot2 theme (not applicable in plotly)theme_args- Theme arguments (not applicable in plotly)palette- Managed internally via the palette selection UIexpand- Axis expansion (not implemented)seed- Random seed (not applicable)combine- Only applies ifsplit_byis usednrow- Only applies ifsplit_byis usedncol- Only applies ifsplit_byis usedbyrow- Only applies ifsplit_byis usedaxes- Only applies ifsplit_byis usedaxis_titles- Only applies ifsplit_byis usedguides- Only applies ifsplit_byis useddesign- Only applies ifsplit_byis usedpalreverse- Reverse the color palette (not implemented)aspect.ratio- Aspect ratio control (handled by plotly layout)keep_empty- Keep empty factor levels (not implemented)keep_na- Keep NA values (not implemented)legend.direction- Managed position of legend however this can be handled via plotly
Plot parameters and defaults
The following plotthis::DensityPlot() parameters can be accessed via UI inputs and/or the defaults argument:
x- X-axis variable (UI: "X Data", default: 2nd numeric variable)group_by- Grouping variable (UI: "Group By", default: "")flip- Flip/swap the x and y axes (UI: "Rotate (swap X/Y)", default: FALSE)position- Position adjustment (UI: "Position", default: "identity")alpha- Density fill transparency (UI: "Plot Alpha", default: 0.5)add_bars- Add rug plot (UI: "Add Rug Plot", default: FALSE)bar_height- Rug bar height (UI: "Rug Bar Height", default: 0.04)bar_alpha- Rug bar transparency (UI: "Rug Bar Alpha", default: 1)bar_width- Rug bar width (UI: "Rug Bar Width", default: 1)facet_by- Faceting variable (UI: "Facet By", default: "")facet_scales- Facet scale behavior (UI: "Facet Scale", default: "fixed")facet_ncol- Number of facet columns (UI: "Columns", default: NULL)facet_nrow- Number of facet rows (UI: "Rows", default: NULL)facet_byrow- Facet ordering direction (UI: "Facet by Row", default: TRUE)palcolor- Custom color values (UI: palette picker, derived from palette)
Parameters controlling additional functionality
The following parameters implementing new functionality or controlling plotly-specific features are also available:
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 lines", default: TRUE)axis.mirror- Mirror axis lines on opposite side (UI: "Mirror axis lines", default: TRUE)show.grid.x- Show X-axis major gridlines (UI: "Show X major gridlines", default: TRUE)show.grid.y- Show Y-axis major gridlines (UI: "Show Y major gridlines", default: TRUE)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-axis tick label angle", default: 0)axis.tickangle.y- Rotation angle for Y-axis tick labels (UI: "Y-axis 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()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")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.single.fill.color- Fill color used when no grouping is set (UI: "Fill color")
Examples
if (FALSE) { # interactive()
library(VizModules)
data(mtcars)
plotthis_DensityPlotInputsUI("densityPlot", mtcars)
}