Tutorial

Gadfly is an implementation of a "grammar of graphics" style statistical graphics system for Julia. This tutorial will outline general usage patterns and will give you a feel for the overall system.

To begin, we need some data. Gadfly can work with data supplied as either a DataFrame or as plain AbstractArrays. In this tutorial, we'll pick and choose some examples from the RDatasets package.

Let us use Fisher's iris dataset as a starting point.

using Gadfly, RDatasets
iris = dataset("datasets", "iris")
RowSepalLengthSepalWidthPetalLengthPetalWidthSpecies
15.13.51.40.2setosa
24.93.01.40.2setosa
34.73.21.30.2setosa
44.63.11.50.2setosa
55.03.61.40.2setosa
65.43.91.70.4setosa
..................

DataFrames

When used with a DataFrame, the plot function in Gadfly is of the form:

plot(data::AbstractDataFrame, elements::Element...; mapping...)

The first argument is the data to be plotted and the keyword arguments at the end map "aesthetics" to columns in the data frame. All input arguments between data and mapping are some number of "elements", which are the nouns and verbs, so to speak, that form the grammar.

Let's get to it.

p = plot(iris, x=:SepalLength, y=:SepalWidth, Geom.point);

First note that we've taken advantage of the flexibility of Julia's handling of function signatures and put the keyword arguments in the midst of the positional arguments. This is purely for ease of reading.

The example above produces a Plot object. It can be saved to a file by drawing to one or more backends using draw.

img = SVG("iris_plot.svg", 14cm, 8cm)
draw(img, p)

Now we have the following charming little SVG image.

SepalLength 4 5 6 7 8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 7.2 7.4 7.6 7.8 8.0 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 5.32 5.34 5.36 5.38 5.40 5.42 5.44 5.46 5.48 5.50 5.52 5.54 5.56 5.58 5.60 5.62 5.64 5.66 5.68 5.70 5.72 5.74 5.76 5.78 5.80 5.82 5.84 5.86 5.88 5.90 5.92 5.94 5.96 5.98 6.00 6.02 6.04 6.06 6.08 6.10 6.12 6.14 6.16 6.18 6.20 6.22 6.24 6.26 6.28 6.30 6.32 6.34 6.36 6.38 6.40 6.42 6.44 6.46 6.48 6.50 6.52 6.54 6.56 6.58 6.60 6.62 6.64 6.66 6.68 6.70 6.72 6.74 6.76 6.78 6.80 6.82 6.84 6.86 6.88 6.90 6.92 6.94 6.96 6.98 7.00 7.02 7.04 7.06 7.08 7.10 7.12 7.14 7.16 7.18 7.20 7.22 7.24 7.26 7.28 7.30 7.32 7.34 7.36 7.38 7.40 7.42 7.44 7.46 7.48 7.50 7.52 7.54 7.56 7.58 7.60 7.62 7.64 7.66 7.68 7.70 7.72 7.74 7.76 7.78 7.80 7.82 7.84 7.86 7.88 7.90 7.92 7.94 7.96 7.98 8.00 4 6 8 5.9,3.0 6.2,3.4 6.5,3.0 6.3,2.5 6.7,3.0 6.7,3.3 6.8,3.2 5.8,2.7 6.9,3.1 6.7,3.1 6.9,3.1 6.0,3.0 6.4,3.1 6.3,3.4 7.7,3.0 6.1,2.6 6.3,2.8 6.4,2.8 7.9,3.8 7.4,2.8 7.2,3.0 6.4,2.8 6.1,3.0 6.2,2.8 7.2,3.2 6.7,3.3 6.3,2.7 7.7,2.8 5.6,2.8 6.9,3.2 6.0,2.2 7.7,2.6 7.7,3.8 6.5,3.0 6.4,3.2 5.8,2.8 5.7,2.5 6.8,3.0 6.4,2.7 6.5,3.2 7.2,3.6 6.7,2.5 7.3,2.9 4.9,2.5 7.6,3.0 6.5,3.0 6.3,2.9 7.1,3.0 5.8,2.7 6.3,3.3 5.7,2.8 5.1,2.5 6.2,2.9 5.7,2.9 5.7,3.0 5.6,2.7 5.0,2.3 5.8,2.6 6.1,3.0 5.5,2.6 5.5,2.5 5.6,3.0 6.3,2.3 6.7,3.1 6.0,3.4 5.4,3.0 6.0,2.7 5.8,2.7 5.5,2.4 5.5,2.4 5.7,2.6 6.0,2.9 6.7,3.0 6.8,2.8 6.6,3.0 6.4,2.9 6.1,2.8 6.3,2.5 6.1,2.8 5.9,3.2 5.6,2.5 6.2,2.2 5.8,2.7 5.6,3.0 6.7,3.1 5.6,2.9 6.1,2.9 6.0,2.2 5.9,3.0 5.0,2.0 5.2,2.7 6.6,2.9 4.9,2.4 6.3,3.3 5.7,2.8 6.5,2.8 5.5,2.3 6.9,3.1 6.4,3.2 7.0,3.2 5.0,3.3 5.3,3.7 4.6,3.2 5.1,3.8 4.8,3.0 5.1,3.8 5.0,3.5 4.4,3.2 4.5,2.3 5.0,3.5 5.1,3.4 4.4,3.0 4.9,3.6 5.5,3.5 5.0,3.2 4.9,3.1 5.5,4.2 5.2,4.1 5.4,3.4 4.8,3.1 4.7,3.2 5.2,3.4 5.2,3.5 5.0,3.4 5.0,3.0 4.8,3.4 5.1,3.3 4.6,3.6 5.1,3.7 5.4,3.4 5.1,3.8 5.7,3.8 5.1,3.5 5.4,3.9 5.7,4.4 5.8,4.0 4.3,3.0 4.8,3.0 4.8,3.4 5.4,3.7 4.9,3.1 4.4,2.9 5.0,3.4 4.6,3.4 5.4,3.9 5.0,3.6 4.6,3.1 4.7,3.2 4.9,3.0 5.1,3.5 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 2.0 2.5 3.0 3.5 4.0 4.5 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 1.99 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.35 2.36 2.37 2.38 2.39 2.40 2.41 2.42 2.43 2.44 2.45 2.46 2.47 2.48 2.49 2.50 2.51 2.52 2.53 2.54 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 2.66 2.67 2.68 2.69 2.70 2.71 2.72 2.73 2.74 2.75 2.76 2.77 2.78 2.79 2.80 2.81 2.82 2.83 2.84 2.85 2.86 2.87 2.88 2.89 2.90 2.91 2.92 2.93 2.94 2.95 2.96 2.97 2.98 2.99 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29 3.30 3.31 3.32 3.33 3.34 3.35 3.36 3.37 3.38 3.39 3.40 3.41 3.42 3.43 3.44 3.45 3.46 3.47 3.48 3.49 3.50 3.51 3.52 3.53 3.54 3.55 3.56 3.57 3.58 3.59 3.60 3.61 3.62 3.63 3.64 3.65 3.66 3.67 3.68 3.69 3.70 3.71 3.72 3.73 3.74 3.75 3.76 3.77 3.78 3.79 3.80 3.81 3.82 3.83 3.84 3.85 3.86 3.87 3.88 3.89 3.90 3.91 3.92 3.93 3.94 3.95 3.96 3.97 3.98 3.99 4.00 4.01 4.02 4.03 4.04 4.05 4.06 4.07 4.08 4.09 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.30 4.31 4.32 4.33 4.34 4.35 4.36 4.37 4.38 4.39 4.40 4.41 4.42 4.43 4.44 4.45 4.46 4.47 4.48 4.49 4.50 2 3 4 5 SepalWidth

If some of the text in this image is overlapping other text, your browser likely has a minimum font size set. You will need to unset this option for the plots to render correctly in your web browser.

If you are working at the REPL, a quicker way to see the image is to omit the semi-colon trailing plot. This automatically renders the image to your default multimedia display, typically an internet browser. No need to capture the output argument in this case.

plot(iris, x=:SepalLength, y=:SepalWidth)

Note that Geom.point will be automatically supplied if no other geometries are given.

Alternatively one can manually call display on a Plot object. This workflow is necessary when display would not otherwise be called automatically.

function get_to_it(d)
  ppoint = plot(d, x=:SepalLength, y=:SepalWidth, Geom.point)
  pline = plot(d, x=:SepalLength, y=:SepalWidth, Geom.line)
  ppoint, pline
end
ps = get_to_it(iris)
map(display, ps)

For the rest of the demonstrations, we'll simply omit the trailing semi-colon for brevity.

In this plot we've mapped the x aesthetic to the SepalLength column and the y aesthetic to the SepalWidth. The last argument, Geom.point, is a geometry element which takes bound aesthetics and renders delightful figures. Adding other geometries produces layers, which may or may not result in a coherent plot.

