Adjusting the figure settings
tweak-fig-settings.RmdThe figure_settings.yaml file contains various settings
for the figures included in the report. In most cases the defaults
should be fine — they have emerged through making adjustments over many
reports. But sometimes a data point might be obscured by the legend, or
the range of data changes enough that the axis limits need adjusting.
Settings you can change are the axis titles, axis limits, legend
position, and plot size. There are also some entries that you should not
change: the list of indicator variants, and the plot type.
Note that this only applies to the figures in the main report. I have not set up the system to allow changes to the longitudinal graphs in the supplement reports.
The basic entry for an indicator looks like this:
antipsychotics:
variants:
- overall
- dementia
- "no dementia"
ylabel: "Antipsychotic use (%)"
xlabel: "Number of residents"
xlimits: [.na, .na]
ylimits: [.na, .na]
legend_position: "inside"
legend_position_inside: [0.85, 0.85]
width: 3
height: 2.2
plot_type: funnel
Note that the indentation is important and should not be changed.
The entry starts with a list of the variants for this indicator. This should not be changed.
xlabel and ylabel should not normally be
changed.
xlimits and ylimits set the axis limits.
.na means let R choose the limits based on the values in
the data. Normally this gives a good result, but you are free to try
other values for specific figures.
legend_position should normally be left as “inside”. If
you change it to “none” the legend will be removed. Other options are
“top”, “bottom”, “right” or “left”, but don’t use them as they will
steal space from the actual plot area.
legend_position_inside gives the coordinates of the
legend within the plot area. (0, 0) is the bottom left corner of the
plot, and (1, 1) is the top right corner.
width and height set the size of the
figures on the page. These values are in inches. You might need to
adjust them if an indicator is not fitting on one page.
There is also axis_breaks_y for caterpillar plots only
(but I expect to add it for funnel plots). This sets the tick marks on
the y axis.
plot_type specifies whether we are creating a
caterpillar plot or a funnel plot. You can change it, but results may be
strange if the data processing doesn’t match.
Variant-specific settings
The main settings apply to the figures for all variants of the indicator. It is also possible to change settings just for one variant, by creating an entry for that variant.
antipsychotics:
variants:
- overall
- dementia
- "no dementia"
ylabel: "Antipsychotic use (%)"
xlabel: "Number of residents"
xlimits: [.na, .na]
ylimits: [.na, .na]
legend_position: "inside"
legend_position_inside: [0.85, 0.85]
width: 3
height: 2.2
plot_type: funnel
"no dementia":
ylimits: [.na, 60]
dementia:
legend_position_inside: [0.85, 0.75]
In the example above, the main setting for ylimits ([.na, .na]) will be used for the overall figure and the dementia figure, but for the no dementia figure, the maximum y limit will be set at 60.
Similarly, the legend will be at (0.85, 0.85) for the overall and no dementia figures, but will be at (0.85, 0.75) for the dementia figure.