Skip to content

Commit 0648739

Browse files
committed
Tweak icons
Part of #2121
1 parent f19c3cb commit 0648739

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+119
-87
lines changed

icons/coord_cartesian.png

-121 Bytes

icons/coord_fixed.png

-145 Bytes

icons/coord_flip.png

-534 Bytes

icons/coord_map.png

-854 Bytes

icons/coord_polar.png

-939 Bytes

icons/coord_transform.png

93 Bytes

icons/facet_grid.png

-194 Bytes

icons/geom_abline.png

-226 Bytes

icons/geom_area.png

-316 Bytes

icons/geom_bar.png

-116 Bytes

icons/geom_boxplot.png

-148 Bytes

icons/geom_contour.png

-434 Bytes

icons/geom_count.png

2.3 KB

icons/geom_crossbar.png

-75 Bytes

icons/geom_density.png

-458 Bytes

icons/geom_dotplot.png

-201 Bytes

icons/geom_freqpoly.png

-263 Bytes

icons/geom_histogram.png

-96 Bytes

icons/geom_jitter.png

-407 Bytes

icons/geom_line.png

-339 Bytes

icons/geom_linerange.png

-1.46 KB
Binary file not shown.

icons/geom_map.png

3.01 KB

icons/geom_path.png

-228 Bytes

icons/geom_point.png

-158 Bytes

icons/geom_pointrange.png

-143 Bytes

icons/geom_polygon.png

-186 Bytes

icons/geom_quantile.png

-286 Bytes

icons/geom_raster.png

-145 Bytes

icons/geom_rect.png

-116 Bytes

icons/geom_ribbon.png

-230 Bytes

icons/geom_segment.png

-208 Bytes

icons/geom_sf.png

3.01 KB

icons/geom_smooth.png

-224 Bytes

icons/geom_spoke.png

2.29 KB

icons/geom_step.png

-197 Bytes

icons/geom_text.png

-138 Bytes

icons/geom_tile.png

-145 Bytes

icons/geom_violin.png

-486 Bytes

icons/icons.R

Lines changed: 119 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set.seed(1014)
88

99
write_icon <- function(name, code) {
1010
path <- paste0("icons/", name, ".png")
11-
png(path, width = 80, height = 80, pointsize = 18)
11+
png(path, width = 60, height = 60, pointsize = 18)
1212
on.exit(dev.off())
1313

1414
grid.draw(code)
@@ -62,6 +62,9 @@ write_icon("coord_map", {
6262
linesGrob(nz$x, nz$y, default.units = "npc")
6363
})
6464

65+
file.copy("icons/coord_map.png", "icons/geom_map.png")
66+
file.copy("icons/coord_map.png", "icons/geom_sf.png")
67+
6568
write_icon("coord_polar", {
6669
circleGrob(r = c(0.1, 0.25, 0.45), gp = gpar(fill = NA))
6770
})
@@ -100,27 +103,18 @@ write_icon("facet_grid", {
100103
))
101104
})
102105