plot(iris, x=:SepalLength, y=:SepalWidth, Geom.point, Geom.line)
SepalLength 4 5 6 7 8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 7.2 7.4 7.6 7.8 8.0 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 5.32 5.34 5.36 5.38 5.40 5.42 5.44 5.46 5.48 5.50 5.52 5.54 5.56 5.58 5.60 5.62 5.64 5.66 5.68 5.70 5.72 5.74 5.76 5.78 5.80 5.82 5.84 5.86 5.88 5.90 5.92 5.94 5.96 5.98 6.00 6.02 6.04 6.06 6.08 6.10 6.12 6.14 6.16 6.18 6.20 6.22 6.24 6.26 6.28 6.30 6.32 6.34 6.36 6.38 6.40 6.42 6.44 6.46 6.48 6.50 6.52 6.54 6.56 6.58 6.60 6.62 6.64 6.66 6.68 6.70 6.72 6.74 6.76 6.78 6.80 6.82 6.84 6.86 6.88 6.90 6.92 6.94 6.96 6.98 7.00 7.02 7.04 7.06 7.08 7.10 7.12 7.14 7.16 7.18 7.20 7.22 7.24 7.26 7.28 7.30 7.32 7.34 7.36 7.38 7.40 7.42 7.44 7.46 7.48 7.50 7.52 7.54 7.56 7.58 7.60 7.62 7.64 7.66 7.68 7.70 7.72 7.74 7.76 7.78 7.80 7.82 7.84 7.86 7.88 7.90 7.92 7.94 7.96 7.98 8.00 4 6 8 5.9,3.0 6.2,3.4 6.5,3.0 6.3,2.5 6.7,3.0 6.7,3.3 6.8,3.2 5.8,2.7 6.9,3.1 6.7,3.1 6.9,3.1 6.0,3.0 6.4,3.1 6.3,3.4 7.7,3.0 6.1,2.6 6.3,2.8 6.4,2.8 7.9,3.8 7.4,2.8 7.2,3.0 6.4,2.8 6.1,3.0 6.2,2.8 7.2,3.2 6.7,3.3 6.3,2.7 7.7,2.8 5.6,2.8 6.9,3.2 6.0,2.2 7.7,2.6 7.7,3.8 6.5,3.0 6.4,3.2 5.8,2.8 5.7,2.5 6.8,3.0 6.4,2.7 6.5,3.2 7.2,3.6 6.7,2.5 7.3,2.9 4.9,2.5 7.6,3.0 6.5,3.0 6.3,2.9 7.1,3.0 5.8,2.7 6.3,3.3 5.7,2.8 5.1,2.5 6.2,2.9 5.7,2.9 5.7,3.0 5.6,2.7 5.0,2.3 5.8,2.6 6.1,3.0 5.5,2.6 5.5,2.5 5.6,3.0 6.3,2.3 6.7,3.1 6.0,3.4 5.4,3.0 6.0,2.7 5.8,2.7 5.5,2.4 5.5,2.4 5.7,2.6 6.0,2.9 6.7,3.0 6.8,2.8 6.6,3.0 6.4,2.9 6.1,2.8 6.3,2.5 6.1,2.8 5.9,3.2 5.6,2.5 6.2,2.2 5.8,2.7 5.6,3.0 6.7,3.1 5.6,2.9 6.1,2.9 6.0,2.2 5.9,3.0 5.0,2.0 5.2,2.7 6.6,2.9 4.9,2.4 6.3,3.3 5.7,2.8 6.5,2.8 5.5,2.3 6.9,3.1 6.4,3.2 7.0,3.2 5.0,3.3 5.3,3.7 4.6,3.2 5.1,3.8 4.8,3.0 5.1,3.8 5.0,3.5 4.4,3.2 4.5,2.3 5.0,3.5 5.1,3.4 4.4,3.0 4.9,3.6 5.5,3.5 5.0,3.2 4.9,3.1 5.5,4.2 5.2,4.1 5.4,3.4 4.8,3.1 4.7,3.2 5.2,3.4 5.2,3.5 5.0,3.4 5.0,3.0 4.8,3.4 5.1,3.3 4.6,3.6 5.1,3.7 5.4,3.4 5.1,3.8 5.7,3.8 5.1,3.5 5.4,3.9 5.7,4.4 5.8,4.0 4.3,3.0 4.8,3.0 4.8,3.4 5.4,3.7 4.9,3.1 4.4,2.9 5.0,3.4 4.6,3.4 5.4,3.9 5.0,3.6 4.6,3.1 4.7,3.2 4.9,3.0 5.1,3.5 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 2.0 2.5 3.0 3.5 4.0 4.5 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 1.99 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.35 2.36 2.37 2.38 2.39 2.40 2.41 2.42 2.43 2.44 2.45 2.46 2.47 2.48 2.49 2.50 2.51 2.52 2.53 2.54 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 2.66 2.67 2.68 2.69 2.70 2.71 2.72 2.73 2.74 2.75 2.76 2.77 2.78 2.79 2.80 2.81 2.82 2.83 2.84 2.85 2.86 2.87 2.88 2.89 2.90 2.91 2.92 2.93 2.94 2.95 2.96 2.97 2.98 2.99 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29 3.30 3.31 3.32 3.33 3.34 3.35 3.36 3.37 3.38 3.39 3.40 3.41 3.42 3.43 3.44 3.45 3.46 3.47 3.48 3.49 3.50 3.51 3.52 3.53 3.54 3.55 3.56 3.57 3.58 3.59 3.60 3.61 3.62 3.63 3.64 3.65 3.66 3.67 3.68 3.69 3.70 3.71 3.72 3.73 3.74 3.75 3.76 3.77 3.78 3.79 3.80 3.81 3.82 3.83 3.84 3.85 3.86 3.87 3.88 3.89 3.90 3.91 3.92 3.93 3.94 3.95 3.96 3.97 3.98 3.99 4.00 4.01 4.02 4.03 4.04 4.05 4.06 4.07 4.08 4.09 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.30 4.31 4.32 4.33 4.34 4.35 4.36 4.37 4.38 4.39 4.40 4.41 4.42 4.43 4.44 4.45 4.46 4.47 4.48 4.49 4.50 2 3 4 5 SepalWidth

This is the grammar of graphics equivalent of "colorless green ideas sleep furiously". It is valid grammar, but not particularly meaningful.

Arrays

If by chance your data are stored in Arrays instead of a DataFrame, fear not, identical plots can be created using an alternate plot signature:

plot(elements::Element...; aesthetics...)

Here, the keyword arguments directly supply the data to be plotted, instead of using them to indicate which columns of a DataFrame to use.

SepalLength = iris.SepalLength
SepalWidth = iris.SepalWidth
plot(x=SepalLength, y=SepalWidth, Geom.point,
     Guide.xlabel("SepalLength"), Guide.ylabel("SepalWidth"))

Note that with the Array interface, extra elements must be included to specify the axis labels, whereas with a DataFrame they default to the column names.

Aesthetics

Let's do add something meaningful by mapping the color aesthetic.

plot(iris, x=:SepalLength, y=:SepalWidth, color=:Species, Geom.point);

# or equivalently for Arrays:
Color = iris.Species
plot(x=SepalLength, y=SepalWidth, color=Color, Geom.point,
     Guide.xlabel("SepalLength"), Guide.ylabel("SepalWidth"),
     Guide.colorkey(title="Species"))
SepalLength 4 5 6 7 8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 7.2 7.4 7.6 7.8 8.0 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 5.32 5.34 5.36 5.38 5.40 5.42 5.44 5.46 5.48 5.50 5.52 5.54 5.56 5.58 5.60 5.62 5.64 5.66 5.68 5.70 5.72 5.74 5.76 5.78 5.80 5.82 5.84 5.86 5.88 5.90 5.92 5.94 5.96 5.98 6.00 6.02 6.04 6.06 6.08 6.10 6.12 6.14 6.16 6.18 6.20 6.22 6.24 6.26 6.28 6.30 6.32 6.34 6.36 6.38 6.40 6.42 6.44 6.46 6.48 6.50 6.52 6.54 6.56 6.58 6.60 6.62 6.64 6.66 6.68 6.70 6.72 6.74 6.76 6.78 6.80 6.82 6.84 6.86 6.88 6.90 6.92 6.94 6.96 6.98 7.00 7.02 7.04 7.06 7.08 7.10 7.12 7.14 7.16 7.18 7.20 7.22 7.24 7.26 7.28 7.30 7.32 7.34 7.36 7.38 7.40 7.42 7.44 7.46 7.48 7.50 7.52 7.54 7.56 7.58 7.60 7.62 7.64 7.66 7.68 7.70 7.72 7.74 7.76 7.78 7.80 7.82 7.84 7.86 7.88 7.90 7.92 7.94 7.96 7.98 8.00 4 6 8 setosa versicolor virginica Species 5.9,3.0 6.2,3.4 6.5,3.0 6.3,2.5 6.7,3.0 6.7,3.3 6.8,3.2 5.8,2.7 6.9,3.1 6.7,3.1 6.9,3.1 6.0,3.0 6.4,3.1 6.3,3.4 7.7,3.0 6.1,2.6 6.3,2.8 6.4,2.8 7.9,3.8 7.4,2.8 7.2,3.0 6.4,2.8 6.1,3.0 6.2,2.8 7.2,3.2 6.7,3.3 6.3,2.7 7.7,2.8 5.6,2.8 6.9,3.2 6.0,2.2 7.7,2.6 7.7,3.8 6.5,3.0 6.4,3.2 5.8,2.8 5.7,2.5 6.8,3.0 6.4,2.7 6.5,3.2 7.2,3.6 6.7,2.5 7.3,2.9 4.9,2.5 7.6,3.0 6.5,3.0 6.3,2.9 7.1,3.0 5.8,2.7 6.3,3.3 5.7,2.8 5.1,2.5 6.2,2.9 5.7,2.9 5.7,3.0 5.6,2.7 5.0,2.3 5.8,2.6 6.1,3.0 5.5,2.6 5.5,2.5 5.6,3.0 6.3,2.3 6.7,3.1 6.0,3.4 5.4,3.0 6.0,2.7 5.8,2.7 5.5,2.4 5.5,2.4 5.7,2.6 6.0,2.9 6.7,3.0 6.8,2.8 6.6,3.0 6.4,2.9 6.1,2.8 6.3,2.5 6.1,2.8 5.9,3.2 5.6,2.5 6.2,2.2 5.8,2.7 5.6,3.0 6.7,3.1 5.6,2.9 6.1,2.9 6.0,2.2 5.9,3.0 5.0,2.0 5.2,2.7 6.6,2.9 4.9,2.4 6.3,3.3 5.7,2.8 6.5,2.8 5.5,2.3 6.9,3.1 6.4,3.2 7.0,3.2 5.0,3.3 5.3,3.7 4.6,3.2 5.1,3.8 4.8,3.0 5.1,3.8 5.0,3.5 4.4,3.2 4.5,2.3 5.0,3.5 5.1,3.4 4.4,3.0 4.9,3.6 5.5,3.5 5.0,3.2 4.9,3.1 5.5,4.2 5.2,4.1 5.4,3.4 4.8,3.1 4.7,3.2 5.2,3.4 5.2,3.5 5.0,3.4 5.0,3.0 4.8,3.4 5.1,3.3 4.6,3.6 5.1,3.7 5.4,3.4 5.1,3.8 5.7,3.8 5.1,3.5 5.4,3.9 5.7,4.4 5.8,4.0 4.3,3.0 4.8,3.0 4.8,3.4 5.4,3.7 4.9,3.1 4.4,2.9 5.0,3.4 4.6,3.4 5.4,3.9 5.0,3.6 4.6,3.1 4.7,3.2 4.9,3.0 5.1,3.5 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 2.0 2.5 3.0 3.5 4.0 4.5 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 1.99 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.35 2.36 2.37 2.38 2.39 2.40 2.41 2.42 2.43 2.44 2.45 2.46 2.47 2.48 2.49 2.50 2.51 2.52 2.53 2.54 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 2.66 2.67 2.68 2.69 2.70 2.71 2.72 2.73 2.74 2.75 2.76 2.77 2.78 2.79 2.80 2.81 2.82 2.83 2.84 2.85 2.86 2.87 2.88 2.89 2.90 2.91 2.92 2.93 2.94 2.95 2.96 2.97 2.98 2.99 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29 3.30 3.31 3.32 3.33 3.34 3.35 3.36 3.37 3.38 3.39 3.40 3.41 3.42 3.43 3.44 3.45 3.46 3.47 3.48 3.49 3.50 3.51 3.52 3.53 3.54 3.55 3.56 3.57 3.58 3.59 3.60 3.61 3.62 3.63 3.64 3.65 3.66 3.67 3.68 3.69 3.70 3.71 3.72 3.73 3.74 3.75 3.76 3.77 3.78 3.79 3.80 3.81 3.82 3.83 3.84 3.85 3.86 3.87 3.88 3.89 3.90 3.91 3.92 3.93 3.94 3.95 3.96 3.97 3.98 3.99 4.00 4.01 4.02 4.03 4.04 4.05 4.06 4.07 4.08 4.09 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.30 4.31 4.32 4.33 4.34 4.35 4.36 4.37 4.38 4.39 4.40 4.41 4.42 4.43 4.44 4.45 4.46 4.47 4.48 4.49 4.50 2 3 4 5 SepalWidth

