Drawing plots
The function draw
executes the instructions that create the graphical visualization of a plot and its components. That function has specialized methods for the different types that have been described in the Structure of plots. In a top-down order:
draw(::Figure)
sets up the workspace and calls thedraw
method for all thePlotObject
s contained inplots
.draw(::PlotObject)
does the following actions:- Paint the background and set the viewport defined by the
viewport
field. - Call the method
draw
on the plot'saxes
. - Call the method
draw
on each item ofgeoms
. - Call
draw
onlegend
it is not an empty legend andattributes[:location] ≠ 0
. - Call
draw
oncolorbar
if it is not an empty color bar andattributes[:colorbar] == true
). - Write different labels and decorations in axes, title, etc, as defined in
attributes
.
- Paint the background and set the viewport defined by the
draw(::Axes)
sets the window and the scale defined by the axes ranges and other specifications — except in the case of polar plots, where the polar coordinates are transformed into the Cartesian coordinates of a square of fixed size, and then draws the axes themselves and their guides.draw(::Geometry)
calls specialized methods for the geometry'skind
, and returns eithernothing
or aVector{Float64}
with the limits of the color scale — when it is calculated by the drawing operation, e.g. in the case of hexagonal bins.- Legends are drawn by the method
draw(lg::Legend, geoms, location)
, wheregeoms
is a vector with the geometries of the plot, andlocation
is an integer code that defines the location of the legend with respect to the main plot area — as defined in Matplotlib legends. The geometries are passed down to theguide
function, which has specialized methods for the kind of geometries that can be represented in legends. - Color bars are drawn by the method
draw(cb::Colorbar [, range])
, where the optionalrange
is by defaultcb.range
, but can be overriden by other values.