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.

Theme

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

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

library lines 11:13 library lines 43:45 library lines 90:92 library lines 96:96 library lines 114:116 library lines 80:82 library lines 283:283 library lines 293:308 library lines 96:129 library lines 234:259

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.

Theme

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

  alpha           1.0
  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          GeometryTypes.HyperSphere{3,Float32}(Float32[0.0, 0.0, 0.0], 1.0f0)
  markersize      0.1
  overdraw        false
  rotations       1.0 + 0.0im + 0.0jm + 0.0km
  shading         true
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  transparency    false
  visible         true
source

library lines 97:100 library lines 30:55 library lines 134:139 library lines 153:168 library lines 334:383 library lines 413:415 library lines 589:608 library lines 133:180 library lines 3:38 library lines 4:63

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.

Theme

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

  alpha             1.0
  ambient           Float32[0.55, 0.55, 0.55]
  color             :black
  colormap          :viridis
  colorrange        AbstractPlotting.Automatic()
  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            GeometryTypes.HyperSphere{2,T} where T
  marker_offset     AbstractPlotting.Automatic()
  markersize        0.1
  overdraw          false
  rotations         Billboard()
  shininess         32.0f0
  specular          Float32[0.2, 0.2, 0.2]
  strokecolor       RGBA{N0f8}(0.0,0.0,0.0,0.0)
  strokewidth       0.0
  transform_marker  false
  transparency      false
  uv_offset_width   Float32[0.0, 0.0, 0.0, 0.0]
  visible           true
source

library lines 5:8 library lines 12:15 library lines 11:13 library lines 43:45 library lines 49:49 library lines 86:86 library lines 90:92 library lines 114:116 library lines 120:120 library lines 61:76 library lines 80:82 library lines 120:126 library lines 35:46 library lines 105:105 library lines 207:211 library lines 249:253 library lines 272:278 library lines 312:331 library lines 335:366 library lines 394:477 library lines 143:143 library lines 147:147 library lines 390:399 library lines 402:403 library lines 455:467 library lines 471:472 library lines 3:56 library lines 60:75 library lines 79:92 library lines 239:273 library lines 277:324 library lines 4:32 library lines 37:41 library lines 61:62 library lines 66:73 library lines 77:77 library lines 85:89 library lines 4:10 library lines 4:93 library lines 101:151

mesh

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

Plots a 3D or 2D mesh.

Theme

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

  alpha           1.0
  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        :viridis
  colorrange      AbstractPlotting.Automatic()
  diffuse         Float32[0.4, 0.4, 0.4]
  interpolate     false
  lightposition   :eyeposition
  linewidth       1
  overdraw        false
  shading         true
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  transparency    false
  visible         true
source

library lines 100:100 library lines 76:89 library lines 158:181 library lines 184:184 library lines 4:14 library lines 17:25 library lines 62:65 library lines 68:68 library lines 71:80 library lines 83:83 library lines 280:286 library lines 334:383 library lines 441:447 library lines 451:451 library lines 476:485 library lines 432:578

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.

Theme

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

  alpha           1.0
  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
  linestyle       "nothing"
  linewidth       1.0
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  transparency    false
  visible         true
source

library lines 93:98 library lines 230:238 library lines 370:371 library lines 489:537 library lines 330:427 library lines 263:288 library lines 4:63

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.

Theme

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

  alpha           1.0
  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
  linestyle       "nothing"
  linewidth       1.0
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  transparency    false
  visible         true
source

library lines 17:17 library lines 24:28 library lines 32:32 library lines 76:76 library lines 80:82 library lines 4:9 library lines 13:16 library lines 20:27 library lines 37:37 library lines 41:43 library lines 47:53 library lines 61:76 library lines 111:116 library lines 120:126 library lines 4:25 library lines 249:253 library lines 256:257 library lines 380:388 library lines 394:477 library lines 516:572 library lines 609:636 library lines 656:659 library lines 665:668 library lines 678:689 library lines 716:729 library lines 756:789 library lines 127:130 library lines 390:399 library lines 489:537 library lines 542:573 library lines 3:56 library lines 96:129 library lines 432:578 library lines 46:56 library lines 194:230 library lines 3:38 library lines 47:111 library lines 4:10

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, or Matrices which define an irregular grid.

