Gadfly
Base.push!
Compose.draw
Compose.gridstack
Compose.hstack
Compose.vstack
Gadfly.Theme
Gadfly.current_theme
Gadfly.get_theme
Gadfly.get_theme
Gadfly.get_theme
Gadfly.lab_gradient
Gadfly.lab_gradient
Gadfly.lab_rainbow
Gadfly.layer
Gadfly.layer
Gadfly.layer
Gadfly.layer
Gadfly.layer
Gadfly.lchabmix
Gadfly.luv_rainbow
Gadfly.plot
Gadfly.plot
Gadfly.plot
Gadfly.plot
Gadfly.plot
Gadfly.plot
Gadfly.plot
Gadfly.pop_theme
Gadfly.push_theme
Gadfly.push_theme
Gadfly.render
Gadfly.set_default_plot_format
Gadfly.set_default_plot_size
Gadfly.spy
Gadfly.style
Gadfly.title
Gadfly.weighted_color_mean
Gadfly.with_theme
Gadfly.Theme
— Typedefault_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 functionf
inScale.size_discrete2
.continuous_sizemap
: The functionf
inScale.size_radius
andScale.size_area
.discrete_colormap
: A newTheme
field, in development. Currently only works withGuide.manual_discrete_key
andGuide.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.0panel_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 inGeom.bar
. (Measure)boxplot_spacing
: Spacing between boxplots inGeom.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 asGeom.ribbon
andGeom.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 inpoint_shapes
)key_swatch_color
: Default color used in keys for swatches. Currently works forGuide.shapekey
andGuide.sizekey
(Color)key_swatch_size
: Size of key swatches, will overrideTheme(point_size=)
. Currently works forGuide.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 byGeom.label(position=:dynamic)
label_out_of_bounds_penalty
: Penalty for a label not being contained within the plot frame. Used byGeom.label(position=:dynamic)
label_hidden_penalty
: Penalty for making a label hidden to avoid overlaps. Used byGeom.label(position=:dynamic)
label_visibility_flip_pr
: Probability of proposing a visibility flip during label layout. Used byGeom.label(position=:dynamic)
label_padding
: Padding between marker and label. Used byGeom.label(position=:dynamic)
key_max_columns
: Maximum number of columns for key entry labels. (Int)discrete_color_scale
: ADiscreteColorScale
seeScale.color_discrete_hue
continuous_color_scale
: AContinuousColorScale
seeScale.color_continuous
Base.Multimedia.display
— Methoddisplay(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.
Base.push!
— Methodpush!(p::Plot, element::ElementOrFunctionsOrLayers)
Add an element, function or layer to a plot. Elements include Coordinates, Geometries, Guides, Scales, Statistics, and Themes.
Compose.draw
— Methoddraw(backend::Compose.Backend, p::Plot)
A convenience version of Compose.draw
without having to call render.
Compose.gridstack
— Methodgridstack(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])
Compose.hstack
— Methodhstack(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])
Compose.vstack
— Methodvstack(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])
Gadfly.current_theme
— Methodcurrent_theme()
Get the Theme
on top of the theme stack.
Gadfly.get_theme
— Methodget_theme(::Val{:dark})
A light foreground on a dark background.
Gadfly.get_theme
— Methodget_theme(::Val{:default})
A dark foreground on a light background.
Gadfly.get_theme
— Methodget_theme()
Register a theme by name by adding methods to get_theme
.
Examples
get_theme(::Val{:mytheme}) = Theme(...)
push_theme(:mytheme)
Gadfly.lab_gradient
— Methodfunction lab_gradient(cs...)
Can be applied to other types, e.g. Scale.lab_gradient("blue","ghostwhite","red")
Gadfly.lab_gradient
— Methodfunction 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)
.
Gadfly.lab_rainbow
— Methodlab_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
.
Gadfly.layer
— Methodlayer(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"))
Gadfly.layer
— Methodlayer(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
.
Gadfly.layer
— Methodlayer(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
.
Gadfly.layer
— Methodlayer(elements::ElementOrFunction...; mapping...) =
layer(nothing, elements...; mapping...) -> [Layers]
Gadfly.layer
— Methodlayer(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
.
Gadfly.lchabmix
— Methodfunction lchabmix(c0_, c1_, r, power)
Gadfly.luv_rainbow
— Methodluv_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
.
Gadfly.plot
— Methodplot(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.
Gadfly.plot
— Methodplot(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"))
Gadfly.plot
— Methodplot(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
.
Gadfly.plot
— Methodplot(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
.
Gadfly.plot
— Methodplot(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)
Gadfly.plot
— Methodplot()
Blank plot.
Gadfly.plot
— Methodplot(fs::Vector{T}, lower::Number, upper::Number, elements::ElementOrFunction...;
mapping...) where T <: Base.Callable
Gadfly.pop_theme
— Methodpop_theme() -> Theme
Return to using the previous theme by removing the top item on the theme stack. See also pop_theme
and with_theme
.
Gadfly.push_theme
— Methodpush_theme(t::Symbol)
Push a Theme
by its name. Available options are :default
and :dark
. See also get_theme
.
Gadfly.push_theme
— Methodpush_theme(t::Theme)
Set the current theme by placing t
onto the top of the theme stack. See also pop_theme
and with_theme
.
Gadfly.render
— Methodrender(plot::Plot) -> Context
Render plot
to a Compose
context.
Gadfly.set_default_plot_format
— Methodset_default_plot_format(fmt::Symbol)
Sets the default plot format.
Gadfly.set_default_plot_size
— Methodset_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
.
Gadfly.spy
— Methodspy(M::AbstractMatrix, elements::ElementOrFunction...; mapping...) -> Plot
Plots a heatmap of M
, with M[1,1] in the upper left. NaN
values are left blank, and an error is thrown if all elements of M
are NaN
. See Geom.rectbin
and Coord.cartesian(fixed=true)...)
.
Gadfly.style
— Methodstyle(; 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")
Gadfly.title
— Methodtitle(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"))
Gadfly.weighted_color_mean
— Methodfunction 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
.
Gadfly.with_theme
— Methodwith_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