Ah, a scientific discovery: Setosa has short but wide sepals!

Color scales in Gadfly by default are produced from perceptually uniform colorspaces (LUV/LCHuv or LAB/LCHab), though it supports RGB, HSV, HLS, XYZ, and converts arbitrarily between these. Color values can also be specified by most names common to CSS or X11, e.g. "oldlace" or "aliceblue". The full list of valid color names is defined in the Colors.jl library.

Color, and other aesthetics, can also be mapped by using arrays with group labels or functional types e.g. ["group label"] or [colorant"red"]. ["Group labels"] are added to the key.

y1 = [0.1, 0.26, NaN, 0.5, 0.4, NaN, 0.48, 0.58, 0.83]
plot(x=1:9, y=y1, Geom.line, Geom.point,
        color=["Item 1"], linestyle=[:dash], size=[3pt],
    layer(x=1:10, y=rand(10), Geom.line, Geom.point,
        color=["Item 2"], size=[5pt], shape=[Shape.square]),
    layer(x=1:10, y=rand(10), color=[colorant"hotpink"],
        linestyle=[[8pt, 3pt, 2pt, 3pt]], Geom.line))
x 0.0 2.5 5.0 7.5 10.0 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00 4.05 4.10 4.15 4.20 4.25 4.30 4.35 4.40 4.45 4.50 4.55 4.60 4.65 4.70 4.75 4.80 4.85 4.90 4.95 5.00 5.05 5.10 5.15 5.20 5.25 5.30 5.35 5.40 5.45 5.50 5.55 5.60 5.65 5.70 5.75 5.80 5.85 5.90 5.95 6.00 6.05 6.10 6.15 6.20 6.25 6.30 6.35 6.40 6.45 6.50 6.55 6.60 6.65 6.70 6.75 6.80 6.85 6.90 6.95 7.00 7.05 7.10 7.15 7.20 7.25 7.30 7.35 7.40 7.45 7.50 7.55 7.60 7.65 7.70 7.75 7.80 7.85 7.90 7.95 8.00 8.05 8.10 8.15 8.20 8.25 8.30 8.35 8.40 8.45 8.50 8.55 8.60 8.65 8.70 8.75 8.80 8.85 8.90 8.95 9.00 9.05 9.10 9.15 9.20 9.25 9.30 9.35 9.40 9.45 9.50 9.55 9.60 9.65 9.70 9.75 9.80 9.85 9.90 9.95 10.00 0 10 Item 1 Item 2 Color 100.04182509610383045 90.3328129509234997 80.5603972086851433 70.9377612026540267 60.8694499414235881 50.9760142153257741 40.8005481597758632 30.019622181022206142 20.9564332314556059 10.24822076502525248 9,0.83 8,0.58 7,0.48 6,NaN 5,0.4 4,0.5 3,NaN 2,0.26 1,0.1 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0.0 0.5 1.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.000 0.005 0.010 0.015 0.020 0.025 0.030 0.035 0.040 0.045 0.050 0.055 0.060 0.065 0.070 0.075 0.080 0.085 0.090 0.095 0.100 0.105 0.110 0.115 0.120 0.125 0.130 0.135 0.140 0.145 0.150 0.155 0.160 0.165 0.170 0.175 0.180 0.185 0.190 0.195 0.200 0.205 0.210 0.215 0.220 0.225 0.230 0.235 0.240 0.245 0.250 0.255 0.260 0.265 0.270 0.275 0.280 0.285 0.290 0.295 0.300 0.305 0.310 0.315 0.320 0.325 0.330 0.335 0.340 0.345 0.350 0.355 0.360 0.365 0.370 0.375 0.380 0.385 0.390 0.395 0.400 0.405 0.410 0.415 0.420 0.425 0.430 0.435 0.440 0.445 0.450 0.455 0.460 0.465 0.470 0.475 0.480 0.485 0.490 0.495 0.500 0.505 0.510 0.515 0.520 0.525 0.530 0.535 0.540 0.545 0.550 0.555 0.560 0.565 0.570 0.575 0.580 0.585 0.590 0.595 0.600 0.605 0.610 0.615 0.620 0.625 0.630 0.635 0.640 0.645 0.650 0.655 0.660 0.665 0.670 0.675 0.680 0.685 0.690 0.695 0.700 0.705 0.710 0.715 0.720 0.725 0.730 0.735 0.740 0.745 0.750 0.755 0.760 0.765 0.770 0.775 0.780 0.785 0.790 0.795 0.800 0.805 0.810 0.815 0.820 0.825 0.830 0.835 0.840 0.845 0.850 0.855 0.860 0.865 0.870 0.875 0.880 0.885 0.890 0.895 0.900 0.905 0.910 0.915 0.920 0.925 0.930 0.935 0.940 0.945 0.950 0.955 0.960 0.965 0.970 0.975 0.980 0.985 0.990 0.995 1.000 0 1 y

All aesthetics have a Scale e.g. Scale.x_continuous() and some have a Guide e.g. Guide.xticks(). Scales can be continuous or discrete. Some Scales also have a corresponding palette in Theme().

Continuous Scales

AestheticScale.Guide.Theme palette
xx_continuousxticks
yy_continuousyticks
colorcolor_continuouscolorkey(tbd)
sizesize_continuous–-point_size_min, point_size_max
size_radiussizekeycontinuous_sizemap
alphaalpha_continuousalphakey (tbd)

e.g. Scale.x_continuous(format= , minvalue= , maxvalue= )
format can be: :plain, :scientific, :engineering, or :auto.

Continuous scales can be transformed. In the next plot, the large animals are ruining things for us. Putting both axes on a log-scale clears things up.

set_default_plot_size(21cm ,8cm)
mammals = dataset("MASS", "mammals")
p1 = plot(mammals, x=:Body, y=:Brain, label=:Mammal, Geom.point, Geom.label)
p2 = plot(mammals, x=:Body, y=:Brain, label=:Mammal, Geom.point, Geom.label,
     Scale.x_log10, Scale.y_log10)
