Creates a configuration list for plot styling that can be used with GTAPViz plotting functions. This function provides auto-completion for style options while maintaining compatibility with direct list specification.
create_plot_style(
show_title = TRUE,
title_face = "bold",
title_size = 20,
title_hjust = 0.5,
add_unit_to_title = TRUE,
title_margin = c(10, 0, 10, 0),
title_format = list(type = "standard", text = "", sep = ""),
show_x_axis_title = TRUE,
x_axis_title_face = "bold",
x_axis_title_size = 16,
x_axis_title_margin = c(25, 25, 0, 0),
show_x_axis_labels = TRUE,
x_axis_text_face = "plain",
x_axis_text_size = 14,
x_axis_text_angle = 0,
x_axis_text_hjust = 0,
x_axis_description = "",
show_y_axis_title = TRUE,
y_axis_title_face = "bold",
y_axis_title_size = 16,
y_axis_title_margin = c(25, 25, 0, 0),
show_y_axis_labels = TRUE,
y_axis_text_face = "plain",
y_axis_text_size = 14,
y_axis_text_angle = 0,
y_axis_text_hjust = 0,
y_axis_description = "",
show_axis_titles_on_all_facets = TRUE,
show_value_labels = TRUE,
value_label_face = "plain",
value_label_size = 5,
value_label_position = "above",
value_label_decimal_places = 2,
show_legend = FALSE,
show_legend_title = FALSE,
legend_position = "bottom",
legend_title_face = "bold",
legend_text_face = "plain",
legend_text_size = 14,
strip_face = "bold",
strip_text_size = 16,
strip_background = "lightgrey",
strip_text_margin = c(10, 0, 10, 0),
panel_spacing = 2,
panel_rows = NULL,
panel_cols = NULL,
theme = NULL,
color_tone = NULL,
color_palette_type = "qualitative",
positive_color = "#2E8B57",
negative_color = "#CD5C5C",
background_color = "white",
grid_color = "grey90",
show_grid_major_x = FALSE,
show_grid_major_y = FALSE,
show_grid_minor_x = FALSE,
show_grid_minor_y = FALSE,
show_zero_line = TRUE,
zero_line_type = "dashed",
zero_line_color = "black",
zero_line_size = 0.5,
zero_line_position = 0,
bar_width = 0.9,
bar_spacing = 0.9,
scale_limit = NULL,
scale_increment = NULL,
expansion_y_mult = c(0.05, 0.1),
expansion_x_mult = c(0.05, 0.05),
all_font_size = 1,
sort_data_by_value = FALSE,
plot.margin = c(10, 25, 10, 10)
)
A list containing all plot style configuration parameters
Logical. Show or hide the plot title. Default: TRUE
Character. Font face ("bold", "plain", "italic"). Default: "bold"
Numeric. Font size of title. Default: 20
Numeric. Horizontal alignment (0 = left, 1 = right). Default: 0.5
Logical. Append unit to title if applicable. Default: TRUE
Numeric vector c(top, right, bottom, left). Default: c(10, 0, 10, 0)
List or function output. Title formatting options. Can be created with
create_title_format()
. Default: list(type = "standard", text = "", sep = "")
Logical. Show or hide x-axis title. Default: TRUE
Character. Font face for x-axis title. Default: "bold"
Numeric. Font size of x-axis title. Default: 16
Numeric vector c(top, right, bottom, left). Default: c(25, 25, 0, 0)
Logical. Show or hide x-axis labels. Default: TRUE
Character. Font face for x-axis labels. Default: "plain"
Numeric. Font size of x-axis labels. Default: 14
Numeric. Angle of x-axis labels. Default: 0
Numeric. Horizontal justification of x-axis labels. Default: 0
Character. Optional description for the x-axis. Default: ""
Logical. Show or hide y-axis title. Default: TRUE
Character. Font face for y-axis title. Default: "bold"
Numeric. Font size of y-axis title. Default: 16
Numeric vector c(top, right, bottom, left). Default: c(25, 25, 0, 0)
Logical. Show or hide y-axis labels. Default: TRUE
Character. Font face for y-axis labels. Default: "plain"
Numeric. Font size of y-axis labels. Default: 14
Numeric. Angle of y-axis labels. Default: 0
Numeric. Horizontal justification of y-axis labels. Default: 0
Character. Optional description for the y-axis. Default: ""
Logical. Show axis titles on all facets. Default: TRUE
Logical. Show or hide value labels. Default: TRUE
Character. Font face for value labels. Default: "plain"
Numeric. Font size of value labels. Default: 5
Character. Position of value labels ("above", "outside", "top"). Default: "above"
Numeric. Number of decimal places in value labels. Default: 2
Logical. Show or hide legend. Default: FALSE
Logical. Show or hide legend title. Default: FALSE
Character. Legend position ("none", "bottom", "right"). Default: "bottom"
Character. Font face for legend title. Default: "bold"
Character. Font face for legend text. Default: "plain"
Numeric. Font size of legend text. Default: 14
Character. Font face for panel strip. Default: "bold"
Numeric. Font size for panel strip. Default: 16
Character. Background color of strip. Default: "lightgrey"
Numeric vector c(top, right, bottom, left). Default: c(10, 0, 10, 0)
Numeric. Spacing between panels. Default: 2
Numeric or NULL. Number of rows in panel layout. Default: NULL
Numeric or NULL. Number of columns in panel layout. Default: NULL
ggplot2 theme or NULL. Custom ggplot theme. Default: NULL
Character or NULL. Base color theme. Default: NULL
Character. Type of color palette ('qualitative', 'sequential', 'diverging'). Default: "qualitative"
Character. Color for positive values. Default: "#2E8B57"
Character. Color for negative values. Default: "#CD5C5C"
Character. Background color of plot. Default: "white"
Character. Color of grid lines. Default: "grey90"
Logical. Show major grid lines on x-axis. Default: FALSE
Logical. Show major grid lines on y-axis. Default: FALSE
Logical. Show minor grid lines on x-axis. Default: FALSE
Logical. Show minor grid lines on y-axis. Default: FALSE
Logical. Show or hide zero line. Default: TRUE
Character. Line type ("solid", "dashed", "dotted"). Default: "dashed"
Character. Color of zero line. Default: "black"
Numeric. Line thickness of zero line. Default: 0.5
Numeric. Position of the zero line. Default: 0
Numeric. Width of bars. Default: 0.9
Numeric. Spacing between groups of bars. Default: 0.9
Numeric vector of length 2 or NULL. Manual limits for value axis. Default: NULL
Numeric or NULL. Step size for axis tick marks. Default: NULL
Numeric vector. Y-axis expansion. Default: c(0.05, 0.1)
Numeric vector. X-axis expansion. Default: c(0.05, 0.05)
Numeric. Master control for all font sizes. Default: 1
Logical. Whether to sort data by value. Default: FALSE
Numeric vector c(top, right, bottom, left). Margins around the entire plot. Default: c(10, 25, 10, 10)
Pattawee Puangchit
# Create customized style with title formatting
custom_style <- create_plot_style(
color_tone = "gtap",
title_size = 24,
title_format = create_title_format(
type = "prefix",
text = "Impact on",
sep = "-"
),
bar_width = 0.5,
x_axis_text_angle = 45
)
Run the code above in your browser using DataLab