General purpose convenience visualization function. Simply add other ggplot components after calling this function to customize more (e.g. with facet_wrap or theme calls). Make sure to specify lines = TRUE and/or points = TRUE to add the lines/points respectively. Accepts multiple y variables in which case they are plotted in a facet_wrap with new variables panel holding the name of the y variable panels, y_value holding the values and y_error holding the error values (if y_error is supplied). Also always generates a new column called variable that holds the variable names (y) supplied to this function.

iso_plot_data(dt, x, y, ..., y_error = NULL, group = NULL,
  color = NULL, fill = NULL, shape = NULL, size = 4,
  linetype = NULL, alpha = NULL, label = NULL, panel = panel ~ .,
  panel_scales = "free_y", lines = FALSE, points = FALSE,
  date_breaks = NULL, date_labels = "%d %b %H:%M")

Arguments

dt

data frame to plot data from

x

the column for the x-axis aesthetic. Can be a numeric, text or datetime column (text and datetime column labels will be automatically rotated by 90 degrees). For clarity of the plot, only single variables are allowed. Use named vector with c(new_x = x) to rename the x variable on the fly. By default will show units in the axis names if there are any. If a datetime column is provided for x, parameters date_breaks (example: date_breaks = "2 hours") and date_labels can be set to fine-tune the x-axis appearance. See scale_date for additional details. Note that x can also be x = NULL for single data point plots - in this case the x axis is completely omitted.

y

which columns to visualize. Combine with c(y1, y2) to show multiple variables in a facet_wrap. Use named vector with c(new_y1 = y1) to rename variables on the fly. By default will show units in the axis names if there are any.

...

additional ggplot objects (e.g. geom_smooth()) that should be added to the plot PRIOR to the automatically generated layers for error bars, points and lines. Notet that to add geoms on top, please use regular iso_plot_data() + geom_smooth() + ... syntax instead.

y_error

an error column for drawing y error bars - if multiple y are provided, error needs to point to the same number of columns

group

what to group by, multiple columns allowed (combine with paste(...)), usually not necessary if groupings are fully defined through other aesthetics

color

variable to use for color aesthetic for the plot

fill

variable to use for the fill aesthetic of the plot

shape

variable to use for shape aesthetic for the plot

size

variable to use for size aesthetic for the plot or constant value for the points size

linetype

variable to use for linetype aesthetic for the plot

alpha

variable to use for the opacity aesthetic for the plot (1 = 100% opaque, 0 = completely transparent)

label

this is primarily of use for turning the generated ggplots into interactive plots via ggplotly as the label will be rendered as an additional mousover label.

panel

whether to panel the data by anything. If using a single parameter (e.g. panel = panel), will generate a facet_wrap. If using a formula (e.g. panel = panel ~ . or panel = file_id ~ panel), will generate a facet_grid. The default for this parameter is to panel via facet grid by the y variable name but only if multiple y columns are provided. Otherwise will not generate any facets. If additional facet parameters are desired, please leave use facet_wrap and facet_grid diretly.

panel_scales

the scales parameter for the facets (if any are used)

lines

whether to plot lines (FALSE by default)

points

whether to plot points (FALSE by default)

date_breaks

what breaks to use for the x axis if it is a datetime

date_labels

datetime label pattern for x axis if it is a datetime

See also