hstack(p1, p2)
Body 10-4 10-2 100 102 104 10-4.0 10-3.5 10-3.0 10-2.5 10-2.0 10-1.5 10-1.0 10-0.5 100.0 100.5 101.0 101.5 102.0 102.5 103.0 103.5 104.0 10-4.00 10-3.95 10-3.90 10-3.85 10-3.80 10-3.75 10-3.70 10-3.65 10-3.60 10-3.55 10-3.50 10-3.45 10-3.40 10-3.35 10-3.30 10-3.25 10-3.20 10-3.15 10-3.10 10-3.05 10-3.00 10-2.95 10-2.90 10-2.85 10-2.80 10-2.75 10-2.70 10-2.65 10-2.60 10-2.55 10-2.50 10-2.45 10-2.40 10-2.35 10-2.30 10-2.25 10-2.20 10-2.15 10-2.10 10-2.05 10-2.00 10-1.95 10-1.90 10-1.85 10-1.80 10-1.75 10-1.70 10-1.65 10-1.60 10-1.55 10-1.50 10-1.45 10-1.40 10-1.35 10-1.30 10-1.25 10-1.20 10-1.15 10-1.10 10-1.05 10-1.00 10-0.95 10-0.90 10-0.85 10-0.80 10-0.75 10-0.70 10-0.65 10-0.60 10-0.55 10-0.50 10-0.45 10-0.40 10-0.35 10-0.30 10-0.25 10-0.20 10-0.15 10-0.10 10-0.05 100.00 100.05 100.10 100.15 100.20 100.25 100.30 100.35 100.40 100.45 100.50 100.55 100.60 100.65 100.70 100.75 100.80 100.85 100.90 100.95 101.00 101.05 101.10 101.15 101.20 101.25 101.30 101.35 101.40 101.45 101.50 101.55 101.60 101.65 101.70 101.75 101.80 101.85 101.90 101.95 102.00 102.05 102.10 102.15 102.20 102.25 102.30 102.35 102.40 102.45 102.50 102.55 102.60 102.65 102.70 102.75 102.80 102.85 102.90 102.95 103.00 103.05 103.10 103.15 103.20 103.25 103.30 103.35 103.40 103.45 103.50 103.55 103.60 103.65 103.70 103.75 103.80 103.85 103.90 103.95 104.00 10-5 100 105 Arctic fox Owl monkey Mountain beaver Cow Grey wolf Goat Roe deer Guinea pig Verbet Chinchilla Ground squirrel Arctic ground squirrel African giant pouched rat Lesser short-tailed shrew Star-nosed mole Nine-banded armadillo Tree hyrax N.A. opossum Asian elephant Big brown bat Donkey Horse European hedgehog Patas monkey Cat Galago Genet Giraffe Gorilla Grey seal Rock hyrax-a Human African elephant Water opossum Rhesus monkey Kangaroo Yellow-bellied marmot Golden hamster Mouse Little brown bat Slow loris Okapi Rabbit Sheep Jaguar Chimpanzee Baboon Desert hedgehog Giant armadillo Rock hyrax-b Raccoon Rat E. American mole Mole rat Musk shrew Pig Echidna Brazilian tapir Tenrec Phalanger Tree shrew Red fox 0.62685341466672571.7024305364455252 -0.98296666070121960.3979400086720376 0.209515014542630971.0569048513364727 -0.0457574905606751150.414973347970818 2.20411998265592462.2278867046136734 0.477121254719662441.3979400086720377 2.28330122870354972.255272505103306 -1.3187587626244128-0.4814860601221125 -0.91364016932525180.47712125471966244 -1.12493873660830.07918124604762482 -0.55284196865778080.2787536009528289 0.63225477668471361.5932860670204574 0.55630250076728731.3222192947339193 1.77815125038364361.9084850188786497 -0.25963731050575610.38021124171160603 1.02325245963371162.254064452914338 1.71733758272386372.6434526764861874 2.02.1958996524092336 1.74429298312267632.2430380486862944 0.39794000867203761.08278537031645 2.39794000867203752.690196080028514 0.1461280356782381.0969100130080565 -2.0-0.6020599913279624 -1.6382721639824072-0.3979400086720376 -0.92081875395237520.0 0.60745502321466851.2304489213782739 1.54406804435027571.7481880270062005 0.83250891270623632.2528530309798933 0.54406804435027570.5910646070264992 3.82308279653280363.7567881987681178 1.7923916894982543.12057393120585 -0.124938736608299951.089905111439398 1.92941892571429262.5118833609788744 2.3159703454569182.6085260335771943 2.72345567203518572.832508912706236 0.149219112655379881.2430380486862944 -0.69897000433601870.6989700043360189 0.51851393987788741.4082399653118496 1.02.060697840353612 -0.105130343254747450.5440680443502757 2.71683772329952472.816241299991783 2.272073787500012.622214022966295 -1.6382721639824072-0.5228787452803376 3.4060289449636153.663040974893974 0.23044892137827390.7993405494535817 0.30102999566398121.089905111439398 0.54406804435027571.0334237554869496 -1.22184874961635640.0 -2.3010299956639813-0.8538719643217619 0.00.8195439355418687 -0.0362121726544447150.7558748556724915 -0.99567862621735740.6020599913279624 -0.371611069949688460.8061799739838872 0.62221402296629541.7634279935629373 0.017033339298780370.7403626894942439 1.1711411510283821.9921114877869497 1.44185217577329182.060697840353612 1.56026539786271462.0773679052841563 2.6674529528899542.6263403673750423 0.130333768495006140.9084850188786497 -0.31875876262441281.1903316981702914 0.52955867302116311.6483600109809315 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 10-1 100 101 102 103 104 10-1.0 10-0.8 10-0.6 10-0.4 10-0.2 100.0 100.2 100.4 100.6 100.8 101.0 101.2 101.4 101.6 101.8 102.0 102.2 102.4 102.6 102.8 103.0 103.2 103.4 103.6 103.8 104.0 10-1.00 10-0.98 10-0.96 10-0.94 10-0.92 10-0.90 10-0.88 10-0.86 10-0.84 10-0.82 10-0.80 10-0.78 10-0.76 10-0.74 10-0.72 10-0.70 10-0.68 10-0.66 10-0.64 10-0.62 10-0.60 10-0.58 10-0.56 10-0.54 10-0.52 10-0.50 10-0.48 10-0.46 10-0.44 10-0.42 10-0.40 10-0.38 10-0.36 10-0.34 10-0.32 10-0.30 10-0.28 10-0.26 10-0.24 10-0.22 10-0.20 10-0.18 10-0.16 10-0.14 10-0.12 10-0.10 10-0.08 10-0.06 10-0.04 10-0.02 100.00 100.02 100.04 100.06 100.08 100.10 100.12 100.14 100.16 100.18 100.20 100.22 100.24 100.26 100.28 100.30 100.32 100.34 100.36 100.38 100.40 100.42 100.44 100.46 100.48 100.50 100.52 100.54 100.56 100.58 100.60 100.62 100.64 100.66 100.68 100.70 100.72 100.74 100.76 100.78 100.80 100.82 100.84 100.86 100.88 100.90 100.92 100.94 100.96 100.98 101.00 101.02 101.04 101.06 101.08 101.10 101.12 101.14 101.16 101.18 101.20 101.22 101.24 101.26 101.28 101.30 101.32 101.34 101.36 101.38 101.40 101.42 101.44 101.46 101.48 101.50 101.52 101.54 101.56 101.58 101.60 101.62 101.64 101.66 101.68 101.70 101.72 101.74 101.76 101.78 101.80 101.82 101.84 101.86 101.88 101.90 101.92 101.94 101.96 101.98 102.00 102.02 102.04 102.06 102.08 102.10 102.12 102.14 102.16 102.18 102.20 102.22 102.24 102.26 102.28 102.30 102.32 102.34 102.36 102.38 102.40 102.42 102.44 102.46 102.48 102.50 102.52 102.54 102.56 102.58 102.60 102.62 102.64 102.66 102.68 102.70 102.72 102.74 102.76 102.78 102.80 102.82 102.84 102.86 102.88 102.90 102.92 102.94 102.96 102.98 103.00 103.02 103.04 103.06 103.08 103.10 103.12 103.14 103.16 103.18 103.20 103.22 103.24 103.26 103.28 103.30 103.32 103.34 103.36 103.38 103.40 103.42 103.44 103.46 103.48 103.50 103.52 103.54 103.56 103.58 103.60 103.62 103.64 103.66 103.68 103.70 103.72 103.74 103.76 103.78 103.80 103.82 103.84 103.86 103.88 103.90 103.92 103.94 103.96 103.98 104.00 10-2 100 102 104 Brain Body 0 2000 4000 6000 8000 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 5500 6000 6500 7000 7500 8000 0 50 100 150 200 250 300 350 400 450 500 550 600 650 700 750 800 850 900 950 1000 1050 1100 1150 1200 1250 1300 1350 1400 1450 1500 1550 1600 1650 1700 1750 1800 1850 1900 1950 2000 2050 2100 2150 2200 2250 2300 2350 2400 2450 2500 2550 2600 2650 2700 2750 2800 2850 2900 2950 3000 3050 3100 3150 3200 3250 3300 3350 3400 3450 3500 3550 3600 3650 3700 3750 3800 3850 3900 3950 4000 4050 4100 4150 4200 4250 4300 4350 4400 4450 4500 4550 4600 4650 4700 4750 4800 4850 4900 4950 5000 5050 5100 5150 5200 5250 5300 5350 5400 5450 5500 5550 5600 5650 5700 5750 5800 5850 5900 5950 6000 6050 6100 6150 6200 6250 6300 6350 6400 6450 6500 6550 6600 6650 6700 6750 6800 6850 6900 6950 7000 7050 7100 7150 7200 7250 7300 7350 7400 7450 7500 7550 7600 7650 7700 7750 7800 7850 7900 7950 8000 0 10000 Arctic fox Owl monkey Mountain beaver Cow Grey wolf Goat Roe deer Guinea pig Verbet Chinchilla Ground squirrel Arctic ground squirrel African giant pouched rat Lesser short-tailed shrew Star-nosed mole Nine-banded armadillo Tree hyrax N.A. opossum Asian elephant Big brown bat Donkey Horse European hedgehog Patas monkey Cat Galago Genet Giraffe Gorilla Grey seal Rock hyrax-a Human African elephant Water opossum Rhesus monkey Kangaroo Yellow-bellied marmot Golden hamster Mouse Little brown bat Slow loris Okapi Rabbit Sheep Jaguar Chimpanzee Baboon Desert hedgehog Giant armadillo Rock hyrax-b Raccoon Rat E. American mole Mole rat Musk shrew Pig Echidna Brazilian tapir Tenrec Phalanger Tree shrew Red fox 4.235,50.4 0.104,2.5 1.62,11.4 0.9,2.6 160.0169.0 3.0,25.0 192.0180.0 0.048,0.33 0.122,3.0 0.075,1.2 0.28,1.9 4.288,39.2 3.6,21.0 60.0,81.0 0.55,2.4 10.55179.5 52.16440.0 100.0157.0 55.5,175.0 2.5,12.1 250.0490.0 1.4,12.5 0.01,0.25 0.023,0.4 0.12,1.0 4.05,17.0 35.0,56.0 6.8,179.0 3.5,3.9 6654.05712.0 62.01320.0 0.75,12.3 85.0,325.0 207.0406.0 529.0680.0 1.41,17.5 0.2,5.0 3.3,25.6 10.0,115.0 0.785,3.5 521.0655.0 187.1419.0 0.023,0.3 2547.04603.0 1.7,6.3 2.0,12.3 3.5,10.8 0.06,1.0 0.005,0.14 1.0,6.6 0.92,5.7 0.101,4.0 0.425,6.4 4.19,58.0 1.04,5.5 14.83,98.2 27.66115.0 36.33119.5 465.0423.0 1.35,8.1 0.48,15.5 3.385,44.5 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0 1000 2000 3000 4000 5000 6000 0 250 500 750 1000 1250 1500 1750 2000 2250 2500 2750 3000 3250 3500 3750 4000 4250 4500 4750 5000 5250 5500 5750 6000 0 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 920 940 960 980 1000 1020 1040 1060 1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 1500 1520 1540 1560 1580 1600 1620 1640 1660 1680 1700 1720 1740 1760 1780 1800 1820 1840 1860 1880 1900 1920 1940 1960 1980 2000 2020 2040 2060 2080 2100 2120 2140 2160 2180 2200 2220 2240 2260 2280 2300 2320 2340 2360 2380 2400 2420 2440 2460 2480 2500 2520 2540 2560 2580 2600 2620 2640 2660 2680 2700 2720 2740 2760 2780 2800 2820 2840 2860 2880 2900 2920 2940 2960 2980 3000 3020 3040 3060 3080 3100 3120 3140 3160 3180 3200 3220 3240 3260 3280 3300 3320 3340 3360 3380 3400 3420 3440 3460 3480 3500 3520 3540 3560 3580 3600 3620 3640 3660 3680 3700 3720 3740 3760 3780 3800 3820 3840 3860 3880 3900 3920 3940 3960 3980 4000 4020 4040 4060 4080 4100 4120 4140 4160 4180 4200 4220 4240 4260 4280 4300 4320 4340 4360 4380 4400 4420 4440 4460 4480 4500 4520 4540 4560 4580 4600 4620 4640 4660 4680 4700 4720 4740 4760 4780 4800 4820 4840 4860 4880 4900 4920 4940 4960 4980 5000 5020 5040 5060 5080 5100 5120 5140 5160 5180 5200 5220 5240 5260 5280 5300 5320 5340 5360 5380 5400 5420 5440 5460 5480 5500 5520 5540 5560 5580 5600 5620 5640 5660 5680 5700 5720 5740 5760 5780 5800 5820 5840 5860 5880 5900 5920 5940 5960 5980 6000 0 10000 Brain