103-
write_icon("facet_null", {
106+
write_icon("facet_wrap", {
104107
gTree(children = gList(
105108
rectGrob(
106109
0,
107-
1,
108-
width = 0.95,
110+
c(0.49, 1),
111+
width = 1,
109112
height = 0.05,
110113
hjust = 0,
111114
vjust = 1,
112115
gp = gpar(fill = "grey60", col = NA)
113116
),
114-
rectGrob(
115-
0.95,
116-
0.95,
117-
width = 0.05,
118-
height = 0.95,
119-
hjust = 0,
120-
vjust = 1,
121-
gp = gpar(fill = "grey60", col = NA)
122-
),
123-
segmentsGrob(c(0, 0.475), c(0.475, 0), c(1, 0.475), c(0.475, 1))
117+
segmentsGrob(c(0, 0.5), c(0.5, 0), c(1, 0.5), c(0.5, 1))
124118
))
125119
})
126120

@@ -139,6 +133,34 @@ write_icon("geom_bar", {
139133
)
140134
})
141135

136+
write_icon("geom_bin2d", {
137+
n <- 5
138+
x <- seq(0, 1, length = n + 1)[-(n + 1)]
139+
out <- expand.grid(x = x, y = x)
140+
fill <- sqrt((out$x - 0.5) ^ 2 + (out$y - 0.5) ^ 2)
141+
142+
pal <- scales::seq_gradient_pal("#56B1F7", "#132B43")
143+
rectGrob(
144+
out$x + 1/n/2,
145+
out$y + 1/n/2,
146+
width = 1/n,
147+
height = 1/n,
148+
gp = gpar(col = "grey20", fill = pal(scales::rescale(fill)))
149+
)
150+
})
151+
152+
write_icon("geom_blank", {
153+
rectGrob(0.5, 0.5,
154+
height = 1,
155+
width = 1,
156+
gp = gpar(fill = "white", col = "black", lwd = 3)
157+
)
158+
})
159+
160+
write_icon("geom_count", {
161+
textGrob(expression(Sigma), gp = gpar(cex = 4))
162+
})
163+
142164
write_icon("geom_histogram", {
143165
y <- c(0.2, 0.3, 0.5, 0.6, 0.2, 0.8, 0.5, 0.3)
144166
rectGrob(
@@ -167,14 +189,20 @@ write_icon("geom_boxplot", {
167189

168190
write_icon("geom_crossbar", {
169191
gTree(children = gList(
192+
# crossbar
170193
rectGrob(
171-
c(0.3, 0.7),
172-
c(0.6, 0.8),
194+
0.3,
195+
0.6,
173196
width = 0.3,
174197
height = c(0.4, 0.4),
175198
vjust = 1
176199
),
177-
segmentsGrob(c(0.15, 0.55), c(0.5, 0.6), c(0.45, 0.85), c(0.5, 0.6))
200+
segmentsGrob(c(0.15), c(0.5), c(0.45), c(0.5)),
201+
202+
# error bar
203+
segmentsGrob(0.70, 0.5, 0.70, 0.90),
204+
segmentsGrob(0.55, 0.5, 0.85, 0.50),
205+
segmentsGrob(0.55, 0.9, 0.85, 0.90)
178206
))
179207
})
180208

@@ -191,35 +219,11 @@ write_icon("geom_dotplot", {
191219
)
192220
})
193221

194-
write_icon("geom_errorbar", {
195-
gTree(children = gList(
196-
segmentsGrob(c(0.3, 0.7), c(0.3, 0.5), c(0.3, 0.7), c(0.7, 0.9)),
197-
segmentsGrob(c(0.15, 0.55), c(0.3, 0.5), c(0.45, 0.85), c(0.3, 0.5)),
198-
segmentsGrob(c(0.15, 0.55), c(0.7, 0.9), c(0.45, 0.85), c(0.7, 0.9))
199-
))
200-
})
201-
202-
write_icon("geom_errorbarh", {
203-
gTree(children = gList(
204-
segmentsGrob(c(0.5, 0.3), c(0.70, 0.30), c(0.9, 0.7), c(0.70, 0.30)),
205-
segmentsGrob(c(0.5, 0.3), c(0.55, 0.15), c(0.5, 0.3), c(0.85, 0.45)),
206-
segmentsGrob(c(0.9, 0.7), c(0.55, 0.15), c(0.9, 0.7), c(0.85, 0.45))
207-
))
208-
})
209-
210222
write_icon("geom_freqpoly", {
211223
y <- c(0.2, 0.3, 0.5, 0.6, 0.2, 0.8, 0.5, 0.3)
212224
linesGrob(seq(0.1, 0.9, by = 0.1), y, gp = gpar(col = "grey20"))
213225
})
214226

215-
write_icon("geom_hline", {
216-
linesGrob(c(0, 1), c(0.5, 0.5))
217-
})
218-
219-
write_icon("geom_linerange", {
220-
segmentsGrob(c(0.3, 0.7), c(0.1, 0.2), c(0.3, 0.7), c(0.7, 0.95))
221-
})
222-
223227
write_icon("geom_path", {
224228
linesGrob(c(0.2, 0.4, 0.8, 0.6, 0.5), c(0.2, 0.7, 0.4, 0.1, 0.5))
225229
})
@@ -234,16 +238,25 @@ write_icon("geom_contour", {
234238
)))
235239
})
236240

241+
write_icon("geom_hex", {
242+
theta <- seq(0, 2 * pi, length = 7)[-1]
243+
polygonGrob(
244+
0.5 + 0.4 * sin(theta),
245+
0.5 + 0.4 * cos(theta),
246+
gp = gpar(fill = "grey50", col = NA)
247+
)
248+
})
249+
237250
write_icon("geom_line", {
238251
pos <- seq(0, 1, length.out = 5)
239-
linesGrob(pos, c(0.2, 0.7, 0.4, 0.8, 0.3))
252+
linesGrob(pos, c(0.2, 0.7, 0.4, 0.8, 0.3), gp = gpar(lwd = 3))
240253
})
241254

242255
write_icon("geom_step", {
243-
n <- 15
244-
xs <- rep(0:n, each = 2)[-2 * (n + 1)] / 15
245-
ys <- c(0, rep(1:n, each = 2)) / 15
246-
linesGrob(xs, ys, gp = gpar(col = "grey20"))
256+
n <- 10
257+
xs <- rep(0:n, each = 2)[-2 * (n + 1)] / n
258+
ys <- c(0, rep(1:n, each = 2)) / n
259+
linesGrob(xs, ys, gp = gpar(col = "grey20", lwd = 3))
247260
})
248261

249262
write_icon("geom_point", {
@@ -258,10 +271,9 @@ write_icon("geom_point", {
258271
})
259272

260273
write_icon("geom_jitter", {
261-
pos <- seq(0.1, 0.9, length.out = 6)
262274
pointsGrob(
263-
x = pos,
264-
y = jitter(pos, 3),
275+
x = c(0.25, 0.22, 0.34, 0.70, 0.77, 0.80),
276+
y = c(0.15, 0.24, 0.28, 0.65, 0.90, 0.75),
265277
pch = 19,
266278
gp = gpar(col = "black", cex = 0.5),
267279
default.units = "npc"
@@ -330,6 +342,17 @@ write_icon("geom_ribbon", {
330342
)
331343
})
332344

345+
write_icon("geom_spoke", {
346+
theta <- seq(0, 2 * pi, length = 10)[-1]
347+
r <- seq(0.1, 0.45, length = length(theta))
348+
segmentsGrob(
349+
0.5, 0.5,
350+
0.5 + sin(theta) * r,
351+
0.5 + cos(theta) * r,
352+
gp = gpar(col = "grey20")
353+
)
354+
})
355+
333356
write_icon("geom_area", {
334357
polygonGrob(c(0, 0, 0.3, 0.5, 0.8, 1, 1),
335358
c(0, 1, 0.5, 0.6, 0.3, 0.8, 0),
@@ -342,6 +365,15 @@ write_icon("geom_density", {
342365
linesGrob(x, 0.05 + y / max(y) * 0.9, default.units = "npc")
343366
})
344367

368+
369+
write_icon("geom_rug", {
370+
x <- seq(0.15, 0.95, length = 8)
371+
gList(
372+
segmentsGrob(x, 0, x, 0 + 0.1, gp = gpar(lwd = 2)),
373+
segmentsGrob(0, x, 0 + 0.1, x, gp = gpar(lwd = 2))
374+
)
375+
})
376+
345377
write_icon("geom_segment", {
346378
segmentsGrob(c(0.1, 0.3, 0.5, 0.7),
347379
c(0.3, 0.5, 0.1, 0.9),
@@ -391,10 +423,6 @@ write_icon("geom_violin", {
391423
))
392424
})
393425

394-
write_icon("geom_vline", {
395-
linesGrob(c(0.5, 0.5), c(0, 1))
396-
})
397-
398426
# Position adjustments --------------------------------------------------------
399427

400428
write_icon("position_dodge", {
@@ -451,7 +479,8 @@ write_icon("position_stack", {
451479
write_icon("scale_alpha", {
452480
x <- c(0.1, 0.3, 0.5, 0.7, 0.9)
453481
rectGrob(x,
454-
width = 0.25,
482+
width = 0.3,
483+
height = x,
455484
gp = gpar(fill = scales::alpha("black", x), col = NA))
456485
})
457486

@@ -463,28 +492,43 @@ write_icon("scale_colour_brewer", {
463492
)
464493
})
465494

466-
write_icon("scale_colour_gradient", {
467-
g <- scale_fill_gradient()
468-
g$train(1:5)
495+
write_icon("scale_colour_continuous", {
496+
g1 <- scale_fill_gradient()
497+
g1$train(1:5)
498+
499+
g2 <- scale_fill_viridis_c()
500+
g2$train(1:5)
501+
502+
x <- c(0.1, 0.3, 0.5, 0.7, 0.9)
503+
rectGrob(
504+
c(x, x),
505+
rep(c(0.25, 0.75), each = 5),
506+
width = 0.21,
507+
height = 0.5,
508+
gp = gpar(fill = c(g1$map(1:5), g2$map(5:1)), col = NA)
509+
)
510+
})
511+
512+
write_icon("scale_colour_viridis_d", {
469513
rectGrob(
470514
c(0.1, 0.3, 0.5, 0.7, 0.9),
471515
width = 0.21,
472516
gp = gpar(fill = g$map(1:5), col = NA)
473517
)
474518
})
475519

476-
write_icon("scale_colour_gradient2", {
477-
g <- scale_fill_gradient2()
478-
g$train(1:5 - 3)
520+
write_icon("scale_colour_gradient", {
521+
g <- scale_fill_gradient()
522+
g$train(1:5)
479523
rectGrob(
480524
c(0.1, 0.3, 0.5, 0.7, 0.9),
481525
width = 0.21,
482-
gp = gpar(fill = g$map(1:5 - 3), col = NA)
526+
gp = gpar(fill = g$map(1:5), col = NA)
483527
)
484528
})
485529

486-
write_icon("scale_colour_gradientn", {
487-
g <- scale_fill_gradientn(colours = rainbow(7))
530+
write_icon("scale_colour_viridis", {
531+
g <- scale_fill_viridis_c()
488532
g$train(1:5)
489533
rectGrob(
490534
c(0.1, 0.3, 0.5, 0.7, 0.9),
@@ -493,10 +537,11 @@ write_icon("scale_colour_gradientn", {
493537
)
494538
})
495539

540+
496541
write_icon("scale_colour_grey", {
497542
rectGrob(c(0.1, 0.3, 0.5, 0.7, 0.9),
498543
width = 0.21,
499-
gp = gpar(fill = gray(seq(0, 1, length.out = 5)), col = NA))
544+
gp = gpar(fill = gray(seq(0, 0.9, length.out = 5)), col = NA))
500545
})
501546

502547
write_icon("scale_colour_hue", {
@@ -507,15 +552,11 @@ write_icon("scale_colour_hue", {
507552
), col = NA))
508553
})
509554

510-
write_icon("scale_colour_identity", {
511-
textGrob("f(x) = x", gp = gpar(cex = 1.2))
512-
})
513-
514555
write_icon("scale_linetype", {
515556
gTree(children = gList(
516-
segmentsGrob(0, 0.25, 1, 0.25, gp = gpar(lty = 1)),
517-
segmentsGrob(0, 0.50, 1, 0.50, gp = gpar(lty = 2)),
518-
segmentsGrob(0, 0.75, 1, 0.75, gp = gpar(lty = 3))
557+
segmentsGrob(0, 0.25, 1, 0.25, gp = gpar(lty = 1, lwd = 3)),
558+
segmentsGrob(0, 0.50, 1, 0.50, gp = gpar(lty = 2, lwd = 3)),
559+
segmentsGrob(0, 0.75, 1, 0.75, gp = gpar(lty = 3, lwd = 3))
519560
))
520561
})
521562

@@ -524,12 +565,13 @@ write_icon("scale_colour_manual", {
524565
})
525566

526567
write_icon("scale_shape", {
568+
gp <- gpar(lwd = 3)
527569
gTree(children = gList(
528-
circleGrob(0.7, 0.7, r = 0.1),
529-
segmentsGrob(0.2, 0.3, 0.4, 0.3),
530-
segmentsGrob(0.3, 0.2, 0.3, 0.4),
531-
polygonGrob(c(0.2, 0.2, 0.4, 0.4), c(0.8, 0.6, 0.6, 0.8)),
532-
polygonGrob(c(0.6, 0.7, 0.8), c(0.2, 0.4, 0.2))
570+
circleGrob(0.7, 0.7, r = 0.1, gp = gp),
571+
segmentsGrob(0.2, 0.3, 0.4, 0.3, gp = gp),
572+
segmentsGrob(0.3, 0.2, 0.3, 0.4, gp = gp),
573+
polygonGrob(c(0.2, 0.2, 0.4, 0.4), c(0.8, 0.6, 0.6, 0.8), gp = gp),
574+
polygonGrob(c(0.6, 0.7, 0.8), c(0.2, 0.4, 0.2), gp = gp)
533575
))
534576
})
535577

@@ -542,15 +584,5 @@ write_icon("scale_size", {
542584
})
543585

544586
write_icon("scale_x_date", {
545-
textGrob("14/10/1979", gp = gpar(cex = 1))
546-
})
547-
548-
# Statistics -------------------------------------------------------------------
549-
550-
write_icon("stat_identity", {
551-
textGrob('f(x) = x', gp = gpar(cex = 1.2))
552-
})
553-
554-
write_icon("stat_sum", {
555-
textGrob(expression(Sigma), gp = gpar(cex = 4))
587+
textGrob("14/10/1979", gp = gpar(cex = 0.9), rot = 45)
556588
})

icons/position_dodge.png

-73 Bytes

icons/position_fill.png

-50 Bytes

icons/position_identity.png

-67 Bytes

icons/position_jitter.png

-138 Bytes

icons/position_stack.png

-69 Bytes

icons/scale_alpha.png

-64 Bytes

icons/scale_colour_brewer.png

-65 Bytes

icons/scale_colour_gradient.png

-65 Bytes

icons/scale_colour_grey.png

-66 Bytes

icons/scale_colour_hue.png

-65 Bytes

icons/scale_colour_identity.png

-2.47 KB
Binary file not shown.

icons/scale_colour_manual.png

-84 Bytes

icons/scale_colour_viridis_d.png

1.29 KB

icons/scale_identity.png

-2.47 KB
Binary file not shown.

icons/scale_linetype.png

-89 Bytes

icons/scale_manual.png

-2.06 KB
Binary file not shown.

icons/scale_shape.png

-97 Bytes

icons/scale_size.png

-342 Bytes

icons/scale_x_date.png

-171 Bytes

icons/scale_x_datetime.png

-3.57 KB
Binary file not shown.

icons/stat_identity.png

-2.47 KB
Binary file not shown.

icons/stat_sum.png

-2.46 KB
Binary file not shown.

0 commit comments

Comments
 (0)