Plotting functions overview

The follow document lists the atomic plotting functions and their usage. These are the most atomic primitives which one can stack together to form more complex plots.

For general help about each function, consult the Help functions.

See Plot function signatures for the available plot function signatures.

See Plot attributes for the available plot attributes.

text

AbstractPlotting.textFunction
text(string)

Plots a text.

Attributes

Available attributes and their defaults for Text{...} are:

  align           (:left, :bottom)
  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  diffuse         Float32[0.4, 0.4, 0.4]
  font            "Dejavu Sans"
  justification   0.5
  lightposition   :eyeposition
  lineheight      1.0
  linewidth       1
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  position        Float32[0.0, 0.0]
  rotation        0.0
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  strokecolor     (:black, 0.0)
  strokewidth     0
  textsize        20
  transparency    false
  visible         true
source

meshscatter

AbstractPlotting.meshscatterFunction
meshscatter(positions)
meshscatter(x, y)
meshscatter(x, y, z)

Plots a mesh for each element in (x, y, z), (x, y), or positions (similar to scatter). markersize is a scaling applied to the primitive passed as marker.

Attributes

Available attributes and their defaults for MeshScatter{...} are:

  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        :viridis
  colorrange      AbstractPlotting.Automatic()
  diffuse         Float32[0.4, 0.4, 0.4]
  lightposition   :eyeposition
  linewidth       1
  marker          GeometryBasics.HyperSphere{3,Float32}(Float32[0.0, 0.0, 0.0], 1.0f0)
  markersize      0.1
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  rotations       1.0 + 0.0im + 0.0jm + 0.0km
  shading         true
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

scatter

AbstractPlotting.scatterFunction
scatter(positions)
scatter(x, y)
scatter(x, y, z)

Plots a marker for each element in (x, y, z), (x, y), or positions.

Attributes

Available attributes and their defaults for Scatter{...} are:

  ambient           Float32[0.55, 0.55, 0.55]
  color             :gray65
  colormap          :viridis
  diffuse           Float32[0.4, 0.4, 0.4]
  distancefield     "nothing"
  glowcolor         RGBA{N0f8}(0.0,0.0,0.0,0.0)
  glowwidth         0.0
  lightposition     :eyeposition
  linewidth         1
  marker            GeometryBasics.HyperSphere{2,T} where T
  marker_offset     AbstractPlotting.Automatic()
  markersize        10
  markerspace       Pixel
  nan_color         RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw          false
  rotations         Billboard()
  shininess         32.0f0
  specular          Float32[0.2, 0.2, 0.2]
  ssao              false
  strokecolor       :black
  strokewidth       1.0
  transform_marker  false
  transparency      false
  uv_offset_width   Float32[0.0, 0.0, 0.0, 0.0]
  visible           true
source

mesh

AbstractPlotting.meshFunction
mesh(x, y, z)
mesh(mesh_object)
mesh(x, y, z, faces)
mesh(xyz, faces)

Plots a 3D or 2D mesh.

Attributes

Available attributes and their defaults for Mesh{...} are:

  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        :viridis
  diffuse         Float32[0.4, 0.4, 0.4]
  interpolate     false
  lightposition   :eyeposition
  linewidth       1
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shading         true
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

linesegments

AbstractPlotting.linesegmentsFunction
linesegments(positions)
linesegments(x, y)
linesegments(x, y, z)

Plots a line for each pair of points in (x, y, z), (x, y), or positions.

Attributes

Available attributes and their defaults for LineSegments{...} are:

  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        :viridis
  diffuse         Float32[0.4, 0.4, 0.4]
  lightposition   :eyeposition
  linestyle       "nothing"
  linewidth       1.0
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

lines

AbstractPlotting.linesFunction
lines(positions)
lines(x, y)
lines(x, y, z)

Creates a connected line plot for each element in (x, y, z), (x, y) or positions.

Tip