Scale transformations include: _sqrt, _log, _log2, _log10, _asinh for the x, y, color aesthetics, and _area for the size aesthetic.

using Printf
Diamonds = dataset("ggplot2","diamonds")
p3= plot(Diamonds, x=:Price, y=:Carat, Geom.histogram2d(xbincount=25, ybincount=25),
    Scale.x_continuous(format=:engineering) )
p4= plot(Diamonds, x=:Price, y=:Carat, Geom.histogram2d(xbincount=25, ybincount=25),
    Scale.x_continuous(format=:plain),
    Scale.y_sqrt(labels=y->@sprintf("%i", y^2)),
    Scale.color_log10(minvalue=1.0, maxvalue=10^4),
    Guide.yticks(ticks=sqrt.(0:5)) )
hstack(p3, p4)
Price 0 5000 10000 15000 20000 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000 13000 14000 15000 16000 17000 18000 19000 20000 0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 5900 6000 6100 6200 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11900 12000 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13700 13800 13900 14000 14100 14200 14300 14400 14500 14600 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15800 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16900 17000 17100 17200 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 18300 18400 18500 18600 18700 18800 18900 19000 19100 19200 19300 19400 19500 19600 19700 19800 19900 20000 0 20000 104 100 101 102 103 Count h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0 1 2 3 4 5 Carat Price 0 5.00×10³ 10.0×10³ 15.0×10³ 20.0×10³ 0 1.00×10³ 2.00×10³ 3.00×10³ 4.00×10³ 5.00×10³ 6.00×10³ 7.00×10³ 8.00×10³ 9.00×10³ 10.0×10³ 11.0×10³ 12.0×10³ 13.0×10³ 14.0×10³ 15.0×10³ 16.0×10³ 17.0×10³ 18.0×10³ 19.0×10³ 20.0×10³ 0 100.0×10⁰ 200.0×10⁰ 300.0×10⁰ 400.0×10⁰ 500.0×10⁰ 600.0×10⁰ 700.0×10⁰ 800.0×10⁰ 900.0×10⁰ 1.000×10³ 1.100×10³ 1.200×10³ 1.300×10³ 1.400×10³ 1.500×10³ 1.600×10³ 1.700×10³ 1.800×10³ 1.900×10³ 2.000×10³ 2.100×10³ 2.200×10³ 2.300×10³ 2.400×10³ 2.500×10³ 2.600×10³ 2.700×10³ 2.800×10³ 2.900×10³ 3.000×10³ 3.100×10³ 3.200×10³ 3.300×10³ 3.400×10³ 3.500×10³ 3.600×10³ 3.700×10³ 3.800×10³ 3.900×10³ 4.000×10³ 4.100×10³ 4.200×10³ 4.300×10³ 4.400×10³ 4.500×10³ 4.600×10³ 4.700×10³ 4.800×10³ 4.900×10³ 5.000×10³ 5.100×10³ 5.200×10³ 5.300×10³ 5.400×10³ 5.500×10³ 5.600×10³ 5.700×10³ 5.800×10³ 5.900×10³ 6.000×10³ 6.100×10³ 6.200×10³ 6.300×10³ 6.400×10³ 6.500×10³ 6.600×10³ 6.700×10³ 6.800×10³ 6.900×10³ 7.000×10³ 7.100×10³ 7.200×10³ 7.300×10³ 7.400×10³ 7.500×10³ 7.600×10³ 7.700×10³ 7.800×10³ 7.900×10³ 8.000×10³ 8.100×10³ 8.200×10³ 8.300×10³ 8.400×10³ 8.500×10³ 8.600×10³ 8.700×10³ 8.800×10³ 8.900×10³ 9.000×10³ 9.100×10³ 9.200×10³ 9.300×10³ 9.400×10³ 9.500×10³ 9.600×10³ 9.700×10³ 9.800×10³ 9.900×10³ 10.00×10³ 10.10×10³ 10.20×10³ 10.30×10³ 10.40×10³ 10.50×10³ 10.60×10³ 10.70×10³ 10.80×10³ 10.90×10³ 11.00×10³ 11.10×10³ 11.20×10³ 11.30×10³ 11.40×10³ 11.50×10³ 11.60×10³ 11.70×10³ 11.80×10³ 11.90×10³ 12.00×10³ 12.10×10³ 12.20×10³ 12.30×10³ 12.40×10³ 12.50×10³ 12.60×10³ 12.70×10³ 12.80×10³ 12.90×10³ 13.00×10³ 13.10×10³ 13.20×10³ 13.30×10³ 13.40×10³ 13.50×10³ 13.60×10³ 13.70×10³ 13.80×10³ 13.90×10³ 14.00×10³ 14.10×10³ 14.20×10³ 14.30×10³ 14.40×10³ 14.50×10³ 14.60×10³ 14.70×10³ 14.80×10³ 14.90×10³ 15.00×10³ 15.10×10³ 15.20×10³ 15.30×10³ 15.40×10³ 15.50×10³ 15.60×10³ 15.70×10³ 15.80×10³ 15.90×10³ 16.00×10³ 16.10×10³ 16.20×10³ 16.30×10³ 16.40×10³ 16.50×10³ 16.60×10³ 16.70×10³ 16.80×10³ 16.90×10³ 17.00×10³ 17.10×10³ 17.20×10³ 17.30×10³ 17.40×10³ 17.50×10³ 17.60×10³ 17.70×10³ 17.80×10³ 17.90×10³ 18.00×10³ 18.10×10³ 18.20×10³ 18.30×10³ 18.40×10³ 18.50×10³ 18.60×10³ 18.70×10³ 18.80×10³ 18.90×10³ 19.00×10³ 19.10×10³ 19.20×10³ 19.30×10³ 19.40×10³ 19.50×10³ 19.60×10³ 19.70×10³ 19.80×10³ 19.90×10³ 20.00×10³ 0 20.×10³ 1.00×10⁴ 1.50×10⁴ 1.00×10⁰ 5.00×10³ Count h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0 1 2 3 4 5 6 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80 0.82 0.84 0.86 0.88 0.90 0.92 0.94 0.96 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.12 1.14 1.16 1.18 1.20 1.22 1.24 1.26 1.28 1.30 1.32 1.34 1.36 1.38 1.40 1.42 1.44 1.46 1.48 1.50 1.52 1.54 1.56 1.58 1.60 1.62 1.64 1.66 1.68 1.70 1.72 1.74 1.76 1.78 1.80 1.82 1.84 1.86 1.88 1.90 1.92 1.94 1.96 1.98 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.14 2.16 2.18 2.20 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.52 2.54 2.56 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.72 2.74 2.76 2.78 2.80 2.82 2.84 2.86 2.88 2.90 2.92 2.94 2.96 2.98 3.00 3.02 3.04 3.06 3.08 3.10 3.12 3.14 3.16 3.18 3.20 3.22 3.24 3.26 3.28 3.30 3.32 3.34 3.36 3.38 3.40 3.42 3.44 3.46 3.48 3.50 3.52 3.54 3.56 3.58 3.60 3.62 3.64 3.66 3.68 3.70 3.72 3.74 3.76 3.78 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 5.32 5.34 5.36 5.38 5.40 5.42 5.44 5.46 5.48 5.50 5.52 5.54 5.56 5.58 5.60 5.62 5.64 5.66 5.68 5.70 5.72 5.74 5.76 5.78 5.80 5.82 5.84 5.86 5.88 5.90 5.92 5.94 5.96 5.98 6.00 0 10 Carat

Discrete Scales

AestheticScale.Guide.Theme palette
xx_discretexticks
yy_discreteyticks
colorcolor_discretecolorkey(tbd)
shapeshape_discreteshapekeypoint_shapes
sizesize_discrete–-point_size_min, point_size_max
size_discrete2sizekeydiscrete_sizemap
linestylelinestyle_discretelinekey (tbd)line_style
alphaalpha_discretealphakey (tbd)alphas
groupgroup_discrete
xgroupxgroup
ygroupygroup

e.g. Scale.shape_discrete(labels= , levels= , order= )

mtcars = dataset("datasets","mtcars")
 labeldict = Dict(4=>"four", 6=>"six", 8=>"eight")
p5 = plot(mtcars, x=:Cyl, color=:Cyl, Geom.histogram,
    Scale.x_discrete(levels=[4,6,8]), Scale.color_discrete(levels=[4,6,8]) )
p6 = plot(mtcars, x=:Cyl, color=:Cyl, Geom.histogram,
    Scale.x_discrete(labels=i->labeldict[i], levels=[8,6,4]),
    Scale.color_discrete(levels=[8,6,4]) )
