Gadfly

Gadfly.ThemeType
  • default_color: If the color aesthetic is not mapped to anything, this is the color that is used. (Color)

  • point_size: Size of points in the point, boxplot, and beeswarm geometries. (Measure)

  • point_size_min: Minimum size of points in the point geometry. (Measure)

  • point_size_max: Maximum size of points in the point geometry. (Measure)

  • discrete_sizemap: The function f in Scale.size_discrete2.

  • continuous_sizemap: The function f in Scale.size_radius and Scale.size_area.

  • discrete_colormap: A new Theme field, in development. Currently only works with Guide.manual_discrete_key and Guide.manual_color_key. (Function)

  • point_shapes: Shapes of points in the point geometry. (Function in circle, square, diamond, cross, xcross, utriangle, dtriangle, star1, star2, hexagon, octagon, hline, vline, ltriangle, rtriangle)

  • line_width: Width of lines in the line geometry. (Measure)

  • line_style: Style of lines in the line geometry. The default palette is [:solid, :dash, :dot, :dashdot, :dashdotdot, :ldash, :ldashdash, :ldashdot, :ldashdashdot] which is a Vector{Symbol}, or customize using Vector{Vector{<:Measure}}

  • alphas: Alpha palette. The default palette is [1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.0]. Customize using a Vector of length one or greater, with 0.0≤values≤1.0

  • panel_fill: Background color used in the main plot panel. (Color or Nothing)

  • panel_stroke: Border color of the main plot panel. (Color or Nothing)

  • panel_line_width: Border line width for main plot panel. (Measure)

  • panel_opacity: Opacity of the plot background panel. (Float in [0.0, 1.0])

  • background_color: Background color for the entire plot. If nothing, no background. (Color or Nothing)

  • plot_padding: Padding around the plot. The order of padding is: plot_padding=[left, right, top, bottom]. If a vector of length one is provided e.g. [5mm] then that value is applied to all sides. Absolute or relative units can be used. (Vector{<:Measure})

  • grid_color: Color of grid lines. (Color or Nothing)

  • grid_line_style: Style of grid lines. (Symbol in :solid, :dash, :dot, :dashdot, :dashdotdot, or Vector of Measures)

  • grid_color_focused: In the D3 backend, mousing over the plot makes the grid lines emphasised by transitioning to this color. (Color or Nothing)

  • grid_line_width: Width of grid lines. (Measure)

  • grid_line_order: Context order of the grid lines (default=0). The plot panel background has a context order of -1. (Int)

  • minor_label_font: Font used for minor labels such as tick labels and entries in keys. (String)

  • minor_label_font_size: Font size used for minor labels. (Measure)

  • minor_label_color: Color used for minor labels. (Color)

  • major_label_font: Font used for major labels such as guide titles and axis labels. (String)

  • major_label_font_size: Font size used for major labels. (Measure)

  • major_label_color: Color used for major labels. (Color)

  • point_label_font: Font used for labels in Geom.label. (String)

  • point_label_font_size: Font size used for labels. (Measure)

  • point_label_color: Color used for labels. (Color)

  • key_title_font: Font used for titles of keys. (String)

  • key_title_font_size: Font size used for key titles. (Measure)

  • key_title_color: Color used for key titles. (Color)

  • key_label_font: Font used for key entry labels. (String)

  • key_label_font_size: Font size used for key entry labels. (Measure)

  • key_label_color: Color used for key entry labels. (Color)

  • key_color_gradations: How many gradations to show in a continuous color key. (Int)

  • bar_spacing: Spacing between bars in Geom.bar. (Measure)

  • boxplot_spacing: Spacing between boxplots in Geom.boxplot. (Measure)

  • errorbar_cap_length: Length of caps on error bars. (Measure)

  • stroke_color

  • highlight_width: Width of lines drawn around plot geometry like points, and boxplot rectangles. (Measure)

  • discrete_highlight_color: Color used to outline plot geometry. This is a function that alters (e.g. darkens) the fill color of the geometry. (Function)

  • continuous_highlight_color: Color used to outline plot geometry. This is a function that alters (e.g. darkens) the fill color of the geometry. (Function)

  • lowlight_color: Color used to draw background geometry, such as Geom.ribbon and Geom.polygon. This is a function that alters the fill color of the geometry. (Function)

  • middle_color: Color altering function used to draw the midline in boxplots. (Function)

  • middle_width: Width of the middle line in boxplots. (Measure)

  • guide_title_position: One of :left, :center, :right indicating the placement of the title of color key guides. (Symbol)

  • colorkey_swatch_shape: The shape used in color swatches in the color key guide. Either :circle or :square (Symbol)

  • key_swatch_shape: Shape used in keys for swatches (Function as in point_shapes)

  • key_swatch_color: Default color used in keys for swatches. Currently works for Guide.shapekey and Guide.sizekey (Color)

  • key_swatch_size: Size of key swatches, will override Theme(point_size=). Currently works for Guide.shapekey (Measure)

  • key_position: Where key should be placed relative to the plot panel. One of :left, :right, :top, :bottom, :inside or :none. Setting to :none disables the key. Setting to :inside places the key in the lower right quadrant of the plot. (Symbol)

  • bar_highlight: Color used to stroke bars in bar plots. If a function is given, it's used to transform the fill color of the bars to obtain a stroke color. (Function, Color, or Nothing)

  • rug_size

  • label_placement_iterations: Number of annealing iterations. Used by Geom.label(position=:dynamic)

  • label_out_of_bounds_penalty: Penalty for a label not being contained within the plot frame. Used by Geom.label(position=:dynamic)

  • label_hidden_penalty: Penalty for making a label hidden to avoid overlaps. Used by Geom.label(position=:dynamic)

  • label_visibility_flip_pr: Probability of proposing a visibility flip during label layout. Used by Geom.label(position=:dynamic)

  • label_padding: Padding between marker and label. Used by Geom.label(position=:dynamic)

  • key_max_columns: Maximum number of columns for key entry labels. (Int)

  • discrete_color_scale: A DiscreteColorScale see Scale.color_discrete_hue

  • continuous_color_scale: A ContinuousColorScale see Scale.color_continuous

