When a visualization is created (e.g., by using the Visualization menu in Displayr or selecting Create > Charts > Visualization in Q), the visualization appears in the middle of the screen, and options for modifying the chart are shown in the object inspector (in Q) or Properties (in Displayr). Pressing the Calculate button causes the visualization to be created and updated with any selected data and other options. Checking Calculate automatically in Displayr or Automatic in Q sets the visualization so that it automatically updates whenever any of its inputs, including data, update.
The options in the Object Inspector for visualizations are organized into three tabs: Data (in Displayr) or Inputs (in Q), Appearance (in Displayr) or Properties (in Q), and Chart.
Note that some options may not be available in specific visualization types.
Data/Inputs
Output
The output section exists in the object inspector in Q. In Displayr, it is shown as the Table and Visualization buttons at the top of the object inspector (in Q) or Properties (in Displayr).
Visualization/Chart type governs the specific type of chart that is created.
In Q, when Show as is set to Table, or when Table is clicked in Displayr, the table that is used in the creation of a chart is shown. This table incorporates all the other settings on this page. That is, it shows the selected Data and the consequences of both the Visualization/Chart type selection and the selections in Data Manipulation.
Also in Q, this tab contains options that are specific to the Visualization/Chart type chosen. For example, for a column chart, there is an option called Stack series that creates a stacked column chart.
In Q, Chart types 'Area', 'Bar', 'Column', 'Line', 'Scatter', 'Radar', and 'Geographic Map', also have the option to Show as small multiples (panel chart). When this option is selected, each series will be shown in a separate panel.
Data Source
Data source determines which data the visualization is connected to. All chart types can accept one of the following:
- Data (in Displayr) or Output (in Q) - This can be a table or R output that already exists in the Report tree or on a page. This can include R outputs that are generated by analysis, such as Dimension Reduction, Regression, or Machine Learning.
- Variables - This option allows users to directly use variables from the Data. Different options are available depending on the selected Visualization/Chart type. Most of the visualizations accept summary data (e.g., Column or Bar charts), and when this option is used, users will also be offered the option of selecting a variable for Groups, to create a contingency table (or crosstab).
- Paste or type data - This option allows the user to type in or paste some data (e.g., from a spreadsheet). When the data source is Paste or type data, the following strings are treated as missing values: NA, NaN, Missing, missing, N/A, -, ., Invalid, invalid, and blank data. This option is available in Q.
Additionally, you can write R code to hook up the visualization in other ways using Properties > R CODE in Q or Data > Attributes > Code in Displayr.
Data Manipulation
Aggregate the data prior to plotting creates a frequency table if one variable is selected or computes the average when multiple variables are provided. Other types of tables can be hooked up by creating the table of interest before the visualization and then setting Data source to Data (or Output in Q).
Tidy labels extracts common prefixes from the row labels or vector names to shorten the labels in the chart.
Switch rows and columns swaps the rows and columns of the underlying table being plotted. This is useful for swapping which categories are shown on the x-axis versus the legend.
Hide percent symbol converts the chart data so it is treated as numeric instead of percent data (e.g. 4 instead of 4%). This will remove the percent symbol from both axis labels, data labels, and tooltips. When exporting to PowerPoint or Excel with this option selected, the chart data will be numeric with no percent symbol.
Convert to percentages/proportions calculates percentages based on the input data. If your data is already in percentages, you should instead use the number formatting settings for the applicable axes/numbers in the Chart tab. If crosstabs (i.e., a grouping variable) are used, then row percentages are computed except for heatmap and pie/donut charts, which use percentages out of the total responses.
Date format Text in the input data that can be interpreted as dates will automatically be converted into dates when appropriate. To turn this conversion off, select No date formatting. Sometimes warnings will occur when we cannot determine what format the date is, e.g., 02/01/2017 could be January 2, 2017 (International format) or February 1, 2017 (US format, default). In these cases, the user can choose a particular option to clarify the desired format.
Hide output with small sample sizes This can only be used if the input is a Table containing the 'Base n' or 'Sample Size' statistic. If any cell in the table has 'Base n' or 'Sample Size' smaller than the sample size cut-off, then an error will be given. Otherwise, the output is unchanged.
Hide values with small sample sizes This can only be used if the input is a Table containing the 'Base n' or 'Sample Size' statistic. If any cell in the table has 'Base n' or 'Sample Size' smaller than the sample size cut-off, then the outputs will be set to '0'. Otherwise, the output is unchanged.
Row/Column Manipulations
The following operations are applied sequentially in the order listed below. Each operation is applied first on the rows and then on the columns.
Hide empty rows/columns removes rows (or columns) from the data that contain entirely missing values. In the case when the data are percentages, selecting this option will also remove rows and columns that contain all zeros. One-dimensional vectors are treated as a table with one column and multiple rows.
Hide rows/columns with small sample sizes This can only be used if the input is a table containing the Column Sample Size/Column n or Sample Size/Base n Statistics. Rows/columns with Column Sample Size/Column n or Sample Size/Base n smaller than the sample size cut-off will be removed.
Row Manipulations/Column Manipulations > Select Row/Columns to show by
- Rows/Columns to show When this control is non-empty, then all rows and columns outside of this selection will be ignored. In both Displayr and Q, multiple rows/columns can be specified using a comma-separated list. In Displayr, there are additional options to specify rows/columns using a Combo box or List box control or Calculation output.
Sort rows/columns Whether to sort the input table according to the values in one of the columns/rows of the table. Sorting is performed after row/column selection. For example, if you have 5 specific columns you are interested in, the output table will contain the 5 columns listed in Columns to show, ordered by their row sum.
- Column/row used for sorting The name or index of the column/row to be used for sorting. If none is specified, the last column/row (usually NET) will be used.
Order rows/columns by similarity Row/column similarity is determined by performing correspondence analysis on input data and ordering the rows/column by the coordinates in the first dimension. This option is only available if sorting is not done
Reverse rows/columns Show rows/columns in reverse order.
Rows/columns to exclude from sorting A comma-separated list of rows/columns (either by name or indices) that should be included at the end of the table and excluded from sorting.
Rows/columns to ignore automatically removes rows (columns) from the table that contain the shown names. By default, it removes NET, Total, and SUM. This is performed after all the operations above, so they can be used to sort on. However, they are removed before the following two operations are performed, which can be useful to remove incomplete data.
Number of rows/columns from top/left to show This option can be used to specify a range from the top/left of the input table is shown. Note that because the operations are applied sequentially, the output is the intersection. For example, if Rows to show is used and linked to a list box, then this option can be used to limit the number of rows selected. Or sorting can be applied first to extract the rows/columns with the largest values.
Number of rows/columns from bottom/right to show This option is the same as the one above, except it is performed at the other end of the table. It can be used in combination with the operation above, for example, to select the columns with the largest and smallest row sums.
Row/column labels override the default row or column names. This is particularly useful for adjusting text in the legend, etc.
Attributes > Code (Displayr only) - This sub-menu will open the Code panel, and you can select the code type from the code selector dropdown.
- R Code Access and modify the underlying R code of the visualization.
- Inputs Javascript Access and modify the Properties itself.
Output (Displayr only) - Allows you to show the R code of the visualization.
Appearance/Properties
This tab contains options for formatting the size of the object in both Q and Displayr. The underlying R code used to create the visualization, and the JavaScript code used to customize the object inspector itself (see Object Inspector for more details about these options) in Q.
Additionally, in Displayr, Appearance > Significance is available for chart types 'Bar', 'Column', 'Line', and 'Radar'. It allows the arrows that are visible on the tables used as the data source to be shown on the chart. When the option is set to Arrows, Font Colors, or Arrows and Font Colors, then the color of the arrows will be taken from the color of the data labels if they are shown otherwise, the chart font color is used. You can modify the color of the arrows/font in Significance > Advanced > Significance Levels > Significance levels and appearance.
Chart
Options for customizing the appearance of the visualization. Not all visualizations have all the options.
Appearance
Significance arrow size Allows you to modify the size (length) of significance arrows, if shown.
Use template Allows you to select an existing visualization template to apply to the selected visualization.
Gap between bars This option is available for specific chart types, such as bar or column. It allows you to specify the spacing between bars at different category axis locations, as a proportion of the width of a single bar.
Gap between grouped bars This option is available for specific chart types, such as bar or column. It allows you to specify the spacing between bars at the specific category axis location, as a proportion of the width of a single bar.
Border width Width of border around bars in pixels.
If using a small multiples (panel chart), each series will be shown in a separate panel. When small multiples are used, the following options will also be shown:
- Number of rows: controls the layout of the panels
- Share axes between panels: if not selected, each panel will have its own range determined by the range of the series in the panel (unless Minimum/Maximum values in the Values axis is specified).
- Show averages of all series: when selected, an additional series is added in each panel, showing the values averaged across all series.
- Order: controls the order in which the panels are shown. If no order is specified, then the panels will follow the order of the columns in the input data.
- Padding: controls the space between panels. These controls are particularly useful if the panel titles overlap with the chart (increase top padding), or the data labels in the radar charts are truncated (increase left padding or right padding). The padding is always between 0 and 1, and specifies (approximately) a proportion of the total charting area. For a chart with r rows and c columns of small panels, the left and right padding should be smaller than 1/c and the top and bottom padding should be smaller than 1/r. If the values are too large, then the padding will be set to zero. It is best to start at small value and slowly increase the padding.
- Bar/Column corner radius (% of width): controls the degree of rounded corners on bar and column charts.
Data Series
Formatting options controlling the appearance of the data series.
Multiple colors within a single series This option can be used with Bar and Column charts so that each bar is a different color, similar to a Pyramid, Pie, or Bar Pictograph chart. This changes the default behavior where each data series (typically a column of a summary table) is shown in a single color. When this option is applied to a data set containing multiple series, Small multiples must be used to display the multiple series.
Color palette allows selection from and customization of the colors of different series. Examples of different palettes can be found here. There are also alternatives to provide greater control than the preset palettes
- If Default or template setting is selected, the Color palette from the visualization template is used. If no template has been supplied for the chart, then the color palette from the master slides will be used instead. If the template used has a Named colors palette, then the categories from the input data will be matched according to the names associated with specific colors. Unmatched data points will be shown in a color specified in the template (default grey).
- Custom color The user will be provided with a color picker single color. Note that this may not give the desired output if there is more than one series in the chart.
- Custom color gradient Two color pickers will be provided. A color scale will be constructed by linearly interpolating between the two colors.
- Custom palette A textbox allowing the user to specify multiple colors using a comma-separated list of hex codes. In most cases, this palette is treated as categorical but if Values are specified, a color scale will be created by linear interpolation.
- Custom palette (color pickers) The user will be provided with 12 color pickers to manually specify a palette. If the input data uses more than 12 colors, the palette will be recycled.
- Custom palette (R output) A palette can be specified as an R character vector. If the vector is unnamed, then the palette will be recycled if necessary. But when a named vector is used, then a color must be specified for each category in the input data.
Values A numeric table or R output can be provided if a sequential color palette is used. For a chart using Multiple colors within a single series with Small Multiples, Values can either be a vector with a length equal to the number of rows in the input data (bars in each panel will be colored the same); or a table with the same number or rows and columns as the input data (bars in each panel colored separately but using the same color scale). Data points in the chart will be colored according to the corresponding value in the table. Other types of R outputs (e.g., Regression, Machine learning) can potentially also be used (the values associated with these R outputs are the same as the ones given by exporting to Excel).
Opacity determines whether the data series is transparent (0.0) or opaque (1.0). In some cases, the default setting may not be visible in the control, so you may have to click on the arrows to set the opacity to 0.
Trend Lines
A line of best fit can be drawn through each series in the chart. The type of line constructed can be one of:
- Linear A linear regression is applied to each series
- LOESS A smooth curve is estimated using local polynomial regression (degree = 2) with tricubic weights. The span (proportion of points used) is set to 0.75, which is fairly wide.
- Friedman's super smoother A smooth curve is estimated using local regression. The span is determined by cross-validation, so this smoother is usually more appropriate than LOESS if there is a large amount of local variation but it is less smooth.
- Cubic spline A smooth curve is estimated using a cubic spline, estimated using the conventional integrated square second derivative cubic spline penalty with knots spread evenly through the covariate values. It is implemented using mgcv::gam with bs = "cr".
- Moving average A smooth curve is estimated by taking the moving average. When the window size is h, the estimated value at i is the average if the data series at (i - (h-1)) to i.
- Centered moving average Uses a centered window instead. So the estimated value at i is the average if the data series at (i - ceiling((h-1)/2)) to (i + floor((h-1)/2)).
Options to customize the trend line:
- Show 95% confidence interval For Linear, LOESS, and Cubic spline smoothers, 95% confidence interval about the trend line can be added to the chart.
- Ignore last data point Whether to ignore the last data point when fitting the trend line. For example, for time series when the data for the last period is incomplete.
- Line type The trend line can be drawn as a solid, dotted, or dashed line.
- Line width The width of thickness of the line.
- Fit line color palette The default option is Group colors which means that the line of best fit for each series is shown in the same color as the data series. However, the trend lines can be customized with any color palette in the same way as the data series.
Font
Default formatting options for fonts. They are overridden by the formatting options of specific text elements.
Use default or template settings If selected, an Arial font in #2C2C2C will be used unless a visualization template is present in the document. Unselect the checkbox to customize fonts for the chart. These settings can be overridden at any level (e.g., the global fonts can follow the defaults, and data label fonts can be customized).
Global font family Default font family of all text on the chart.
Global font color Default font color of all text on the chart (not including tooltips shown on hover). This option is available for all visualization charts except Venn (data labels take on the data series colors).
Font units This can be set to pt (points) or px (pixels). By default, font sizes are specified in pt, which is consistent with font sizes specified in text boxes. However, older visualizations that do not offer this option use px. It is occasionally more convenient to use px because the dimensions of other outputs are frequently specified in pixels.
Annotation
This group of controls is available in some, but not all, visualization types. They are an alternative to Annotations available in the Data Labels group so that annotations can be positioned separately from data labels. For column charts, in particular, this group of controls provides options for more flexible positioning. Multiple annotations can be added.
Type of annotation to add, this can be one of:
- Arrow - up or Arrow - down When Data is set to "Column Comparisons", then the arrows will be appended with the column letter.
- Caret - up or Caret - down can be used as an alternative to arrows. In particular, the caret symbol will be shown properly even if the Symbola font is not available (arrows may appear as empty rectangles).
- Text can be shown next to the data points, consisting of the annotation data. For numeric annotation data, a D3 format can be specified to customize the annotation.
- Custom text can be specified by the user next to data points where the annotation data satisfies the threshold conditions.
Data The name of the data to be used for this annotation. For example, to add circles to the data labels of values with a significant p-value. The name can generally be seen in the top-left corner of the data table (e.g. 'Column %', 'p', 'Standard error').
Threshold Enter a threshold value to select values to annotate. If data is numeric, setting the threshold to -Inf or Inf will select all (non-missing) values. If the annotation data is text, then string comparisons (alphabetical ordering) will be used instead.
Position relative to value Specifies the position of the annotation on the values axis. A value of 0 corresponds to the base of the bar, whereas a value of 1.0 indicates the top of the bar.
Horizontal/Vertical alignment Specifies how the annotation is aligned relative to the data point.
Offset specifies the displacement of the annotation relative to the data point in units of pixels. The direction of the displacement is determined by the horizontal and vertical alignment.
Data Labels
Options for controlling the appearance of any data values to be plotted, including number formatting.
Show data labels Whether or not to show data labels.
Data label font family Font family used to show data labels.
Color data labels
- Automatically For Stacked and Pyramid charts, data labels will be shown in black or white depending on the darkness of the series color. Note that in Stacked Area charts, the data labels for the last series are outside the shaded area so it is shown in the Global font color. The background color of the chart is not used because it is transparent and the slide background could be black or white. In Scatter and Line charts, Automatically colored data labels means that the labels will be shown in the same color as the markers.
- In a single color A color picker is provided for selecting the data label font color.
- In different colors for each series This option is only offered for Area, Bar, Column, Line, Pyramid, Radar charts. Users can provide a comma-separated list of colors (in hex code). If the number of colors is smaller than the number of series then the colors will be recycled.
Data label font size Font size of the data labels.
Number type By default this will be automatically selected depending on the data, but users can manually set this to Number or Percentage. If Percentage is chosen, the input value will be multiplied by 100 and a % sign will be added. If the multiplication by 100 is not appropriate, then use the Custom suffix instead.
Decimal places Number of decimal places to show in the data labels.
Custom prefix Optional text to prepend to the data label.
Custom suffix Optional text to append to the data label.
For Column, Bar and Line, Radar, and Scatter charts, additional annotations can be added to the data labels. Multiple annotations can be added to the chart.
- Annotation The type of annotation to add. This can be Arrow - up, Arrow - down, Border, Caret - up, Caret - down, Hide, Shadow, Text - after data label, or Text - before data label. For Bar and Column charts, there are also additional annotation types: Circle - filled, Circle - thick outline, Circle - thin outline.
- Data The name of the data to be used for this annotation. For example, to add circles to the data labels of values with a significant p-value. The name can generally be seen in the top-left corner of the data table (e.g. 'Column %', 'p', 'Standard error'). When no statistic name is supplied, the chart data will be used.
- Threshold Enter a threshold value to select values to annotate. If data is numeric, setting the threshold to -Inf or Inf will select all (non-missing) values. If the annotation data is text, then string comparisons (alphabetical ordering) will be used instead.
Legend
Show legend Depending on the chart type and the version of the chart this is either a checkbox or a drop-down menu. If the checkbox is ticked, the legend will be shown if there is more than one data series in the chart. In the newer versions of the chart, most chart types allow the users to choose between Automatic, Show, and Hide. Automatic has the same behavior as the ticked checkbox does, but setting the control to Show will always show the legend even if there is only one data series.
Use default or template fonts When ticked, default fonts according to the page master will be used, or template fonts from the specified visualization template.
Legend orientation Position legend items beneath one another (vertical) or next to one another (horizontal). Note that with horizontal positioning, legend items will be placed beneath the previous ones if the width of the chart is not large enough.
Wrap legend When ticked, the legend is wrapped according to the following settings:
- Legend width (in characters) Specify the width of the legend before wrapping begins.
Horizontal/Vertical placement The values used in these fields are akin to how native R places things on plots. Each axis is measured 0-1 where 1 = 100%. To position slightly to the right of the actual plot, you'd use something that's slightly over 100% - say 102% so 1.02. Legends are left justified so the horizontal number is for the left bounds of the legend. When moving a legend to the left of the plot, you can't use something slightly less than 0, you need to allow for more room for the actual legend text. This is where you could change horizontal to -1.02 or whatever negative value you need to be able to show the full legend. See the diagram below for a visual of the values that are needed for different placements:
Show bubble legend has the same customizations above but for the legend for bubble charts.
Title
Options for setting and formatting a Title, Subtitle, and Footer. Not all chart types have all these options.
Title Set the title of the visualization.
Font size, family, color, and alignment can be set individually for the title, subtitle, and footer.
Wrap footer When checked, the footer is wrapped based on the number indicated in Footer width (in characters).
Categories (X/Y) Axis and Values (X/Y) Axis
Options for controlling the appearance of the horizontal and vertical axes, including number formatting.
The x-axis refers to the horizontal axis and the y-axis refers to the vertical axis. The specific meaning of these axes changes depending on chart type (e.g., for a bar chart the x-axis shows values, whereas for a column chart, it shows categories).
Maximum or minimum value Where available, these controls allow users to specify the range shown on the chart. If the axis is numeric, a numeric value (without prefix or suffix) should be added; if the axis is a date, then a date string should be entered. If the axis is categorical, then a 0-based index can be used (i.e. setting the Minimum value to -0.5 will add extra space before the first category).
Maximum number of ticks Specify an upper limit on the number of ticks shown on the axis. The actual number of ticks may be smaller than this limit. Note that this does not affect categorical axes, which always try to show all labels.
Grid line width Width of grid lines in pixels. By default, the grid lines on the categories axis is set to 0 to hide the grid lines.
Grid line color Color of the grid line if the grid line width is greater than 0.
Axis line width Width of axis line, i.e. a line drawn a the edge of the chart showing tick marks. By default, this is set to 0 to hide the axis line.
Show axis labels When ticked, you can control the font size, family, color, and orientation of the axis labels.
Axis number type Determines whether the scale of the axis is continuous (spaces data out on a Number line or leaves space for missing Date/Time values) or discrete (Category treats labels as categories and shows all labels in the input table). The default is Automatic or the visualization to figure it out. If you are working with a Date/Time variable, you can also use Custom to specify the date format you'd like using syntax under Details here.
You can also control the Decimal places, Custom suffix, and Custom prefix.
Wrap axis label When ticked, the axis label will be wrapped based on the number entered in Axis label width (in characters).
Hover
Formatting of any hover text used in the charts. Options to control the hover text are not available in Bar Pictographs.
Font family Font family for hover text. This usually defaults to the Global font family.
Font size Size of the hover text in either pixels or points (depending on font units). This is not available for the time series charts.
Font color This option is only available for stream and time series charts. This is because the hover text in these two charts appears directly on the chart background (with no text box).
Margins
Customize margins By default, many of the charts have automatically set margin sizes. After selecting this option, other controls will be shown to set the size of the left, right, top, and bottom margins (in pixels) and whether or not to automatically expand margins.
Automatically expand margins When this option is selected, margins may be automatically expanded larger than the size set by the user to accommodate text in the axes and legend. This option is useful when the length of the labels may change and you want to specify the minimum size of the margin. However, if the chart is designed to line up with another visual element on the page, it is better to leave this unchecked. This option is only available on charts implemented using plotly.
Background
Transparent background By default all of the visualization outputs have a transparent background. For most of the charts, the background setting can be changed if this box is unchecked.
Background color Color of the chart background.
Background opacity Alpha transparency of the chart background, which should be a number between 0 (transparent) and 1 (opaque).