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 thedrawmethod for all thePlotObjects contained inplots.draw(::PlotObject)does the following actions:- Paint the background and set the viewport defined by the
viewportfield. - Call the method
drawon the plot'saxes. - Call the method
drawon each item ofgeoms. - Call
drawonlegendit is not an empty legend andattributes[:location] ≠ 0. - Call
drawoncolorbarif 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 eithernothingor 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), wheregeomsis a vector with the geometries of the plot, andlocationis 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 theguidefunction, 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 optionalrangeis by defaultcb.range, but can be overriden by other values.