Geom.point

Geom.point

The point geometry is used to draw various types of scatterplots.

Aesthetics

Examples

plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", Geom.point)
SepalLength 4 5 6 7 8 2.0 2.5 3.0 3.5 4.0 4.5 SepalWidth
# Binding categorial data to the color aesthetic
plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth",
     color="Species", Geom.point)
SepalLength 4 5 6 7 8 setosa versicolor virginica Species 2.0 2.5 3.0 3.5 4.0 4.5 SepalWidth
# Binding continuous data to the color aesthetic
plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth",
     color="PetalLength", Geom.point)
SepalLength 4 5 6 7 8 1 4 8 2 6 PetalLength 2.0 2.5 3.0 3.5 4.0 4.5 SepalWidth
# Binding categorial data to x
plot(dataset("lattice", "singer"), x="VoicePart", y="Height", Geom.point)
VoicePart Soprano 1 Soprano 2 Alto 1 Alto 2 Tenor 1 Tenor 2 Bass 1 Bass 2 60 65 70 75 80 Height
# Binding categorical data to the shape aesthetic
plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth",
        shape="Species", color="Species", Geom.point)
SepalLength 4 5 6 7 8 setosa versicolor virginica Species 2.0 2.5 3.0 3.5 4.0 4.5 SepalWidth
# Different colored layers
using Distributions
rdata = rand(MvNormal([0,0.],[1 0;0 1.]),100)
bdata = rand(MvNormal([1,0.],[1 0;0 1.]),100)
plot(layer(x=rdata[1,:], y=rdata[2,:], color=[colorant"red"], Geom.point),
     layer(x=bdata[1,:], y=bdata[2,:], color=[colorant"blue"], Geom.point))
x -4 -2 0 2 4 -3 -2 -1 0 1 2 3 y