This article describes how to create a template for setting colors and font styles for R-based visualizations without the need to manually create or copy and paste your visualizations to retain these settings. You can specify appearance settings (such as color palettes and font settings) and these get applied automatically to any visualization you hook up to the template.
If you instead wish to create a template of customized settings for a particular visualization beyond colors and font styles, see How to Create and Apply a Visualization Template.
Requirements
Method
- From the toolbar, go to Anything > Visualization > Template. This will then give you a preview of all the color, chart, and number font styles that you can set for your visualizations.
To define your color palette:
- Select the visualization template output on your page, and from the object inspector, go to Data > Color Palette > Color palette, and select Custom palette.
- Enter the hex values of the desired colors, e.g., #5C9AD3 (blue) and #ED7D31 (orange).
- Alternatively, if you select Data > Color Palette > Color palette > Custom gradient, it allows you to transition from one color to another by setting the start and end colors. You also have more advanced options for specifying hex and RGB values under the color picker's More Colors option.
-
A further custom color setting is Named colors. This is designed for when you want to use defined colors for specifically named items in your visualization, e.g., a brand list.
To use this setting, you should do the following:
- Set the Default color for unnamed values.
- Change the Specify colors using the drop-down, if necessary.
- Enter the name of the first item you want to color in the 'Color name 1' field.
- Select the color using the 'Color 1' color picker.
- Repeat for 'Color name 2' and so on until you have defined all items.
Setting your chart and number fonts
On the Chart fonts tab in the object inspector, you can set global font styles or make changes specific to various chart labels, such as data labels, legends, and X and Y axis titles.
- Update the global font size by updating the number in Chart fonts > Global Font > Font size.
- Update the font style by selecting the Global font family from Chart fonts > Global Font.
- Update the font color by selecting a color from Global font color under Chart fonts > Global Font.
- OPTIONAL: You can make changes specific to various chart labels, such as data labels, legends, and X and Y axis titles by making updates in the corresponding sections in Chart fonts.
You can make these same changes in the Number fonts tab in the object inspector as well.
Using the visualization template
- Create a new visualization (Anything > Visualization) or select an existing one on your page.
- In the object inspector, under Chart > Appearance> Use template, select your template.
- Under Data Series > Color palette ensure Default or template settings is selected.
Once calculated, your visualization will now apply the color and font settings from your template.
The appearance of the visualization will keep up-to-date with any changes you make to the template (provided you have set everything to Calculate automatically calculations).
This functionality also allows you to create multiple templates. It's just a matter of linking the appropriate template to your visualization. Furthermore, any update to your template settings will flow through to all visualizations that use this template.
Example
In the following example, a template is created and then applied to an area chart visualization.
A template is altered as per the following, using the various COLOR and FONT option tabs. In particular, the Named Colors option was used to match brand names to a specific color.
The default visualization template looks like so:
And was changed to add the brand names and specific colors as well as modify some of the default chart and number font styles:
Then for the following area visualization (small multiples):
Go to the visualization's Object Inspector > Chart options, and in the Use template dropdown select the name of the visualization template > template.
Resulting in this automatic change to the appearance:
Options
Data
Color palette This can be one of the standard palettes, or you can create a palette using Named colors: the color of each data series is associated with the name of the data series. The color of missing values with no associated name is specified by Default color. Note that this palette is only used in charts where the color palette dropdown is set to Default or template settings.
Chart fonts
These fonts are used in most visualizations (all of them except the ones that are controlled by Number fonts). Note that only the relevant text components for each chart type will be applied to a visualization.
Number fonts
These fonts are used when the template is used in Number in Oval, Number in Rectangle, Number in Donut, Number in Gauge, Number in Bar, Pictograph - Single Icon, Pictograph - Repeated Icons and Use default or template font settings is selected.