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

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 282:282 library lines 292:307 library lines 123:156 library lines 233:258

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

library lines 97:100 library lines 20:51 library lines 129:134 library lines 148:163 library lines 328:378 library lines 405:407 library lines 589:608 library lines 160:207 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.

Attributes

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

  ambient           Float32[0.55, 0.55, 0.55]
  color             :black
  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        0.1
  markerspace       AbstractPlotting.Automatic()
  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       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 34:45 library lines 104:104 library lines 206:210 library lines 248:252 library lines 271:277 library lines 311:330 library lines 334:365 library lines 392:476 library lines 138:138 library lines 142:142 library lines 382:391 library lines 394:395 library lines 449:461 library lines 465:466 library lines 3:56 library lines 87:102 library lines 106:119 library lines 263:297 library lines 302:344 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.

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

library lines 100:100 library lines 75:88 library lines 157:180 library lines 183:183 library lines 4:9 library lines 13:16 library lines 58:60 library lines 63:63 library lines 66:75 library lines 78:78 library lines 275:281 library lines 328:378 library lines 433:441 library lines 445:445 library lines 470:485 library lines 452:591

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

library lines 93:98 library lines 229:237 library lines 369:370 library lines 489:537 library lines 349:447 library lines 262:287 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.

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

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 3:24 library lines 248:252 library lines 255:256 library lines 379:387 library lines 392:476 library lines 515:571 library lines 608:635 library lines 655:658 library lines 664:667 library lines 677:688 library lines 715:728 library lines 755:788 library lines 122:125 library lines 382:391 library lines 489:537 library lines 542:573 library lines 3:56 library lines 123:156 library lines 452:591 library lines 46:56 library lines 194:229 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.

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

library lines 84:92 library lines 95:103 library lines 109:116 library lines 226:234 library lines 238:253 library lines 260:271 library lines 289:324 library lines 411:428 library lines 577:585 library lines 290:304 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

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

library lines 4:4 library lines 63:65 library lines 55:55 library lines 168:183 library lines 708:725 library lines 734:781 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).

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

library lines 88:89 library lines 59:59 library lines 104:107 library lines 29:30 library lines 108:128 library lines 189:193 library lines 267:267 library lines 334:365 library lines 732:734 library lines 168:183 library lines 87:102 library lines 263:297 library lines 645:704 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).

Attributes

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

  ambient         Float32[0.55, 0.55, 0.55]
  color           :black
  colormap        Symbol[: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

library lines 53:55 library lines 29:30 library lines 98:98 library lines 206:210 library lines 4:9 library lines 13:16 library lines 109:116 library lines 226:234 library lines 394:395 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

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

library lines 36:39 library lines 69:72 library lines 86:90 library lines 243:245 library lines 262:263 library lines 168:183 library lines 577:585 library lines 645:704 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.

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

library lines 65:71 library lines 75:88 library lines 715:728 library lines 210:222 library lines 238:253

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
  strokecolor  :white
  strokewidth  0
  width        AbstractPlotting.Automatic()
source

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

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

library lines 104:105 library lines 109:110 library lines 32:33 library lines 56:62 library lines 132:154 library lines 229:237 library lines 123:156 library lines 211:259

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

library lines 379:387

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

library lines 106:119 library lines 160:207 library lines 302:344 library lines 349:447 library lines 452:591 library lines 595:641 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 108:128 library lines 260:271 library lines 106:119 library lines 160:207 library lines 349:447 library lines 452:591 library lines 262:287 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 248:252 library lines 160:207