You can separate segments by inserting NaNs.

Attributes

Available attributes and their defaults for Lines{...} are:

  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        :viridis
  diffuse         Float32[0.4, 0.4, 0.4]
  lightposition   :eyeposition
  linestyle       "nothing"
  linewidth       1.0
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

surface

AbstractPlotting.surfaceFunction
surface(x, y, z)

Plots a surface, where (x, y) define a grid whose heights are the entries in z. x and y may be Vectors which define a regular grid, orMatrices which define an irregular grid.

Attributes

Available attributes and their defaults for Surface{...} are:

  ambient         Float32[0.55, 0.55, 0.55]
  color           "nothing"
  colormap        :viridis
  diffuse         Float32[0.4, 0.4, 0.4]
  highclip        "nothing"
  lightposition   :eyeposition
  linewidth       1
  lowclip         "nothing"
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shading         true
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

volume

AbstractPlotting.volumeFunction
volume(volume_data)

Plots a volume. Available algorithms are:

  • :iso => IsoValue
  • :absorption => Absorption
  • :mip => MaximumIntensityProjection
  • :absorptionrgba => AbsorptionRGBA
  • :indexedabsorption => IndexedAbsorptionRGBA

Attributes

Available attributes and their defaults for Volume{...} are:

  algorithm       :mip
  ambient         Float32[0.55, 0.55, 0.55]
  color           "nothing"
  colormap        :viridis
  colorrange      (0, 1)
  diffuse         Float32[0.4, 0.4, 0.4]
  isorange        0.05
  isovalue        0.5
  lightposition   :eyeposition
  linewidth       1
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

heatmap

AbstractPlotting.heatmapFunction
heatmap(x, y, values)
heatmap(values)

Plots a heatmap as an image on x, y (defaults to interpretation as dimensions).

Attributes

Available attributes and their defaults for Heatmap{...} are:

  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        :viridis
  diffuse         Float32[0.4, 0.4, 0.4]
  highclip        "nothing"
  interpolate     false
  levels          1
  lightposition   :eyeposition
  linewidth       0.0
  lowclip         "nothing"
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

image

AbstractPlotting.imageFunction
image(x, y, image)
image(image)

Plots an image on range x, y (defaults to dimensions).

Attributes

Available attributes and their defaults for Image{...} are:

  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        [:black, :white]
  diffuse         Float32[0.4, 0.4, 0.4]
  highclip        "nothing"
  interpolate     true
  lightposition   :eyeposition
  linewidth       1
  lowclip         "nothing"
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

contour

AbstractPlotting.contourFunction
contour(x, y, z)

Creates a contour plot of the plane spanning x::Vector, y::Vector, z::Matrix

Attributes

Available attributes and their defaults for Contour{...} are:

  alpha           1.0
  ambient         Float32[0.55, 0.55, 0.55]
  color           "nothing"
  colormap        :viridis
  colorrange      AbstractPlotting.Automatic()
  diffuse         Float32[0.4, 0.4, 0.4]
  fillrange       false
  levels          5
  lightposition   :eyeposition
  linewidth       1.0
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

arrows

AbstractPlotting.arrowsFunction
arrows(points, directions; kwargs...)
arrows(x, y, u, v)
arrows(x::AbstractVector, y::AbstractVector, u::AbstractMatrix, v::AbstractMatrix)
arrows(x, y, z, u, v, w)

Plots arrows at the specified points with the specified components. u and v are interpreted as vector components (u being the x and v being the y), and the vectors are plotted with the tails at x, y.

If x, y, u, v are <: AbstractVector, then each 'row' is plotted as a single vector.

If u, v are <: AbstractMatrix, then x and y are interpreted as specifications for a grid, and u, v are plotted as arrows along the grid.

arrows can also work in three dimensions.

Attributes

