AsyPlots.Arrow
— TypeArrow(name::AbstractString,
size::Real,
position::Real)
Store instructions for drawing an arrow
position
is an element of [0,1] which indicates how far along the path the arrow should be drawn
NoArrow() returns a no-arrow instruction, while Arrow3() gives an arrow suitable for 3D paths
AsyPlots.Circle2D
— TypeCircle2D(center,radius; pen::Pen,fillpen::Pen)
A graphics primitive representing a circle in the plane
center
may be a Vec2
or a 2-tuple of Real
s or a Complex
Examples
julia> Circle2D((0,0),1;pen="LightBlue",fillpen="red")
Circle2D((0,0),1;pen=LightBlue,fillpen=red)
AsyPlots.NamedColor
— TypeNamedColor(name::String,color::RGB)
A named ColorTypes.RGB
Examples
julia> NamedColor("DarkGreen")
NamedColor("DarkGreen",(0.0, 0.39, 0.0))
AsyPlots.Path2D
— TypePath2D(points;label="",pen=Pen(),arrow=NoArrow(),spline=false)
Path2D(x,y;label="",pen=Pen(),arrow=NoArrow(),spline=false)
A graphics primitive representing a two-dimensional path
points
may be an Array of Vec2
s, an Array of 2-tuples, or an $n × 2$ Array. Alternatively, iterables of coordinates may be supplied separately as x
and y
Examples
julia> Path2D([(0,0),(1,0),(1,1)];pen="MidnightBlue")
Path2D(<3 points>;pen=MidnightBlue)
AsyPlots.Path3D
— TypePath3D(points;label="",pen=Pen(),arrow="",spline=false)
A graphics primitive representing a two-dimensional path
points
may be an Array of Vec3
s or an Array of 3-tuples. Alternatively, iterables of coordinates may be supplied separately as x
and y
Examples
julia> Path3D([(0,0),(1,0),(1,1)];pen="MidnightBlue")
AsyPlots.Pen
— TypePen(color::NamedColor,
opacity::Real,
linewidth::Real,
other::String)
Store drawing properties
Examples
julia> Pen(color="DarkGreen",opacity=0.5)
Pen(color=DarkGreen,opacity=0.5)
AsyPlots.PixelMap
— TypePixelMap(pixels, lowerleft, upperright; kwargs...)
A graphics primitive representing a two-dimensional array of pixels situated in the box with given lower left and upper right corners.
pixels
is an array of NamedColor
s, while lowerleft
and upperright
are tuples.
Examples
julia> pixels = [x*NamedColor("blue") +
(1-x)*NamedColor("red")
for x in 0:0.1:1, y in 0:0.1:1]
julia> PixelMap(pixels, (0,0), (1,1))
PixelMap(<11×11>,[0,1]×[0,1])
AsyPlots.Plot2D
— TypePlot2D(elements::Array{<:GraphicElement,1},
options::Array{Any,1})
A container for a list of graphics primitives to draw, together with drawing options
Examples
julia> Plot([Path([0 0; 1 1]),Polygon([exp(2*pi*im*k/5) for k=1:5])])
AsyPlots.Plot3D
— TypePlot3D(elements::Array{<:GraphicElement2D,1},
options::Array{Any,1})
A container for a list of graphics primitives to draw, together with drawing options
Examples
julia> Plot(Path([0 0 0; 1 1 1]),Path([0 0 0; 0 0 1]))
AsyPlots.Point2D
— TypePoint2D(x::Real,y::Real; label="",pen=Pen())
Point2D(P; label="",pen=Pen())
A graphics primitive representing a two-dimensional point.
P
may be a 2-tuple of real numbers, a Vec2
, or a Complex
Examples
julia> Point2D(3,-1;pen="DarkGreen")
Point2D(3,-1;pen=DarkGreen)
AsyPlots.Point3D
— TypePoint3D(x::Real,y::Real,z::Real; label="",pen=Pen())
Point3D(P; label="",pen=Pen())
A graphics primitive representing a three-dimensional point.
P
may be a 3-tuple of real numbers or a Vec3
Examples
julia> Point3D(0,4,5;pen="DarkGreen")
AsyPlots.Polygon2D
— TypePolygon2D(points;pen=Pen(),
fillpen=Pen(color="white"),
spline=false)
A graphics primitive representing a two-dimensional polygon
points
may be an Array of Vec2
s, an Array of 2-tuples, or an $n × 2$ Array. Alternatively, iterables of coordinates may be supplied separately as x
and y
Examples
julia> Polygon2D([(0,0),(1,0),(1,1)];pen="MidnightBlue")
Polygon2D(<3 points>;pen=MidnightBlue)
AsyPlots.Polygon3D
— TypePolygon3D(points;pen=Pen(),
fillpen=Pen(color="white"),
spline=false)
A graphics primitive representing a three-dimensional polygon
points
may be an Array of Vec3
s or an Array of 3-tuples.
Examples
julia> Polygon3D([(0,0,0),(1,0,0),(1,1,0)];pen="MidnightBlue")
AsyPlots.RawString
— TypeRawString(s::AbstractString)
Container for directly inserting Asymptote drawing commands
Examples
julia> Plot([Circle((0,0),1),RawString2D("draw((0,0)--dir(20));")])
AsyPlots.Surface
— TypeSurface(x::Array{<:Real},
y::Array{<:Real},
z::Array{<:Real,2};
options)
Surface(z::Array{<:Real},2)
A graphics primitive representing a surface in three dimensions x
and y
may be one- or two-dimensional arrays
The surface passes through the points [x[i,j],y[i,j],z[i,j] for i=1:size(z,1),j=1:size(z,2)]
The options are
colors
: A vector of color names, for coloringspline
: whether to draw a smooth or piecewise smooth surfacesurfacepen
: a pen for drawing the surfacemeshpen
: a pen for drawing the grid lines on the surfaceclip
: eitherfalse
or a boolean array of the same dimensions asx
,y
, andz
, specifying patches to exclude
AsyPlots.Path
— FunctionPath(A;kwargs)
Return a Path2D or Path3D object, as appropriate
Examples
julia> Path([1 2; 3 4])
Path2D(<2 points>)
AsyPlots.Point
— FunctionPoint(x::Real,y::Real;kwargs...)
Point(x::Real,y::Real,z::Real;kwargs...)
Point(P;kwargs...)
Return a Point2D or Point3D object, as appropriate
Examples
julia> Point(1,2;pen=Pen(opacity=0.5),shape=:plus)
Point2D(1,2;pen=opacity(0.5))
AsyPlots.Polygon
— MethodPolygon(points;kwargs...)
Return a Polygon2D
or a Polygon3D
as appropriate
points
may be an array of Vec2
s or Complex
es, or an $n × 2$ array of Real
s
Examples
julia> Polygon([im,0,1])
Polygon2D(<3 points>)
AsyPlots.animate
— Methodanimate(filename::AbstractString,
plots::Vector{Plot2D};
rate=10)
animate(plots::Vector{Plot2D};rate=10)
Make an .mp4
video from plots
, with frame rate rate
If "filename" is given, the movie file will be stored there. Otherwise, the movie will be opened.
Example
X = cumsum(randn(100000))
Y = cumsum(randn(100000))
plots = [Plot(Path(X[1:t],Y[1:t])) for t=10:10:10000]
animate(plots)
AsyPlots.asy
— Methodasy()
Set the backend to Asymptote
AsyPlots.cairo
— Methodcairo()
Set the backend to Cairo
AsyPlots.heatmap
— Methodheatmap(A; colors)
heatmap(A, lowerleft, upperright; colors)
heatmap(xs, ys, f::Function)
Plot a heatmap of the values stored in the matrix A
, using the colormap represented by the vector colors
of NamedColors
. Place the resulting PixelMap
according to the given lowerleft
and upperright
tuples (which default to (0,0) and size(A)).
Examples
julia> heatmap(0:10, 0:10, (x,y) -> x^2 + y^2)
AsyPlots.histogram
— Methodhistogram(data::Vector;
bincount=30,
bins=range(minimum(data),stop=maximum(data),length=bincount),
xlabel="",
ylabel="",
title="",
pen=Pen(color=NamedColor("MidnightBlue"),opacity=0.3))
Make a histogram of data
AsyPlots.isinside
— Methodisinside(p::Point,pointlist::AbstractArray{<:Point,1})
Determine whether p
is inside pointlist
.
This function was copied from Luxor.jl. It is an implementation of an algorithm due to Hormann and Agathos (2001)
AsyPlots.isolines
— Methodisolines(xs, ys, zs; lift = false, interpolation = :cubic)
Plot the contour lines of the function whose values are represented by the array (or function) zs
. If lift
is true, plot in 3D.
Examples
```julia-repl julia> isolines(0:10, 0:10, (x,y) -> (100 - x^2 + y^2)/10, lift = true)
AsyPlots.piechart
— Methodpiechart(labels,frequencies; title="")
labels
: a vector of stringsfrequencies
: a vector ofReal
s
Return a piechart with each sector i labeled labels[i]
and having central angle proportional to frequencies[i]
AsyPlots.plot
— Methodplot(x,y;kwargs...)
plot(y;kwargs...)
Return a graph of the path with $x$ and $y$ values given by x
and y
x
defaults to 0:length(y)-1
. kwargs
are applied to the Path2D
object representing the line or to the containing Plot2D
, as appropriate
plot(xs::Vector{<:Vector{<:Real}},
ys::Vector{<:Vector{<:Real}};
kwargs...)
Multiple line graphs in the same figure
plot(x,y,z;kwargs...)
plot(z::Array{<:Real,2};kwargs...)
A graph of the surface with $x$, $y$, and $z$ values x
, y
, and z
x
defaults to [i-1 for i=1:size(z,1),j=1:size(z,2)]
and y
defaults to [j-1 for i=1:size(z,1),j=1:size(z,2)]
Examples
plot(cumsum(randn(100)))
plot(rand(5,5))
AsyPlots.save
— Methodsave(filename::AbstractString,
P::Union{Plot2D,Plot3D};
runasy=true,
forcepdf=false)
Save Asymptote figure. If filename
has extension .asy
, then an asy file is saved together with any auxiliary data files.
If filename
has extension .pdf
, .svg
or .png
, then only the resulting image file is saved to the location filename
AsyPlots.distance
— Methoddistance(x,y,a,b,c,d)
Return the distance from the point (x,y) to the line segment with endpoints (a,b) and (c,d)
AsyPlots.enclosequote
— Methodenclosequote(s)
Enclose s
in quotation marks, unless it starts with "Label"
AsyPlots.filterjoin
— Methodfilterjoin(args...)
Concatenate nonempty string representations of args
, separated by commas
AsyPlots.splitkwargs
— Methodsplitkwargs(pooled_kwargs,options_to_separate)
Split a pooled list of keyword arguments into kwargs in options_to_separate
and the rest