hstack(p5, p6)
Cyl eight six four 8 6 4 Cyl h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0 5 10 15 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00 4.05 4.10 4.15 4.20 4.25 4.30 4.35 4.40 4.45 4.50 4.55 4.60 4.65 4.70 4.75 4.80 4.85 4.90 4.95 5.00 5.05 5.10 5.15 5.20 5.25 5.30 5.35 5.40 5.45 5.50 5.55 5.60 5.65 5.70 5.75 5.80 5.85 5.90 5.95 6.00 6.05 6.10 6.15 6.20 6.25 6.30 6.35 6.40 6.45 6.50 6.55 6.60 6.65 6.70 6.75 6.80 6.85 6.90 6.95 7.00 7.05 7.10 7.15 7.20 7.25 7.30 7.35 7.40 7.45 7.50 7.55 7.60 7.65 7.70 7.75 7.80 7.85 7.90 7.95 8.00 8.05 8.10 8.15 8.20 8.25 8.30 8.35 8.40 8.45 8.50 8.55 8.60 8.65 8.70 8.75 8.80 8.85 8.90 8.95 9.00 9.05 9.10 9.15 9.20 9.25 9.30 9.35 9.40 9.45 9.50 9.55 9.60 9.65 9.70 9.75 9.80 9.85 9.90 9.95 10.00 10.05 10.10 10.15 10.20 10.25 10.30 10.35 10.40 10.45 10.50 10.55 10.60 10.65 10.70 10.75 10.80 10.85 10.90 10.95 11.00 11.05 11.10 11.15 11.20 11.25 11.30 11.35 11.40 11.45 11.50 11.55 11.60 11.65 11.70 11.75 11.80 11.85 11.90 11.95 12.00 12.05 12.10 12.15 12.20 12.25 12.30 12.35 12.40 12.45 12.50 12.55 12.60 12.65 12.70 12.75 12.80 12.85 12.90 12.95 13.00 13.05 13.10 13.15 13.20 13.25 13.30 13.35 13.40 13.45 13.50 13.55 13.60 13.65 13.70 13.75 13.80 13.85 13.90 13.95 14.00 14.05 14.10 14.15 14.20 14.25 14.30 14.35 14.40 14.45 14.50 14.55 14.60 14.65 14.70 14.75 14.80 14.85 14.90 14.95 15.00 0 20 Cyl 4 6 8 4 6 8 Cyl h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0 5 10 15 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00 4.05 4.10 4.15 4.20 4.25 4.30 4.35 4.40 4.45 4.50 4.55 4.60 4.65 4.70 4.75 4.80 4.85 4.90 4.95 5.00 5.05 5.10 5.15 5.20 5.25 5.30 5.35 5.40 5.45 5.50 5.55 5.60 5.65 5.70 5.75 5.80 5.85 5.90 5.95 6.00 6.05 6.10 6.15 6.20 6.25 6.30 6.35 6.40 6.45 6.50 6.55 6.60 6.65 6.70 6.75 6.80 6.85 6.90 6.95 7.00 7.05 7.10 7.15 7.20 7.25 7.30 7.35 7.40 7.45 7.50 7.55 7.60 7.65 7.70 7.75 7.80 7.85 7.90 7.95 8.00 8.05 8.10 8.15 8.20 8.25 8.30 8.35 8.40 8.45 8.50 8.55 8.60 8.65 8.70 8.75 8.80 8.85 8.90 8.95 9.00 9.05 9.10 9.15 9.20 9.25 9.30 9.35 9.40 9.45 9.50 9.55 9.60 9.65 9.70 9.75 9.80 9.85 9.90 9.95 10.00 10.05 10.10 10.15 10.20 10.25 10.30 10.35 10.40 10.45 10.50 10.55 10.60 10.65 10.70 10.75 10.80 10.85 10.90 10.95 11.00 11.05 11.10 11.15 11.20 11.25 11.30 11.35 11.40 11.45 11.50 11.55 11.60 11.65 11.70 11.75 11.80 11.85 11.90 11.95 12.00 12.05 12.10 12.15 12.20 12.25 12.30 12.35 12.40 12.45 12.50 12.55 12.60 12.65 12.70 12.75 12.80 12.85 12.90 12.95 13.00 13.05 13.10 13.15 13.20 13.25 13.30 13.35 13.40 13.45 13.50 13.55 13.60 13.65 13.70 13.75 13.80 13.85 13.90 13.95 14.00 14.05 14.10 14.15 14.20 14.25 14.30 14.35 14.40 14.45 14.50 14.55 14.60 14.65 14.70 14.75 14.80 14.85 14.90 14.95 15.00 0 20

For discrete scales with a Theme palette, the order of levels and the order of the Theme palette match.

x, y = 0.55*rand(4), 0.55*rand(4)
plot( Coord.cartesian(xmin=0, ymin=0, xmax=1.0, ymax=1.0),
    layer(x=x, y=y, shape=["A"], alpha=["day","day","day","night"]),
    layer(x=1.0.-y[1:3], y=1.0.-x[1:3], shape=["B", "C","C"], alpha=["night"]),
    Scale.shape_discrete(levels=["A","B","C"]),
    Scale.alpha_discrete(levels=["day","night"]),
    Theme(discrete_highlight_color=identity, point_size=12pt,
   point_shapes=[Shape.circle, Shape.star1, Shape.star2], alphas=[0, 1.0],
         default_color="midnightblue" )
)
x 0.0 0.5 1.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.000 0.005 0.010 0.015 0.020 0.025 0.030 0.035 0.040 0.045 0.050 0.055 0.060 0.065 0.070 0.075 0.080 0.085 0.090 0.095 0.100 0.105 0.110 0.115 0.120 0.125 0.130 0.135 0.140 0.145 0.150 0.155 0.160 0.165 0.170 0.175 0.180 0.185 0.190 0.195 0.200 0.205 0.210 0.215 0.220 0.225 0.230 0.235 0.240 0.245 0.250 0.255 0.260 0.265 0.270 0.275 0.280 0.285 0.290 0.295 0.300 0.305 0.310 0.315 0.320 0.325 0.330 0.335 0.340 0.345 0.350 0.355 0.360 0.365 0.370 0.375 0.380 0.385 0.390 0.395 0.400 0.405 0.410 0.415 0.420 0.425 0.430 0.435 0.440 0.445 0.450 0.455 0.460 0.465 0.470 0.475 0.480 0.485 0.490 0.495 0.500 0.505 0.510 0.515 0.520 0.525 0.530 0.535 0.540 0.545 0.550 0.555 0.560 0.565 0.570 0.575 0.580 0.585 0.590 0.595 0.600 0.605 0.610 0.615 0.620 0.625 0.630 0.635 0.640 0.645 0.650 0.655 0.660 0.665 0.670 0.675 0.680 0.685 0.690 0.695 0.700 0.705 0.710 0.715 0.720 0.725 0.730 0.735 0.740 0.745 0.750 0.755 0.760 0.765 0.770 0.775 0.780 0.785 0.790 0.795 0.800 0.805 0.810 0.815 0.820 0.825 0.830 0.835 0.840 0.845 0.850 0.855 0.860 0.865 0.870 0.875 0.880 0.885 0.890 0.895 0.900 0.905 0.910 0.915 0.920 0.925 0.930 0.935 0.940 0.945 0.950 0.955 0.960 0.965 0.970 0.975 0.980 0.985 0.990 0.995 1.000 0 1 A B C Shape 0.51883050913022680.9028530710044848 0.95108209770197850.73479094629243 0.80259067013494090.8694405319468117 0.0193460903144308250.2972390696978554 0.097146928995515290.48116949086977323 0.26520905370756990.0489179022980215 0.13055946805318830.19740932986505907 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0.0 0.5 1.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 0.000 0.005 0.010 0.015 0.020 0.025 0.030 0.035 0.040 0.045 0.050 0.055 0.060 0.065 0.070 0.075 0.080 0.085 0.090 0.095 0.100 0.105 0.110 0.115 0.120 0.125 0.130 0.135 0.140 0.145 0.150 0.155 0.160 0.165 0.170 0.175 0.180 0.185 0.190 0.195 0.200 0.205 0.210 0.215 0.220 0.225 0.230 0.235 0.240 0.245 0.250 0.255 0.260 0.265 0.270 0.275 0.280 0.285 0.290 0.295 0.300 0.305 0.310 0.315 0.320 0.325 0.330 0.335 0.340 0.345 0.350 0.355 0.360 0.365 0.370 0.375 0.380 0.385 0.390 0.395 0.400 0.405 0.410 0.415 0.420 0.425 0.430 0.435 0.440 0.445 0.450 0.455 0.460 0.465 0.470 0.475 0.480 0.485 0.490 0.495 0.500 0.505 0.510 0.515 0.520 0.525 0.530 0.535 0.540 0.545 0.550 0.555 0.560 0.565 0.570 0.575 0.580 0.585 0.590 0.595 0.600 0.605 0.610 0.615 0.620 0.625 0.630 0.635 0.640 0.645 0.650 0.655 0.660 0.665 0.670 0.675 0.680 0.685 0.690 0.695 0.700 0.705 0.710 0.715 0.720 0.725 0.730 0.735 0.740 0.745 0.750 0.755 0.760 0.765 0.770 0.775 0.780 0.785 0.790 0.795 0.800 0.805 0.810 0.815 0.820 0.825 0.830 0.835 0.840 0.845 0.850 0.855 0.860 0.865 0.870 0.875 0.880 0.885 0.890 0.895 0.900 0.905 0.910 0.915 0.920 0.925 0.930 0.935 0.940 0.945 0.950 0.955 0.960 0.965 0.970 0.975 0.980 0.985 0.990 0.995 1.000 0 1 y

Gadfly defaults

If you don't supply Scales or Guides, Gadfly will make an educated guess.