Available attributes and their defaults for Arrows{...} are:

  arrowcolor   :black
  arrowhead    AbstractPlotting.Automatic()
  arrowsize    0.3
  arrowtail    "nothing"
  lengthscale  1.0f0
  linecolor    :black
  linestyle    "nothing"
  linewidth    1
  normalize    false
  scale        Float32[1.0, 1.0, 1.0]
source

barplot

AbstractPlotting.barplotFunction
barplot(x, y; kwargs...)

Plots a barplot; y defines the height. x and y should be 1 dimensional.

Attributes

Available attributes and their defaults for BarPlot{...} are:

  color        :black
  colormap     :viridis
  colorrange   AbstractPlotting.Automatic()
  direction    :y
  fillto       0.0
  marker       GeometryBasics.HyperRectangle{N,T} where T where N
  strokecolor  :white
  strokewidth  0
  width        AbstractPlotting.Automatic()
source

poly

AbstractPlotting.polyFunction
poly(vertices, indices; kwargs...)
poly(points; kwargs...)
poly(shape; kwargs...)
poly(mesh; kwargs...)

Plots a polygon based on the arguments given. When vertices and indices are given, it functions similarly to mesh. When points are given, it draws one polygon that connects all the points in order. When a shape is given (essentially anything decomposable by GeometryBasics), it will plot decompose(shape).

poly(coordinates, connectivity; kwargs...)

Plots polygons, which are defined by coordinates (the coordinates of the vertices) and connectivity (the edges between the vertices).

Attributes

Available attributes and their defaults for Poly{...} are:

  color         :black
  colormap      :viridis
  colorrange    AbstractPlotting.Automatic()
  linestyle     "nothing"
  overdraw      false
  shading       false
  strokecolor   RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  strokewidth   1.0
  transparency  false
  visible       true
source

band

AbstractPlotting.bandFunction
band(x, ylower, yupper; kwargs...)
band(lower, upper; kwargs...)

Plots a band from ylower to yupper along x.

Attributes

Available attributes and their defaults for Band{...} are:

  ambient         Float32[0.55, 0.55, 0.55]
  color           RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.2f0)
  colormap        :viridis
  colorrange      AbstractPlotting.Automatic()
  diffuse         Float32[0.4, 0.4, 0.4]
  interpolate     false
  lightposition   :eyeposition
  linewidth       1
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shading         true
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true
source

slider

AbstractPlotting.sliderFunction
slider(range; kwargs...)

Creates a slider which slides through the selected range; sliders are discrete. The Slider's value can be accessed through its value field. For example:

scene = slider(1:10)
lift(scene[end].value) do val
    # your function here
end

Attributes

Available attributes and their defaults for Slider{...} are:

  backgroundcolor    (:gray, 0.01)
  buttoncolor        :white
  buttonsize         15
  buttonstroke       1.5
  buttonstrokecolor  :black
  camera             AbstractPlotting.campixel!
  position           (0, 0)
  raw                true
  slidercolor        (:gray, 0.6)
  sliderheight       50
  sliderlength       200
  start              AbstractPlotting.Automatic()
  strokecolor        (:black, 0.4)
  strokewidth        1
  textcolor          :black
  textsize           15
  textspace          50
  value              0
  valueprinter       AbstractPlotting.default_printer
source

vbox

AbstractPlotting.vboxFunction
vbox(scenes...; parent = Scene(clear = false), kwargs...)

Box the scenes together on the vertical axis. For example, two Scenes vboxed will be placed side-by-side.

--------------------  --------------------
--                --  --                --
--    Scene 1     --  --    Scene 2     --
--                --  --                --
--------------------  --------------------

hbox

AbstractPlotting.hboxFunction
hbox(scenes...; parent = Scene(clear = false), kwargs...)

Attach the given Scenes together on the horizontal axis. For example, two Scenes hboxed will be placed one on top of the other.

--------------------
--                --
--    Scene 1     --
--                --
--------------------
--------------------
--                --
--    Scene 2     --
--                --
--------------------