Gadfly supports advanced plot composition techniques like faceting, stacking, and layering.
It is easy to make multiple plots that all share a common dataset and axis.
using Gadfly, RDatasets
iris = dataset("datasets", "iris")
plot(iris, xgroup="Species", x="SepalLength", y="SepalWidth",
Geom.subplot_grid(Geom.point))
SepalLength by Species
virginica
versicolor
setosa
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
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
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
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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
Geom.subplot_grid
can similarly arrange plots vertically, or even in a 2D grid if there are two shared axes.
Subplots have some inner and outer elements, including Guides and Scales. For example, place the guide inside Geom.subplot_grid(...)
to change the subplot labels, or outside to change the outer plot labels.
haireye = dataset("datasets", "HairEyeColor")
palette = ["brown", "blue", "tan", "green"]
plot(haireye, y=:Sex, x=:Freq, color=:Eye, ygroup=:Hair,
Geom.subplot_grid(Geom.bar(position=:stack, orientation=:horizontal),
Guide.ylabel(orientation=:vertical) ),
Scale.color_discrete_manual(palette...),
Guide.colorkey(title="Eye\ncolor"),
Guide.ylabel("Hair color"), Guide.xlabel("Frequency") )
Frequency
Brown
Blue
Hazel
Green
Eyecolor
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
Male
Female
Blond
Male
Female
Red
Male
Female
Brown
Male
Female
Black
Hair color
More examples can be found in the plot gallery at Geom.subplot_grid and Scale.{x,y}group .
To composite plots derived from different datasets, or the same data but different axes, a declarative interface is used. The Tutorial showed how such disparate plots can be horizontally arranged with hstack
. Here we illustrate how to vertically stack them with vstack
or arrange them in a grid with gridstack
. These commands allow more customization in regards to tick marks, axis labeling, and other plot details than is available with Geom.subplot_grid
.
theme1 = Theme(key_position=:none)
fig1a = plot(iris, x=:SepalLength, y=:SepalWidth, color=:Species, theme1,
alpha=[0.6], size=:PetalLength, Scale.size_area(maxvalue=7))
fig1b = plot(iris, x=:SepalLength, color=:Species, Geom.density,
Guide.ylabel("density"), Coord.cartesian(xmin=4, xmax=8), theme1)
vstack(fig1a,fig1b)
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
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
1.5
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
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
1.005
1.010
1.015
1.020
1.025
1.030
1.035
1.040
1.045
1.050
1.055
1.060
1.065
1.070
1.075
1.080
1.085
1.090
1.095
1.100
1.105
1.110
1.115
1.120
1.125
1.130
1.135
1.140
1.145
1.150
1.155
1.160
1.165
1.170
1.175
1.180
1.185
1.190
1.195
1.200
1.205
1.210
1.215
1.220
1.225
1.230
1.235
1.240
1.245
1.250
1.255
1.260
1.265
1.270
1.275
1.280
1.285
1.290
1.295
1.300
1.305
1.310
1.315
1.320
1.325
1.330
1.335
1.340
1.345
1.350
1.355
1.360
1.365
1.370
1.375
1.380
1.385
1.390
1.395
1.400
1.405
1.410
1.415
1.420
1.425
1.430
1.435
1.440
1.445
1.450
1.455
1.460
1.465
1.470
1.475
1.480
1.485
1.490
1.495
1.500
0
2
density
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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,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
hstack
and vstack
can be composed to create arbitrary arrangements of panels.
vstack(hstack(p1,p2),hstack(p3,p4,p5))
If all rows or columns have the same number of panels, it's easiest to use gridstack
.
gridstack([p1 p2; p3 p4])
For each of these commands, you can leave a panel blank by passing an empty plot()
. Other elements, e.g. Scales
and Guides
, can be added to blank plots. If the plot contains aesthetic mappings, use Geom.blank
.
using Compose # for w, h relative units
fig1c = plot(iris, x=:SepalWidth, color=:Species, Geom.density,
Guide.ylabel("density"), Coord.cartesian(xmin=2, xmax=4.5), theme1)
fig1d = plot(iris, color=:Species, size=:PetalLength, Geom.blank,
Scale.size_area(maxvalue=7), Theme(key_swatch_color="silver"),
Guide.colorkey(title="Species", pos=[0.55w,-0.15h]),
Guide.sizekey(title="PetalLength (cm)", pos=[0.2w, -0.10h]))
gridstack([fig1a fig1c; fig1b fig1d])
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
7
PetalLength (cm)
setosa
versicolor
virginica
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
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
1.5
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
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
1.005
1.010
1.015
1.020
1.025
1.030
1.035
1.040
1.045
1.050
1.055
1.060
1.065
1.070
1.075
1.080
1.085
1.090
1.095
1.100
1.105
1.110
1.115
1.120
1.125
1.130
1.135
1.140
1.145
1.150
1.155
1.160
1.165
1.170
1.175
1.180
1.185
1.190
1.195
1.200
1.205
1.210
1.215
1.220
1.225
1.230
1.235
1.240
1.245
1.250
1.255
1.260
1.265
1.270
1.275
1.280
1.285
1.290
1.295
1.300
1.305
1.310
1.315
1.320
1.325
1.330
1.335
1.340
1.345
1.350
1.355
1.360
1.365
1.370
1.375
1.380
1.385
1.390
1.395
1.400
1.405
1.410
1.415
1.420
1.425
1.430
1.435
1.440
1.445
1.450
1.455
1.460
1.465
1.470
1.475
1.480
1.485
1.490
1.495
1.500
0
2
density
SepalWidth
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
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
1.5
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
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
1.005
1.010
1.015
1.020
1.025
1.030
1.035
1.040
1.045
1.050
1.055
1.060
1.065
1.070
1.075
1.080
1.085
1.090
1.095
1.100
1.105
1.110
1.115
1.120
1.125
1.130
1.135
1.140
1.145
1.150
1.155
1.160
1.165
1.170
1.175
1.180
1.185
1.190
1.195
1.200
1.205
1.210
1.215
1.220
1.225
1.230
1.235
1.240
1.245
1.250
1.255
1.260
1.265
1.270
1.275
1.280
1.285
1.290
1.295
1.300
1.305
1.310
1.315
1.320
1.325
1.330
1.335
1.340
1.345
1.350
1.355
1.360
1.365
1.370
1.375
1.380
1.385
1.390
1.395
1.400
1.405
1.410
1.415
1.420
1.425
1.430
1.435
1.440
1.445
1.450
1.455
1.460
1.465
1.470
1.475
1.480
1.485
1.490
1.495
1.500
0
2
density
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,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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
Note in this example, the Guide pos
argument is in [width, height] relative units, which come from Compose .
Lastly, title
can be used to add a descriptive string to the top of a stack.
title(hstack(p1,p2), "My creative title")
Introduction: Draw multiple layers onto the same plot by inputting Layer
objects to plot
.
xdata = sort(iris.SepalWidth)
ydata = cumsum(xdata)
line = layer(x=xdata, y=ydata, Geom.line, color=[colorant"red"],
Theme(line_width=1pt))
bars = layer(iris, x=:SepalWidth, Geom.bar)
plot(line, bars)
x
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
100
200
300
400
500
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
0
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100
102
104
106
108
110
112
114
116
118
120
122
124
126
128
130
132
134
136
138
140
142
144
146
148
150
152
154
156
158
160
162
164
166
168
170
172
174
176
178
180
182
184
186
188
190
192
194
196
198
200
202
204
206
208
210
212
214
216
218
220
222
224
226
228
230
232
234
236
238
240
242
244
246
248
250
252
254
256
258
260
262
264
266
268
270
272
274
276
278
280
282
284
286
288
290
292
294
296
298
300
302
304
306
308
310
312
314
316
318
320
322
324
326
328
330
332
334
336
338
340
342
344
346
348
350
352
354
356
358
360
362
364
366
368
370
372
374
376
378
380
382
384
386
388
390
392
394
396
398
400
402
404
406
408
410
412
414
416
418
420
422
424
426
428
430
432
434
436
438
440
442
444
446
448
450
452
454
456
458
460
462
464
466
468
470
472
474
476
478
480
482
484
486
488
490
492
494
496
498
500
0
500
y
Note that here we used both the DataFrame and AbstractArrays interface to layer
, as well a Theme
object. See Themes for more information on the latter.
You can share the same DataFrame across different layers:
plot(iris,
layer(x=:SepalLength, y=:SepalWidth),
layer(x=:PetalLength, y=:PetalWidth, color=[colorant"red"]))
In this case, Gadfly labels the axes with the column names of first layer listed. If this is not what is desired, Guides may be explicitly added.
plot(iris,
layer(x=:SepalLength, y=:SepalWidth),
layer(x=:PetalLength, y=:PetalWidth, color=[colorant"red"]),
Guide.xlabel("length"), Guide.ylabel("width"), Guide.title("Iris data"),
Guide.manual_color_key("",["Sepal","Petal"],
[Gadfly.current_theme().default_color,"red"]))
length
0
2
4
6
8
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
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
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,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
?
0
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
width
Iris data
Layer inputs : layer()
can input Geometries, Statistics, and Themes, but not Scales, Coordinates, or Guides.
There are two rules about layers and Statistics:
Within a layer, all Geoms will use the layer Stat
(if it's specified) e.g. layer(Stat.smooth(method=:lm), Geom.line, Geom.ribbon)
For Geoms outside of layers, Gadfly creates a new layer for each Geom, and each Stat is added to the newest layer e.g.
xdata = range(-9, 9, length=30)
plot(x=xdata, y=rand(30), Geom.point, Stat.binmean(n=5),
Geom.line, Stat.step)
Layers and Aesthetics : Aesthetics can also be shared across layers:
plot(iris, Guide.colorkey(title=""),
layer(x->0.4x-0.3, 0, 8, color=["Petal"]),
layer(x=:SepalLength, y=:SepalWidth, color=["Sepal"]),
layer(x=:PetalLength, y=:PetalWidth, color=["Petal"]),
layer(x=[2.0], y=[4], shape=[Shape.star1], color=[colorant"red"], size=[8pt]),
Theme(alphas=[0.7]))
SepalLength
0
2
4
6
8
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
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
0
10
Petal
Sepal
2.0,4
5.1,1.8
5.4,2.3
5.2,2.0
5.0,1.9
5.2,2.3
5.7,2.5
5.9,2.3
5.1,1.9
5.1,2.3
5.6,2.4
5.4,2.1
4.8,1.8
5.5,1.8
5.6,2.4
6.1,2.3
5.6,1.4
5.1,1.5
5.6,2.2
6.4,2.0
6.1,1.9
5.8,1.6
5.6,2.1
4.9,1.8
4.8,1.8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
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
?
-1
0
1
2
3
4
5
-1.00
-0.75
-0.50
-0.25
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
-1.00
-0.98
-0.96
-0.94
-0.92
-0.90
-0.88
-0.86
-0.84
-0.82
-0.80
-0.78
-0.76
-0.74
-0.72
-0.70
-0.68
-0.66
-0.64
-0.62
-0.60
-0.58
-0.56
-0.54
-0.52
-0.50
-0.48
-0.46
-0.44
-0.42
-0.40
-0.38
-0.36
-0.34
-0.32
-0.30
-0.28
-0.26
-0.24
-0.22
-0.20
-0.18
-0.16
-0.14
-0.12
-0.10
-0.08
-0.06
-0.04
-0.02
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
0
5
y
And layers can inherit aesthetics from the plot:
set_default_plot_size(21cm, 8cm)
p1 = plot(iris, x=:SepalLength, y=:PetalLength,
layer(Geom.smooth(method=:loess), color=["Smooth"]),
layer(Geom.point, color=["Points"]))
p2 = plot(iris, x=:SepalLength, y=:PetalLength, color=:Species,
Geom.smooth(method=:lm), Geom.point, alpha=[0.6],
layer(Geom.smooth(method=:loess), color=[colorant"grey"], order=2))
hstack(p1, p2)
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,5.1
6.2,5.4
6.5,5.2
6.3,5.0
6.7,5.2
6.7,5.7
6.8,5.9
5.8,5.1
6.9,5.1
6.7,5.6
6.9,5.4
6.0,4.8
6.4,5.5
6.3,5.6
7.7,6.1
6.1,5.6
6.3,5.1
6.4,5.6
7.9,6.4
7.4,6.1
7.2,5.8
6.4,5.6
6.1,4.9
6.2,4.8
7.2,6.0
6.7,5.7
6.3,4.9
7.7,6.7
5.6,4.9
6.9,5.7
6.0,5.0
7.7,6.9
7.7,6.7
6.5,5.5
6.4,5.3
5.8,5.1
5.7,5.0
6.8,5.5
6.4,5.3
6.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8.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
0
10
PetalLength
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
Smooth
Points
Color
5.9,5.1
6.2,5.4
6.5,5.2
6.3,5.0
6.7,5.2
6.7,5.7
6.8,5.9
5.8,5.1
6.9,5.1
6.7,5.6
6.9,5.4
6.0,4.8
6.4,5.5
6.3,5.6
7.7,6.1
6.1,5.6
6.3,5.1
6.4,5.6
7.9,6.4
7.4,6.1
7.2,5.8
6.4,5.6
6.1,4.9
6.2,4.8
7.2,6.0
6.7,5.7
6.3,4.9
7.7,6.7
5.6,4.9
6.9,5.7
6.0,5.0
7.7,6.9
7.7,6.7
6.5,5.5
6.4,5.3
5.8,5.1
5.7,5.0
6.8,5.5
6.4,5.3
6.5,5.1
7.2,6.1
6.7,5.8
7.3,6.3
4.9,4.5
7.6,6.6
6.5,5.8
6.3,5.6
7.1,5.9
5.8,5.1
6.3,6.0
5.7,4.1
5.1,3.0
6.2,4.3
5.7,4.2
5.7,4.2
5.6,4.2
5.0,3.3
5.8,4.0
6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
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
0
10
PetalLength
Note in some layers, it may be better to use specific Geoms e.g. Geom.yerrorbar
rather than Geom.errorbar
, since the latter will attempt to inherit aesthetics for both Geom.xerrorbar
and Geom.yerrobar
.
Layer order : the sequence in which layers are drawn, whether they overlap or not, can be controlled with the order
keyword. Layers with lower order numbers are rendered first. If not specified, the default order for a layer is 0. Layers which have the same order number are drawn in the reverse order in which they appear in plot
's input arguments.
bars = layer(iris, x=:SepalWidth, Geom.bar)
line = layer(iris, x=xdata, y=ydata, Geom.line, color=[colorant"red"],
order=1)
plot(bars, line)