Compose.Mirror — MethodMirror(θ, x, y)Mirror line passing through point (x,y) at angle θ (in radians).
Compose.Mirror — MethodMirror(θ)Mirror(θ)=Mirror(θ, 0.5w, 0.5h)
Compose.PGF — TypePGF([output::Union{IO,AbstractString}], width=√200cm, height=10cm, only_tikz=false; texfonts=false) -> BackendCreate a Portable Graphics Format backend. The output is normally passed to draw. Specify a filename using a string as the first argument. If only_tikz is true then the output is a "tikzpicture", otherwise the output is a complete latex document with headers and footers. If texfonts is false, include "\usepackage{fontspec}" in the headers.
Examples
c = compose(context(), rectangle())
draw(PGF("myplot.tex", 10cm, 5cm, only_tikz=true, texfonts=true), c)Compose.Rotation — MethodRotation(θ, x, y)Rotate all forms in context around point (x,y) by angle θ in radians.
Compose.Rotation — MethodRotation(θ)Rotation(θ)=Rotation(θ, 0.5w, 0.5h)
Compose.SVG — TypeSVG([output::Union{IO,AbstractString}], width=√200cm, height=10cm, jsmode=:none) -> BackendCreate a Scalable Vector Graphic backend. The output is normally passed to draw. Specify a filename using a string as the first argument. jsmode can be one of :none, :embed, :linkabs, or :linkrel. See also SVGJS.
Examples
c = compose(context(), line())
draw(SVG("myplot.svg"), c)Compose.Shear — MethodShear(s, θ, x, y)Shear line passing through point (x,y) at angle θ (in radians), with shear s.
Compose.Shear — MethodShear(s, θ)Shear(s, θ)=Shear(s, θ, 0.5w, 0.5h)
Compose.UnitBox — MethodUnitBox(x0, y0, width, height; leftpad=0mm, rightpad=0mm, toppad=0mm, bottompad=0mm)Specifies the coordinate system for a context, with origin x0, y0, plus width, height.
Compose.UnitBox — MethodUnitBox(width, height; leftpad=0mm, rightpad=0mm, toppad=0mm, bottompad=0mm)Specifies the coordinate system for a context, with origin 0, 0 plus width, height.
Compose.UnitBox — MethodUnitBox() = UnitBox(0.0, 0.0, 1.0, 1.0)Base.fill — Methodfill(cs::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Base.fill — Methodfill(c)Define a fill color, where c can be a Colorant or String.
Compose.PDF — FunctionPDF([output::Union{AbstractString, IO}], width=√200cm, height=10cm; dpi=72) -> BackendCreate a Portable Document Format backend. The output is normally passed to draw. Specify a filename using a string as the first argument. Depends on Cairo.jl.
Examples
using Cairo
c = compose(context(), circle())
draw(PDF("myplot.pdf", 10cm, 5cm, dpi=250), c)Compose.PDF — MethodThe Cairo and Fontconfig packages are necessary for saving as PDF. Add them with the package manager if necessary, then run import Cairo, Fontconfig before invoking PDF.
Compose.PNG — FunctionPNG([output::Union{AbstractString, IO}], width=√200cm, height=10cm; dpi=96) -> BackendCreate a Portable Network Graphics backend. The output is normally passed to draw. Specify a filename using a string as the first argument. Depends on Cairo.jl.
Examples
using Cairo
c = compose(context(), circle())
draw(PNG("myplot.png", 10cm, 5cm, dpi=250), c)Compose.PNG — MethodThe Cairo and Fontconfig packages are necessary for saving as PNG. Add them with the package manager if necessary, then run import Cairo, Fontconfig before invoking PNG.
Compose.PS — FunctionPS([output::Union{AbstractString, IO}], width=√200cm, height=10cm; dpi=72) -> BackendCreate a Postscript backend. The output is normally passed to draw. Specify a filename using a string as the first argument. Depends on Cairo.jl.
Examples
using Cairo
c = compose(context(), circle())
draw(PS("myplot.ps", 10cm, 5cm, dpi=250), c)Compose.PS — MethodThe Cairo and Fontconfig packages are necessary for saving as PS. Add them with the package manager if necessary, then run import Cairo, Fontconfig before invoking PS.
Compose.SVGJS — FunctionSVGJS([output::Union{IO,AbstractString}], width=√200cm, height=10cm, jsmode=:embed) -> BackendCreate a Scalable Vector Graphic backend that enables Gadfly's interactivity (pan, zoom, etc.). The default jsmode splices the requisite javascript directly into the output. One can alternatively link to identical external javascript with :linkabs and :linkrel. The output is normally passed to draw. Specify a filename using a string as the first argument. See also SVG.
Compose.arc — Functionarc(x, y, r, θ1, θ2, sector)Define an arc with its center at (x,y), radius of r, between θ1 and θ2. sector (optional) is true or false, true for a pie sector, false for an arc. Arcs are drawn clockwise from θ1 to θ2.
Compose.arc — Functionarc(xs::AbstractVector, ys::AbstractVector, rs::AbstractVector, θ1s::AbstractVector, θ2s::AbstractVector, sectors::AbstractVector)Arguments can be passed in arrays in order to perform multiple drawing operations.
Compose.arrow — Methodarrow(values::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.arrow — Methodarrow(value::Bool)
`arrow()` is a property of arcs, lines and curves. The color of the arrowhead is the same as `stroke()`, but for svg the results will be browser-dependent.Compose.arrow — Methodarrow()
`arrow() = arrow(true)`Compose.bezigon — Methodbezigon(anchors::Vector{Tuple}, polysides=Vector{<:Vector{<:Vector{<:Tuple}}})Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.bezigon — Methodbezigon(anchor0::Tuple, sides::Vector{<:Vector{<:Tuple}})Define a bezier polygon. anchor0 is the starting point as an (x,y) tuple. sides contains Vectors of side points (tuples): each vector has the control point(s) and end point for each side (the end point forms the next starting point). The sides can be linear (1 point), quadratic (2 points) or cubic (3 points).
Compose.bitmap — Functionbitmap(mimes::AbstractArray, datas::AbstractArray, x0s::AbstractArray, y0s::AbstractArray, widths::AbstractArray, heights::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations.
Compose.bitmap — Functionbitmap(mime, data, x0, y0, width, height)Define a bitmap of size widthxheight with its top left corner at the point (x, y).
Compose.circle — Functioncircle(xs::AbstractArray, ys::AbstractArray, rs::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations.
Compose.circle — Functioncircle(x, y, r)Define a circle with its center at (x,y) and a radius of r.
Compose.circle — Methodcircle()Define a circle in the center of the current context with a diameter equal to the width of the context.
Compose.clip — Methodclip(point_arrays::AbstractArray...)Arguments can be passed in arrays in order to perform multiple clipping operations at once.
Compose.clip — Methodclip(points::AbstractArray)clip() is a property. Only forms inside the clip shape will be visible.
Compose.compose! — Methodcompose!(a::Context, b, c, ds...) -> aAdd b, c, and ds to the graphic as children of a.
Compose.compose — Methodcompose(a::Context, b, c, ds...) -> ContextAdd b, c, and ds to the graphic as children of a copy of a.
Compose.context — Functioncontext(x0=0.0w, y0=0.0h, width=1.0w, height=1.0h;
units=nothing,
rotation=nothing, mirror=nothing, shear=nothing,
withjs=false, withoutjs=false,
minwidth=nothing, minheight=nothing,
order=0, clip=false, raster=false) -> ContextCreate a node in the tree structure that defines a graphic. Use compose to connect child nodes to a parent node. See also Rotation, Mirror, and Shear.
Arguments
units: the coordinate system for the context, defined by aUnitBox.order: the Z-order of this context relative to its siblings.clip: clip children of the canvas by its bounding box if true.withjs: ignore this context and everything under it if we are not drawing to the SVGJS backend.withoutjs: ignore this context if we are drawing on the SVGJS backend.raster: if possible, render this subtree as a bitmap. This requires the Cairo. If Cairo isn't available, the default rendering is used.minwidthandminheight: the minimum size needed to be drawn correctly, in millimeters.
Compose.curve — Functioncurve(anchor0, ctrl0, ctrl1, anchor1)Define a bezier curve between anchor0 and anchor1 with control points ctrl0 and ctrl1.
Compose.curve — Functioncurve(anchor0s::AbstractArray, ctrl0s::AbstractArray, ctrl1s::AbstractArray, anchor1s::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations.
Compose.draw — Methoddraw(b::Backend, c::Context)Output the tree-structured graphic in c to the given backend.
Examples
draw(SVGJS("foo.svg"), compose(context(), text(0,0,"foo")))Compose.ellipse — Functionellipse(xs::AbstractArray, ys::AbstractArray, x_radiuses::AbstractArray, y_radiuses::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations.
Compose.ellipse — Functionellipse(x, y, x_radius, y_radius)Define an ellipse with its center at (x,y) with radii x_radius and y_radius.
Compose.ellipse — Methodellipse()Define an ellipse in the center of the current context with x_radius=0.5w and y_radius=0.5h.
Compose.fillopacity — Methodfillopacity(values::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.fillopacity — Methodfillopacity(value)Define a fill opacity, where 0≤value≤1. For svg, nested contexts will inherit from parent contexts e.g. (context(), fillopacity(a), (context(), fill(c::String), circle())).
Compose.line — Functionline(point_arrays::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.line — Methodline(points)Define a line. points is an array of (x,y) tuples.
Compose.ngon — Functionngon(x, y, r, n::Int)Define a n-sided polygon with its center at (x,y), and radius of r. For an upside-down ngon, use -r.
Compose.ngon — Functionngon(xs::AbstractVector, ys::AbstractVector, rs::AbstractVector, ns::AbstractVector{Int})Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.points — Methodpoints(x::Compose.Form)Extract points from a Compose.Form
Compose.polygon — Functionpolygon(point_arrays::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.polygon — Methodpolygon(points)Define a polygon. points is an array of (x,y) tuples that specify the corners of the polygon.
Compose.rectangle — Functionrectangle(x0s::AbstractArray, y0s::AbstractArray, widths::AbstractArray, heights::AbstractArray)Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.rectangle — Functionrectangle(x0, y0, width, height)Define a rectangle of size widthxheight with its top left corner at the point (x, y).
Compose.rectangle — Methodrectangle()Define a rectangle that fills the current context completely.
Compose.sector — Methodsector(xs::AbstractVector, ys::AbstractVector, rs::AbstractVector, θ1s::AbstractVector, θ2s::AbstractVector)Arguments can be passed in arrays in order to perform multiple drawing operations.
Compose.sector — Methodsector(x, y, r, θ1, θ2)Define a pie sector with its center at (x,y), radius of r, between θ1 and θ2.
Compose.star — Functionstar(x, y, r, n::Int, ratio)Define a n-pointed star with its center at (x,y), outer radius of r, and inner radius equal to r*ratio. For an upside-down star, use -r.
Compose.star — Functionstar(xs::AbstractVector, ys::AbstractVector, rs::AbstractVector, ns::AbstractVector{Int}, ratios::AbstractVector{Float64})Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.text — Functiontext(x, y, value [,halign::HAlignment [,valign::VAlignment [,rot::Rotation]]])Draw the text value at the position (x,y) relative to the current context.
The default alignment of the text is hleft vbottom. The vertical and horizontal alignment is specified by passing hleft, hcenter or hright and vtop, vcenter or vbottom as values for halgin and valgin respectively.
Compose.text — Functiontext(xs::AbstractArray, ys::AbstractArray, values::AbstractArray [,haligns::HAlignment [,valigns::VAlignment [,rots::Rotation]]])Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.xgon — Functionxgon(x, y, r, n::Int, ratio)Define a cross with n arms with its center at (x,y), outer radius of r, and inner radius equal to r*ratio. For an upside-down xgon, use -r.
Compose.xgon — Functionxgon(xs::AbstractVector, ys::AbstractVector, rs::AbstractVector, ns::AbstractVector{Int}, ratios::AbstractVector{Float64})Arguments can be passed in arrays in order to perform multiple drawing operations at once.
Compose.FormBatch — TypeA form batch is a vectorized form with n primitives transformed into a simpler representation: one primitive repositioned n times.
On certain backends this leads to more efficient drawing. For example, SVG can be shortened by using <def> and <use> tags, and raster graphics can render the form primitive to a back buffer and blit it into place for faster drawing.
Batching is an optimization transform that happens at draw time. There's currently no mechanism to manually batch. E.g. contexts cannot have FormBatch children.
Compose.batch — MethodAttempt to batch a form. Return a Nothing singleton if the Form could not be batched, and FormBatch object if the original form can be replaced.
Compose.canbatch — MethodSome backends can more efficiently draw forms by batching. If so, they shuld define a similar method that returns true.
Compose.count_unique_primitives — MethodCount the number of unique primitives in a property, stopping when max_count is exceeded.
Compose.excise_vector_children! — MethodRemove and return vector forms and vector properties from the Context.
Compose.filter_redundant_offsets! — MethodProduce a new array of offsets in which near duplicate values have been removed.
Compose.optimize_batching — MethodAttempt to transform a tree into an equivalent tree that can more easily be batched.
What this does is look for patterns in which a long vector form is accompanied by a large vector property that has a relatively small number of unique values. If there are n unique values, we can split it into n contexts, each with a shorter vector form and only scalar properties.