source
Base.Multimedia.displayMethod
display(p::Plot)

Render p to a multimedia display, typically an internet browser. This function is handy when rendering by plot has been suppressed with either trailing semi-colon or by calling it within a function.

source
Base.push!Method
push!(p::Plot, element::ElementOrFunctionsOrLayers)

Add an element, function or layer to a plot. Elements include Coordinates, Geometries, Guides, Scales, Statistics, and Themes.

source
Compose.drawMethod
draw(backend::Compose.Backend, p::Plot)

A convenience version of Compose.draw without having to call render.

source
Compose.gridstackMethod
gridstack(ps::Matrix{Union{Plot,Context}})

Arrange plots into a rectangular array. Use context() as a placeholder for an empty panel. Heterogeneous matrices must be typed. See also hstack and vstack.

Examples

p1 = plot(x=[1,2], y=[3,4], Geom.line);
p2 = Compose.context();
gridstack([p1 p1; p1 p1])
gridstack(Union{Plot,Compose.Context}[p1 p2; p2 p1])
source
Compose.hstackMethod
hstack(ps::Union{Plot,Context}...)
hstack(ps::Vector)

Arrange plots into a horizontal row. Use context() as a placeholder for an empty panel. Heterogeneous vectors must be typed. See also vstack, gridstack, and Geom.subplot_grid.

Examples

p1 = plot(x=[1,2], y=[3,4], Geom.line);
p2 = Compose.context();
hstack(p1, p2)
hstack(Union{Plot,Compose.Context}[p1, p2])
source
Compose.vstackMethod
vstack(ps::Union{Plot,Context}...)
vstack(ps::Vector)

Arrange plots into a vertical column. Use context() as a placeholder for an empty panel. Heterogeneous vectors must be typed. See also hstack, gridstack, and Geom.subplot_grid.

Examples

p1 = plot(x=[1,2], y=[3,4], Geom.line);
p2 = Compose.context();
vstack(p1, p2)
vstack(Union{Plot,Compose.Context}[p1, p2])
source
Gadfly.get_themeMethod
get_theme()

Register a theme by name by adding methods to get_theme.

Examples

get_theme(::Val{:mytheme}) = Theme(...)
push_theme(:mytheme)
source
Gadfly.lab_gradientMethod
function lab_gradient(cs...)

Can be applied to other types, e.g. Scale.lab_gradient("blue","ghostwhite","red")

source
Gadfly.lab_gradientMethod
function lab_gradient(cs::Color...)

Generate a function f(p) that creates a gradient between n≥2 colors, where 0≤p≤1. If you have a collection of colors, then use the splatting operator ...:

f = Scale.lab_gradient(range(HSV(0,1,1), stop=HSV(250,1,1), length=100)...)

Function f can be used like so: Scale.color_continuous(colormap=f).

source
Gadfly.lab_rainbowMethod
lab_rainbow(l, c, h0, n)

Generate n colors in the LCHab colorspace by using a fixed luminance l and chroma c, and varying the hue, starting at h0.

source
Gadfly.layerMethod
layer(data_source::Union{AbstractDataFrame, Void}),
      elements::ElementOrFunction...; mapping...) -> [Layers]

Create a layer element based on the data in data_source, to later input into plot. elements can be Statistics, Geometries, and/or Themes (but not Scales, Coordinates, or Guides). mapping are aesthetics.

Examples

ls=[]
append!(ls, layer(y=[1,2,3], Geom.line))
append!(ls, layer(y=[3,2,1], Geom.point))
plot(ls..., Guide.title("layer example"))
source
Gadfly.layerMethod
layer(f::Function, xmin::Number, xmax::Number, ymin::Number, ymax::Number,
      elements::ElementOrFunction...; mapping...) -> [Layers]