gasoline = dataset("Ecdat", "Gasoline")
plot(gasoline, x=:Year, y=:LGasPCar, color=:Country, Geom.point, Geom.line)
Year 1960 1965 1970 1975 1980 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1960.0 1960.1 1960.2 1960.3 1960.4 1960.5 1960.6 1960.7 1960.8 1960.9 1961.0 1961.1 1961.2 1961.3 1961.4 1961.5 1961.6 1961.7 1961.8 1961.9 1962.0 1962.1 1962.2 1962.3 1962.4 1962.5 1962.6 1962.7 1962.8 1962.9 1963.0 1963.1 1963.2 1963.3 1963.4 1963.5 1963.6 1963.7 1963.8 1963.9 1964.0 1964.1 1964.2 1964.3 1964.4 1964.5 1964.6 1964.7 1964.8 1964.9 1965.0 1965.1 1965.2 1965.3 1965.4 1965.5 1965.6 1965.7 1965.8 1965.9 1966.0 1966.1 1966.2 1966.3 1966.4 1966.5 1966.6 1966.7 1966.8 1966.9 1967.0 1967.1 1967.2 1967.3 1967.4 1967.5 1967.6 1967.7 1967.8 1967.9 1968.0 1968.1 1968.2 1968.3 1968.4 1968.5 1968.6 1968.7 1968.8 1968.9 1969.0 1969.1 1969.2 1969.3 1969.4 1969.5 1969.6 1969.7 1969.8 1969.9 1970.0 1970.1 1970.2 1970.3 1970.4 1970.5 1970.6 1970.7 1970.8 1970.9 1971.0 1971.1 1971.2 1971.3 1971.4 1971.5 1971.6 1971.7 1971.8 1971.9 1972.0 1972.1 1972.2 1972.3 1972.4 1972.5 1972.6 1972.7 1972.8 1972.9 1973.0 1973.1 1973.2 1973.3 1973.4 1973.5 1973.6 1973.7 1973.8 1973.9 1974.0 1974.1 1974.2 1974.3 1974.4 1974.5 1974.6 1974.7 1974.8 1974.9 1975.0 1975.1 1975.2 1975.3 1975.4 1975.5 1975.6 1975.7 1975.8 1975.9 1976.0 1976.1 1976.2 1976.3 1976.4 1976.5 1976.6 1976.7 1976.8 1976.9 1977.0 1977.1 1977.2 1977.3 1977.4 1977.5 1977.6 1977.7 1977.8 1977.9 1978.0 1978.1 1978.2 1978.3 1978.4 1978.5 1978.6 1978.7 1978.8 1978.9 1979.0 1979.1 1979.2 1979.3 1979.4 1979.5 1979.6 1979.7 1979.8 1979.9 1980.0 1960 1980 JAPAN NETHERLA NORWAY SPAIN SWEDEN SWITZERL TURKEY U.K. U.S.A. AUSTRIA BELGIUM CANADA DENMARK FRANCE GERMANY GREECE IRELAND ITALY Country 19784.8184539683 19774.811032467 19764.8148907167 19754.8049322352 19744.7986259444 19734.8463745073 19724.8540732646 19714.8602864749 19704.8484842122 19694.841382713 19684.8341417653 19674.8008834761 19664.8075305603 19654.8059545113 19644.8082735727 19634.7878951522 19624.7989365652 19614.7963170698 19604.8239645123 19784.0003742149 19773.945553345 19763.962305336 19753.9125838579 19743.966961453 19733.995364122 19723.992756786 19713.9836534009 19703.9797051949 19693.948058368 19683.9532027179 19673.9436308491 19663.957212164 19653.968675694 19643.976781186 19633.9852710359 19624.0480509119 19614.0886358 19604.1002442839 19785.1412554768 19775.313462422 19765.312929193 19755.4267771741 19745.42772844 19735.68647036 19725.5788213319 19715.6696463189 19705.72210507 19695.7207051419 19686.0765946269 19676.044478582 19666.156644407 19655.8230458949 19646.064600869 19636.0751291349 19626.0845870211 19616.106212679 19606.1295528491 19784.050047696 19774.100533339 19764.0795721801 19754.120567757 19744.166363739 19734.2298161621 19724.2591593359 19714.280697003 19704.22529671 19694.211290089 19684.2177878429 19674.265918883 19664.2663516041 19654.288713915 19644.3134274369 19634.312484529 19624.2871473959 19614.441329648 19604.397621493 19784.067373445 19774.0310109309 19763.983996505 19753.9738404359 19743.913159154 19734.0305604061 19723.9800657581 19713.982061858 19703.989372472 19693.9917150449 19683.997584757 19673.9973460479 19664.0025573741 19654.015463106 19644.024858515 19634.00276563 19624.0064390159 19614.061869959 19604.063010036 19783.6204438709 19773.6507346971 19763.7108746111 19753.7524488659 19743.768565146 19733.912811545 19723.8912244911 19713.9073442129 19703.96604596 19693.9941031169 19684.0442530621 19674.086322459 19664.113780911 19654.217208979 19644.300577007 19634.346497214 19624.429087629 19614.589239364 19604.7494091723 19784.0024867129 19773.988515537 19763.978209728 19753.9960249669 19743.9603309711 19734.0613489569 19724.077257431 19714.078931746 19704.0888057159 19694.0868228049 19684.103864323 19674.0643140609 19664.0846073869 19654.131633441 19644.164351876 19634.216189342 19624.2342411029 19614.33271925 19604.43504067 19783.8825941949 19773.7766816581 19763.7836345681 19753.718466264 19743.7113837231 19733.8804785129 19723.915296331 19713.9478037431 19703.956407876 19693.987689339 19684.0707346969 19674.119154995 19664.168016513 19654.233001576 19644.31956339 19634.377686978 19624.471717068 19614.559839938 19604.6462680045 19783.9487463871 19773.9646719111 19763.9881620001 19753.995984493 19744.007963901 19734.0938837331 19724.2229757 19714.305623621 19704.401596952 19694.518289907 19684.6846663526 19674.8548612373 19665.0008214407 19655.125850803 19645.275327848 19635.5080817012 19625.6419150489 19615.7584836101 19605.9952865559 19783.3945044428 19773.3802089569 19763.4276288189 19753.5156795149 19743.4994699 19733.6522633939 19723.629243426 19713.6482050719 19703.706871673 19693.737389284 19683.7639029799 19673.7858083619 19663.8227352401 19653.8749851811 19643.936324254 19633.963086271 19624.0289989679 19614.0452481041 19604.050728238 19784.198610729 19774.2415507701 19764.2211462271 19754.248218349 19744.3255853241 19734.253827008 19724.270767878 19714.267117754 19704.2499445181 19694.208612656 19684.18111984 19674.188989564 19664.1682144109 19654.164895673 19644.186242773 19634.176695597 19624.2084346371 19614.2552393669 19604.270420603 19784.546399614 19774.484616757 19764.47995576 19754.580961511 19744.6278067713 19734.7685820877 19724.7957087158 19714.8118147383 19704.8518237449 19694.8947734887 19684.9441602588 19674.9757754289 19665.048395696 19655.0151124361 19645.1786270248 19635.083411848 19625.1880716432 19615.3814948731 19605.0374055349 19783.8838785591 19773.8956900509 19763.8964692669 19753.922028648 19743.8882123569 19733.924155679 19723.9324021681 19713.932104258 19703.9025204189 19693.8991846811 19683.8893615239 19673.875031869 19663.8807406531 19653.861049164 19643.868992975 19633.848782399 19623.8714840411 19613.885345397 19603.916953172 19783.7888825619 19773.812500373 19763.9081160121 19753.8085488721 19743.807994935 19733.8849943329 19723.8466772421 19713.8259622251 19703.801582653 19693.773460001 19683.7782304139 19673.7686207529 19663.7495348571 19653.760583648 19643.7670843699 19633.788996565 19623.823666088 19613.8856225131 19603.9077042329 19784.0366010839 19774.005290418 19764.0077389471 19754.0330145629 19744.000460803 19734.137437795 19724.082807844 19714.1031462929 19704.128807176 19694.173561413 19684.161687403 19674.2034662751 19664.2336434839 19654.249453555 19644.326435619 19634.3539971901 19624.385448561 19614.4828459381 19604.50198595 19784.855845841 19774.810991519 19764.8373587579 19754.888471343 19744.8915906557 19734.89969379 19724.8893020193 19714.8950745608 19704.8995700246 19694.8644326333 19684.868782423 19674.8524989572 19664.871024855 19654.850827846 19644.8397604783 19634.8380800488 19624.8505325093 19614.8265553731 19604.8552384411 19783.842741783 19773.854311239 19763.8641455001 19753.877778414 19743.8182304581 19733.8959956699 19723.905401926 19713.8722450341 19703.870391622 19693.8546012139 19683.8286653779 19673.9068782151 19663.8205378359 19653.9515307039 19643.994375414 19634.001266072 19624.075961692 19614.124355641 19604.16401597 19783.922749583 19773.9316759431 19763.985411744 19754.0290180751 19744.018495372 19734.199380561 19724.128017777 19714.106720494 19704.0808876731 19694.0463547891 19684.045507048 19674.0529106939 19664.0475365589 19654.033983285 19644.037688787 19634.0595091239 19624.0731765511 19614.1009891049 19604.173244195 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 3 4 5 6 7 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 2.98 3.00 3.02 3.04 3.06 3.08 3.10 3.12 3.14 3.16 3.18 3.20 3.22 3.24 3.26 3.28 3.30 3.32 3.34 3.36 3.38 3.40 3.42 3.44 3.46 3.48 3.50 3.52 3.54 3.56 3.58 3.60 3.62 3.64 3.66 3.68 3.70 3.72 3.74 3.76 3.78 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 5.32 5.34 5.36 5.38 5.40 5.42 5.44 5.46 5.48 5.50 5.52 5.54 5.56 5.58 5.60 5.62 5.64 5.66 5.68 5.70 5.72 5.74 5.76 5.78 5.80 5.82 5.84 5.86 5.88 5.90 5.92 5.94 5.96 5.98 6.00 6.02 6.04 6.06 6.08 6.10 6.12 6.14 6.16 6.18 6.20 6.22 6.24 6.26 6.28 6.30 6.32 6.34 6.36 6.38 6.40 6.42 6.44 6.46 6.48 6.50 6.52 6.54 6.56 6.58 6.60 6.62 6.64 6.66 6.68 6.70 6.72 6.74 6.76 6.78 6.80 6.82 6.84 6.86 6.88 6.90 6.92 6.94 6.96 6.98 7.00 3 4 5 6 7 LGasPCar

We could have added Scale.x_discrete explicitly, but this is detected and the right default is chosen. This is the case with most of the elements in the grammar. When we've omitted Scale.x_continuous and Scale.y_continuous in the plots above, as well as Coord.cartesian, and guide elements such as Guide.xticks, Guide.xlabel and so on, Gadfly tries to fill in the gaps with reasonable defaults.

Rendering

Gadfly uses a custom graphics library called Compose, which is an attempt at a more elegant, purely functional take on the R grid package. It allows mixing of absolute and relative units and complex coordinate transforms. The primary backend is a native SVG generator (almost native: it uses pango to precompute text extents), though there is also a Cairo backend for PDF and PNG. See Backends for more details.

Building graphics declaratively let's you do some fun things. Like stick two plots together:

