This article describes the basics of how to create and modify visualizations. It describes ways to create visualizations and the main ways of modifying visualizations.
The typical ways to create a new visualization are to:
- Convert data into visualizations
- Select data and then insert a separate visualization
- Create an empty visualization and hook the data up
- Duplicate an existing visualization and change the chart type
- Duplicate an existing visualization and change the data source
- Write code in Calculations
Once you've created a visualization, there are a number of ways to modify it:
And, finally, some notes about using variables as the direct input for visualizations.
Creating visualizations
Convert data into visualizations
The quickest way to create a visualization is to turn a table directly into one. To do so, select a table or a Calculation output, and from the object inspector , click the Visualization button to access the selector menu. This will then nest the table within the visualization, but you can toggle back to see the table using the object inspector > Table button. To unnest the table while keeping the visualization, you can expand the visualization item in the Report tree and drag the table item underneath to a different page or a different position in the tree.
If on a Page, it is also possible to select variable sets directly in the Data Sources menu and then go to Visualization in the toolbar. This will automatically create a summary table of the variable and nest it within the visualization.
Select data and then insert a separate visualization
If you want to still see the input data along with the visualization, or if you plan on duplicating and/or modifying the data for the visualization later, you can create a visualization output that is separate from your table. Select the data, and either from the toolbar or the Report tree hover > + menu select Visualization . This will both create the visualization and link it to the selected data. This can be done for tables, Calculations, and ranges of cells selected on tables (this will be converted to an in-line calculation referencing those cells).
Create an empty visualization and hook the data up
Similar to above, you can create a separate visualization output from your data and hook up data to it later. To insert a blank visualization, select Visualization from either the toolbar or the Report tree hover > + menu. Then you can select your data later on in the object inspector
> Data > Data Source section. You can use a wide range of objects in Displayr here, which will be listed in a drop-down, but the most efficient method is to use a table in the Data dropdown. While it is possible to use variables as inputs, you should only do so if the visualization requires it, such as those plotting distributions like box plots. More details about the caveats of using variables in visualizations are in the notes below.
You can also write an in-line calculation directly by selecting Enter a calculation or value (see Method 4 in How to Plot a Subset of a Table on a Visualization Using Point and Click or R Code).
Duplicate a visualization and change the chart type
Once a table has been converted to a visualization, you duplicate the visualization and press the Visualization button in the object inspector to change the visualization.
Duplicate a visualization and change the data source
You can also Duplicate a visualization and then modify its Data Source in the object inspector . If you created the visualization by hooking it up to data, this is straightforward. If a table was converted into a visualization, this is a bit more nuanced (see Changing the data source).
Create visualizations via code in Calculations
There are an infinite number of simple and advanced visualizations that can be created using R code in a Calculation > Custom Code output. For example:
Modify a visualization
You can modify the data source, using a rule, and customize the appearance of the visualization (fonts, colors, labels, axes, etc) using the Chart tab in the object inspector .
Change the data source
The data used in the visualization is shown in Data > Data Source in the object inspector . If you manually hook the visualization up to data, you will see the data you selected. However, if you instead convert a table to a visualization, the name of the table will appear. You can either modify the data source by changing the selection in Data Source > Data or by modifying the underlying table.
To modify the underlying table of the visualization, you need to hover over the table reference in the Data tab of the object inspector and follow the link. The object inspector will then change, showing the underlying data. You can modify this underlying data, and the visualization will update. This is shown in the recording below.
Change the appearance of a visualization
When a visualization is selected, you can modify its properties (i.e., fonts, colors, axes, labels, etc) in the Chart tab of the object inspector . For some visualizations, you can click on regions of the visualization itself, and the relevant controls will be selected. For others, using menu search (illustrated in Easily Perform Advanced Analysis) is the best way to find options.
Apply a rule
Rules can be used to format the data and the appearance of visualizations. They are discussed in more detail in How to Use Rules in Displayr.
Notes
While you can use a variable as the Data > Data Source in the object inspector as described above:
There are some trade-offs, including:
- By default, the statistic shown in the visualization will be Count, rather than a percentage. You won't be able to convert to percentages/proportions and get accurate results. If you want to show percentages as the results, you will need to use the legacy "with Tests" visualization types.
- These inputs reduce performance (load times) for visualizations.
- Any data reduction performed on the variable, such as combining categories, hiding categories, and renaming rows/columns, will not carry through to the visualization.
- Statistical testing cannot be performed on the visualization unless you are using the legacy "with Tests" visualization types.
The most efficient way to create a visualization is to use a table as input via the object inspector, as described above.
UPCOMING WEBINAR: The Roadmap for Market Researchers in the Age of AI