Create a layer of the contours of the 2D function or expression in f. Uses Stat.contour for function calculation. See also Geom.contour.

source
Gadfly.layerMethod
layer(f::Function, lower::Number, upper::Number,
      elements::ElementOrFunction...) -> [Layers]

Create a layer from the function or expression f, which takes a single argument or operates on a single variable, respectively, between the lower and upper bounds. See Stat.func and Geom.line.

source
Gadfly.layerMethod
layer(elements::ElementOrFunction...; mapping...) =
      layer(nothing, elements...; mapping...) -> [Layers]
source
Gadfly.layerMethod
layer(fs::Vector{T}, lower::Number, upper::Number,
      elements::ElementOrFunction...) where T <: Base.Callable -> [Layers]

Create a layer from a list of functions or expressions in fs.

source
Gadfly.luv_rainbowMethod
luv_rainbow(l, c, h0, n)

Generate n colors in the LCHuv colorspace by using a fixed luminance l and chroma c, and varying the hue, starting at h0.

source
Gadfly.plotMethod
plot(data_source::Union{Void, AbstractMatrix, AbstractDataFrame},
     mapping::Dict, elements::ElementOrFunctionOrLayers...) -> Plot

The old fashioned (pre-named arguments) version of plot. This version takes an explicit mapping dictionary, mapping aesthetics symbols to expressions or columns in the data frame.

source
Gadfly.plotMethod
plot(data_source::Union{AbstractMatrix, AbstractDataFrame},
     elements::ElementOrFunctionOrLayers...; mapping...) -> Plot

Create a new plot by specifying a data_source, zero or more elements (Scales, Statistics, Coordinates, Geometries, Guides, Themes, and/or Layers), and a mapping of aesthetics to columns or expressions of the data.

Examples

my_frame = DataFrame(time=1917:2018, price=1.02.^(0:101))
plot(my_frame, x=:time, y=:price, Geom.line)

my_matrix = [1917:2018 1.02.^(0:101)]
plot(my_matrix, x=Col.value(1), y=Col.value(2), Geom.line,
     Guide.xlabel("time"), Guide.ylabel("price"))
source
Gadfly.plotMethod
plot(f::Function, xmin::Number, xmax::Number, ymin::Number, ymax::Number,
     elements::ElementOrFunction...; mapping...)

Plot the contours of the 2D function or expression in f. Uses Stat.contour for function calculation. See also Geom.contour.

source
Gadfly.plotMethod
plot(f::Function, lower::Number, upper::Number, elements::ElementOrFunction...;
     mapping...)

Plot the function or expression f, which takes a single argument or operates on a single variable, respectively, between the lower and upper bounds. See Stat.func and Geom.line.

source
Gadfly.plotMethod
plot(elements::ElementOrFunctionOrLayers...; aesthetics...) -> Plot

Create a new plot of the vectors in 'aesthetics'. Optional elements (Scales, Statistics, Coordinates, Geometries, Guides, Themes, and/or Layers) control the layout, labelling, and transformation of the data.

Examples

plot(x=collect(1917:2018), y=1.02.^(0:101), Geom.line)
source
Gadfly.plotMethod
plot(fs::Vector{T}, lower::Number, upper::Number, elements::ElementOrFunction...;
     mapping...) where T <: Base.Callable
source
Gadfly.set_default_plot_sizeMethod
set_default_plot_size(width::Compose.MeasureOrNumber,
                      height::Compose.MeasureOrNumber)

Sets preferred canvas size when rendering a plot without an explicit call to draw. Units can be inch, cm, mm, pt, or px.

source
Gadfly.styleMethod
style(; kwargs...) -> Theme

Return a new Theme that is a copy of the current theme as modified by the attributes in kwargs. See Themes for available fields.

Examples

style(background_color="gray")
source
Gadfly.titleMethod
title(ctx::Context, str::String, props::Property...) -> Context

Add a title string to a group of plots, typically created with vstack, hstack, or gridstack.

Examples

p1 = plot(x=[1,2], y=[3,4], Geom.line);
p2 = plot(x=[1,2], y=[4,3], Geom.line);
title(hstack(p1,p2), "my latest data", Compose.fontsize(18pt), fill(colorant"red"))
source
Gadfly.weighted_color_meanMethod
function weighted_color_mean(cs::AbstractArray{Lab{T},1},
                             ws::AbstractArray{S,1}) where {S <: Number,T}

Return the mean of Lab colors cs as weighted by ws.

source
Gadfly.with_themeMethod
with_theme(f, theme)

Call function f with theme as the current Theme. theme can be a Theme object or a symbol.

Examples

with_theme(style(background_color=colorant"#888888"))) do
    plot(x=rand(10), y=rand(10))
end
source