fig1a = plot(iris, x=:SepalLength, y=:SepalWidth, Geom.point)
fig1b = plot(iris, x=:SepalWidth, Geom.bar)
fig1 = hstack(fig1a, fig1b)
SepalWidth 1 2 3 4 5 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80 0.82 0.84 0.86 0.88 0.90 0.92 0.94 0.96 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.12 1.14 1.16 1.18 1.20 1.22 1.24 1.26 1.28 1.30 1.32 1.34 1.36 1.38 1.40 1.42 1.44 1.46 1.48 1.50 1.52 1.54 1.56 1.58 1.60 1.62 1.64 1.66 1.68 1.70 1.72 1.74 1.76 1.78 1.80 1.82 1.84 1.86 1.88 1.90 1.92 1.94 1.96 1.98 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.14 2.16 2.18 2.20 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.52 2.54 2.56 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.72 2.74 2.76 2.78 2.80 2.82 2.84 2.86 2.88 2.90 2.92 2.94 2.96 2.98 3.00 3.02 3.04 3.06 3.08 3.10 3.12 3.14 3.16 3.18 3.20 3.22 3.24 3.26 3.28 3.30 3.32 3.34 3.36 3.38 3.40 3.42 3.44 3.46 3.48 3.50 3.52 3.54 3.56 3.58 3.60 3.62 3.64 3.66 3.68 3.70 3.72 3.74 3.76 3.78 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 0 5 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0 50 100 150 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0 16.5 17.0 17.5 18.0 18.5 19.0 19.5 20.0 20.5 21.0 21.5 22.0 22.5 23.0 23.5 24.0 24.5 25.0 25.5 26.0 26.5 27.0 27.5 28.0 28.5 29.0 29.5 30.0 30.5 31.0 31.5 32.0 32.5 33.0 33.5 34.0 34.5 35.0 35.5 36.0 36.5 37.0 37.5 38.0 38.5 39.0 39.5 40.0 40.5 41.0 41.5 42.0 42.5 43.0 43.5 44.0 44.5 45.0 45.5 46.0 46.5 47.0 47.5 48.0 48.5 49.0 49.5 50.0 50.5 51.0 51.5 52.0 52.5 53.0 53.5 54.0 54.5 55.0 55.5 56.0 56.5 57.0 57.5 58.0 58.5 59.0 59.5 60.0 60.5 61.0 61.5 62.0 62.5 63.0 63.5 64.0 64.5 65.0 65.5 66.0 66.5 67.0 67.5 68.0 68.5 69.0 69.5 70.0 70.5 71.0 71.5 72.0 72.5 73.0 73.5 74.0 74.5 75.0 75.5 76.0 76.5 77.0 77.5 78.0 78.5 79.0 79.5 80.0 80.5 81.0 81.5 82.0 82.5 83.0 83.5 84.0 84.5 85.0 85.5 86.0 86.5 87.0 87.5 88.0 88.5 89.0 89.5 90.0 90.5 91.0 91.5 92.0 92.5 93.0 93.5 94.0 94.5 95.0 95.5 96.0 96.5 97.0 97.5 98.0 98.5 99.0 99.5 100.0 100.5 101.0 101.5 102.0 102.5 103.0 103.5 104.0 104.5 105.0 105.5 106.0 106.5 107.0 107.5 108.0 108.5 109.0 109.5 110.0 110.5 111.0 111.5 112.0 112.5 113.0 113.5 114.0 114.5 115.0 115.5 116.0 116.5 117.0 117.5 118.0 118.5 119.0 119.5 120.0 120.5 121.0 121.5 122.0 122.5 123.0 123.5 124.0 124.5 125.0 125.5 126.0 126.5 127.0 127.5 128.0 128.5 129.0 129.5 130.0 130.5 131.0 131.5 132.0 132.5 133.0 133.5 134.0 134.5 135.0 135.5 136.0 136.5 137.0 137.5 138.0 138.5 139.0 139.5 140.0 140.5 141.0 141.5 142.0 142.5 143.0 143.5 144.0 144.5 145.0 145.5 146.0 146.5 147.0 147.5 148.0 148.5 149.0 149.5 150.0 0 200 SepalLength 4 5 6 7 8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 7.2 7.4 7.6 7.8 8.0 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 5.32 5.34 5.36 5.38 5.40 5.42 5.44 5.46 5.48 5.50 5.52 5.54 5.56 5.58 5.60 5.62 5.64 5.66 5.68 5.70 5.72 5.74 5.76 5.78 5.80 5.82 5.84 5.86 5.88 5.90 5.92 5.94 5.96 5.98 6.00 6.02 6.04 6.06 6.08 6.10 6.12 6.14 6.16 6.18 6.20 6.22 6.24 6.26 6.28 6.30 6.32 6.34 6.36 6.38 6.40 6.42 6.44 6.46 6.48 6.50 6.52 6.54 6.56 6.58 6.60 6.62 6.64 6.66 6.68 6.70 6.72 6.74 6.76 6.78 6.80 6.82 6.84 6.86 6.88 6.90 6.92 6.94 6.96 6.98 7.00 7.02 7.04 7.06 7.08 7.10 7.12 7.14 7.16 7.18 7.20 7.22 7.24 7.26 7.28 7.30 7.32 7.34 7.36 7.38 7.40 7.42 7.44 7.46 7.48 7.50 7.52 7.54 7.56 7.58 7.60 7.62 7.64 7.66 7.68 7.70 7.72 7.74 7.76 7.78 7.80 7.82 7.84 7.86 7.88 7.90 7.92 7.94 7.96 7.98 8.00 4 6 8 5.9,3.0 6.2,3.4 6.5,3.0 6.3,2.5 6.7,3.0 6.7,3.3 6.8,3.2 5.8,2.7 6.9,3.1 6.7,3.1 6.9,3.1 6.0,3.0 6.4,3.1 6.3,3.4 7.7,3.0 6.1,2.6 6.3,2.8 6.4,2.8 7.9,3.8 7.4,2.8 7.2,3.0 6.4,2.8 6.1,3.0 6.2,2.8 7.2,3.2 6.7,3.3 6.3,2.7 7.7,2.8 5.6,2.8 6.9,3.2 6.0,2.2 7.7,2.6 7.7,3.8 6.5,3.0 6.4,3.2 5.8,2.8 5.7,2.5 6.8,3.0 6.4,2.7 6.5,3.2 7.2,3.6 6.7,2.5 7.3,2.9 4.9,2.5 7.6,3.0 6.5,3.0 6.3,2.9 7.1,3.0 5.8,2.7 6.3,3.3 5.7,2.8 5.1,2.5 6.2,2.9 5.7,2.9 5.7,3.0 5.6,2.7 5.0,2.3 5.8,2.6 6.1,3.0 5.5,2.6 5.5,2.5 5.6,3.0 6.3,2.3 6.7,3.1 6.0,3.4 5.4,3.0 6.0,2.7 5.8,2.7 5.5,2.4 5.5,2.4 5.7,2.6 6.0,2.9 6.7,3.0 6.8,2.8 6.6,3.0 6.4,2.9 6.1,2.8 6.3,2.5 6.1,2.8 5.9,3.2 5.6,2.5 6.2,2.2 5.8,2.7 5.6,3.0 6.7,3.1 5.6,2.9 6.1,2.9 6.0,2.2 5.9,3.0 5.0,2.0 5.2,2.7 6.6,2.9 4.9,2.4 6.3,3.3 5.7,2.8 6.5,2.8 5.5,2.3 6.9,3.1 6.4,3.2 7.0,3.2 5.0,3.3 5.3,3.7 4.6,3.2 5.1,3.8 4.8,3.0 5.1,3.8 5.0,3.5 4.4,3.2 4.5,2.3 5.0,3.5 5.1,3.4 4.4,3.0 4.9,3.6 5.5,3.5 5.0,3.2 4.9,3.1 5.5,4.2 5.2,4.1 5.4,3.4 4.8,3.1 4.7,3.2 5.2,3.4 5.2,3.5 5.0,3.4 5.0,3.0 4.8,3.4 5.1,3.3 4.6,3.6 5.1,3.7 5.4,3.4 5.1,3.8 5.7,3.8 5.1,3.5 5.4,3.9 5.7,4.4 5.8,4.0 4.3,3.0 4.8,3.0 4.8,3.4 5.4,3.7 4.9,3.1 4.4,2.9 5.0,3.4 4.6,3.4 5.4,3.9 5.0,3.6 4.6,3.1 4.7,3.2 4.9,3.0 5.1,3.5 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 2.0 2.5 3.0 3.5 4.0 4.5 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 1.99 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.35 2.36 2.37 2.38 2.39 2.40 2.41 2.42 2.43 2.44 2.45 2.46 2.47 2.48 2.49 2.50 2.51 2.52 2.53 2.54 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 2.66 2.67 2.68 2.69 2.70 2.71 2.72 2.73 2.74 2.75 2.76 2.77 2.78 2.79 2.80 2.81 2.82 2.83 2.84 2.85 2.86 2.87 2.88 2.89 2.90 2.91 2.92 2.93 2.94 2.95 2.96 2.97 2.98 2.99 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29 3.30 3.31 3.32 3.33 3.34 3.35 3.36 3.37 3.38 3.39 3.40 3.41 3.42 3.43 3.44 3.45 3.46 3.47 3.48 3.49 3.50 3.51 3.52 3.53 3.54 3.55 3.56 3.57 3.58 3.59 3.60 3.61 3.62 3.63 3.64 3.65 3.66 3.67 3.68 3.69 3.70 3.71 3.72 3.73 3.74 3.75 3.76 3.77 3.78 3.79 3.80 3.81 3.82 3.83 3.84 3.85 3.86 3.87 3.88 3.89 3.90 3.91 3.92 3.93 3.94 3.95 3.96 3.97 3.98 3.99 4.00 4.01 4.02 4.03 4.04 4.05 4.06 4.07 4.08 4.09 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.30 4.31 4.32 4.33 4.34 4.35 4.36 4.37 4.38 4.39 4.40 4.41 4.42 4.43 4.44 4.45 4.46 4.47 4.48 4.49 4.50 2 3 4 5 SepalWidth

Ultimately this will make more complex visualizations easier to build. For example, facets, plots within plots, and so on. See Compositing for more details.

Interactivity

One advantage of generating our own SVG is that we can annotate our SVG output and embed Javascript code to provide some level of dynamism. Though not a replacement for full-fledged custom interactive visualizations of the sort produced by D3, this sort of mild interactivity can improve a lot of standard plots.

The fuel efficiency plot is made more clear by toggling off some of the countries, for example. To do so, first render the plot using the SVGJS backend, which was not used to generate this webpage but is the default at the REPL, then simply click or shift-click in the colored squares in the table of keys to the right.

One can also zoom in and out by pressing the shift key while either scrolling the mouse wheel or clicking and dragging a box. Should your mouse not work, try the plus, minus, I, and O, keys. Panning is similarly easy: click and drag without depressing the shift key, or use the arrow keys. For Vim enthusiasts, the H, J, K, and L keys pan as expected. To reset the plot to it's initial state, double click it or hit R. Lastly, press C to toggle on and off a numerical display of the cursor coordinates.