Theme

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

  alpha           1.0
  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
  overdraw        false
  shading         true
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  transparency    false
  visible         true
source

library lines 89:97 library lines 100:108 library lines 114:121 library lines 231:239 library lines 243:258 library lines 265:276 library lines 294:330 library lines 419:436 library lines 577:585 library lines 291:305 library lines 55:86 library lines 4:10 library lines 19:23

volume

AbstractPlotting.volumeFunction
volume(volume_data)

Plots a volume. Available algorithms are:

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

Theme

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

  absorption      1.0f0
  algorithm       :iso
  alpha           1.0
  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.05f0
  isovalue        0.5f0
  lightposition   :eyeposition
  linewidth       1
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  transparency    false
  visible         true
source

library lines 4:4 library lines 63:65 library lines 59:59 library lines 173:188 library lines 709:726 library lines 735:782 library lines 19:24 library lines 28:33 library lines 37:42

heatmap

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

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

Theme

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

  alpha           1.0
  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        :viridis
  colorrange      AbstractPlotting.Automatic()
  diffuse         Float32[0.4, 0.4, 0.4]
  interpolate     false
  levels          1
  lightposition   :eyeposition
  linewidth       0.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]
  transparency    false
  visible         true
source

library lines 88:89 library lines 59:59 library lines 104:107 library lines 30:31 library lines 109:129 library lines 190:194 library lines 268:268 library lines 335:366 library lines 733:735 library lines 173:188 library lines 60:75 library lines 239:273 library lines 632:693 library lines 4:10 library lines 19:23

image

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

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

Theme

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

  alpha           1.0
  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        ColorTypes.RGBA{Float32}[RGBA{Float32}(0.0f0,0.0f0,0.0f0,1.0f0), RGBA{Float32}(1.0f0,1.0f0,1.0f0,1.0f0)]
  colorrange      AbstractPlotting.Automatic()
  diffuse         Float32[0.4, 0.4, 0.4]
  interpolate     true
  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]
  transparency    false
  visible         true
source

library lines 53:55 library lines 30:31 library lines 99:99 library lines 207:211 library lines 4:14 library lines 17:25 library lines 114:121 library lines 231:239 library lines 402:403 library lines 93:118 library lines 19:23

contour

AbstractPlotting.contourFunction
contour(x, y, z)

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

Theme

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
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  transparency    false
  visible         true
source

library lines 36:39 library lines 69:72 library lines 86:90 library lines 244:246 library lines 263:264 library lines 173:188 library lines 577:585 library lines 632:693 library lines 4:8 library lines 12:15 library lines 46:51 library lines 55:86 library lines 19:23

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.

Theme

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

library lines 66:72 library lines 76:89 library lines 716:729 library lines 215:227 library lines 243:258

barplot

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

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

Theme

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

  color        :black
  colormap     :viridis
  colorrange   AbstractPlotting.Automatic()
  fillto       0.0
  marker       GeometryTypes.HyperRectangle
  strokecolor  :white
  strokewidth  0
  width        AbstractPlotting.Automatic()
source

library lines 102:103 library lines 57:57 library lines 61:76 library lines 52:52

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 GeometryTypes), 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).

Theme

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   0.0
  transparency  false
  visible       true
source

library lines 104:105 library lines 109:110 library lines 32:33 library lines 57:63 library lines 133:155 library lines 230:238 library lines 96:129 library lines 184:235

band

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

Plots a band from ylower to yupper along x.

Theme

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

  alpha           1.0
  ambient         Float32[0.55, 0.55, 0.55]
  color           RGBA{Float32}(1.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
  overdraw        false
  shading         true
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  transparency    false
  visible         true
source

library lines 380:388

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

Theme

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

library lines 79:92 library lines 133:180 library lines 277:324 library lines 330:427 library lines 432:578 library lines 582:628 library lines 47:111

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     --
--                --  --                --
--------------------  --------------------

library lines 4:4 library lines 61:76 library lines 111:116 library lines 120:126 library lines 109:129 library lines 265:276 library lines 79:92 library lines 133:180 library lines 330:427 library lines 432:578 library lines 263:288 library lines 4:10 library lines 19:23

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     --
--                --
--------------------

library lines 61:76 library lines 249:253 library lines 133:180