2010-05-24 39 views
57

Tôi hiện đang sử dụng scale_brewer() để tô màu và những màu này trông đẹp mắt (trên màn hình và qua máy in màu) nhưng in tương đối đồng nhất như màu xám khi sử dụng máy in đen trắng. Tôi đã tìm kiếm tài liệu trực tuyến ggplot2 nhưng không thấy bất kỳ điều gì về việc thêm hoạ tiết để tô màu. Có cách nào chính thức để ggplot2 thực hiện việc này hay không ai có hack mà họ sử dụng? Theo kết cấu tôi có nghĩa là những thứ như thanh chéo, thanh chéo ngược, mẫu chấm, v.v ... sẽ phân biệt màu tô khi in màu đen và trắng.Làm thế nào để thêm kết cấu để tô màu trong ggplot2?

+0

[giải pháp gridSVG cho câu hỏi lưới cơ bản] (http://stackoverflow.com/questions/26110160/how-to-apply-cross-hatching-to-a-polygon-using-the-grid-graphical- system/26110400 # 26110400) – baptiste

Trả lời

26

ggplot có thể sử dụng bảng màu colorbrewer. Một số trong số này là "photocopy" thân thiện. Vì vậy, mabe một cái gì đó như thế này sẽ làm việc cho bạn?

ggplot(diamonds, aes(x=cut, y=price, group=cut))+ 
geom_boxplot(aes(fill=cut))+scale_fill_brewer(palette="OrRd") 

trong trường hợp này OrRd là một bảng màu được tìm thấy trên trang web ColorBrewer: http://colorbrewer2.org/

photocopy thân thiện: Điều này chỉ ra rằng một màu sắc nhất định sẽ chịu được màu đen và trắng photocopy. Các sơ đồ phân phối có thể không được sao chép thành công. Sự khác biệt về độ sáng nên được giữ nguyên với các sơ đồ tuần tự.

51

Hiện không thể thực hiện được vì lưới (hệ thống đồ họa mà ggplot2 sử dụng để vẽ bản vẽ thực tế) không hỗ trợ họa tiết. Lấy làm tiếc!

+38

Bất kỳ kế hoạch nào để thêm gridextra dưới dạng phụ thuộc để có được chức năng này? – russellpierce

62

Hey folks đây là một hack wee nhằm giải quyết các vấn đề kết cấu một cách rất cơ bản:

ggplot2: make the border on one bar darker than the others using R

EDIT: Cuối cùng tôi đã tìm thấy thời gian để đưa ra một ví dụ ngắn gọn về hack này cho phép ít nhất 3 loại mẫu cơ bản trong ggplot2. Mã này:

Example.Data<- data.frame(matrix(vector(), 0, 3, dimnames=list(c(), c("Value", "Variable", "Fill"))), stringsAsFactors=F) 

Example.Data[1, ] <- c(45, 'Horizontal Pattern','Horizontal Pattern') 
Example.Data[2, ] <- c(65, 'Vertical Pattern','Vertical Pattern') 
Example.Data[3, ] <- c(89, 'Mesh Pattern','Mesh Pattern') 


HighlightDataVert<-Example.Data[2, ] 
HighlightHorizontal<-Example.Data[1, ] 
HighlightMesh<-Example.Data[3, ] 
HighlightHorizontal$Value<-as.numeric(HighlightHorizontal$Value) 
Example.Data$Value<-as.numeric(Example.Data$Value) 

HighlightDataVert$Value<-as.numeric(HighlightDataVert$Value) 
HighlightMesh$Value<-as.numeric(HighlightMesh$Value) 
HighlightHorizontal$Value<-HighlightHorizontal$Value-5 
HighlightHorizontal2<-HighlightHorizontal 
HighlightHorizontal2$Value<-HighlightHorizontal$Value-5 
HighlightHorizontal3<-HighlightHorizontal2 
HighlightHorizontal3$Value<-HighlightHorizontal2$Value-5 
HighlightHorizontal4<-HighlightHorizontal3 
HighlightHorizontal4$Value<-HighlightHorizontal3$Value-5 
HighlightHorizontal5<-HighlightHorizontal4 
HighlightHorizontal5$Value<-HighlightHorizontal4$Value-5 
HighlightHorizontal6<-HighlightHorizontal5 
HighlightHorizontal6$Value<-HighlightHorizontal5$Value-5 
HighlightHorizontal7<-HighlightHorizontal6 
HighlightHorizontal7$Value<-HighlightHorizontal6$Value-5 
HighlightHorizontal8<-HighlightHorizontal7 
HighlightHorizontal8$Value<-HighlightHorizontal7$Value-5 

HighlightMeshHoriz<-HighlightMesh 
HighlightMeshHoriz$Value<-HighlightMeshHoriz$Value-5 
HighlightMeshHoriz2<-HighlightMeshHoriz 
HighlightMeshHoriz2$Value<-HighlightMeshHoriz2$Value-5 
HighlightMeshHoriz3<-HighlightMeshHoriz2 
HighlightMeshHoriz3$Value<-HighlightMeshHoriz3$Value-5 
HighlightMeshHoriz4<-HighlightMeshHoriz3 
HighlightMeshHoriz4$Value<-HighlightMeshHoriz4$Value-5 
HighlightMeshHoriz5<-HighlightMeshHoriz4 
HighlightMeshHoriz5$Value<-HighlightMeshHoriz5$Value-5 
HighlightMeshHoriz6<-HighlightMeshHoriz5 
HighlightMeshHoriz6$Value<-HighlightMeshHoriz6$Value-5 
HighlightMeshHoriz7<-HighlightMeshHoriz6 
HighlightMeshHoriz7$Value<-HighlightMeshHoriz7$Value-5 
HighlightMeshHoriz8<-HighlightMeshHoriz7 
HighlightMeshHoriz8$Value<-HighlightMeshHoriz8$Value-5 
HighlightMeshHoriz9<-HighlightMeshHoriz8 
HighlightMeshHoriz9$Value<-HighlightMeshHoriz9$Value-5 
HighlightMeshHoriz10<-HighlightMeshHoriz9 
HighlightMeshHoriz10$Value<-HighlightMeshHoriz10$Value-5 
HighlightMeshHoriz11<-HighlightMeshHoriz10 
HighlightMeshHoriz11$Value<-HighlightMeshHoriz11$Value-5 
HighlightMeshHoriz12<-HighlightMeshHoriz11 
HighlightMeshHoriz12$Value<-HighlightMeshHoriz12$Value-5 
HighlightMeshHoriz13<-HighlightMeshHoriz12 
HighlightMeshHoriz13$Value<-HighlightMeshHoriz13$Value-5 
HighlightMeshHoriz14<-HighlightMeshHoriz13 
HighlightMeshHoriz14$Value<-HighlightMeshHoriz14$Value-5 
HighlightMeshHoriz15<-HighlightMeshHoriz14 
HighlightMeshHoriz15$Value<-HighlightMeshHoriz15$Value-5 
HighlightMeshHoriz16<-HighlightMeshHoriz15 
HighlightMeshHoriz16$Value<-HighlightMeshHoriz16$Value-5 
HighlightMeshHoriz17<-HighlightMeshHoriz16 
HighlightMeshHoriz17$Value<-HighlightMeshHoriz17$Value-5 

ggplot(Example.Data, aes(x=Variable, y=Value, fill=Fill)) + theme_bw() + #facet_wrap(~Product, nrow=1)+ #Ensure theme_bw are there to create borders 
    theme(legend.position = "none")+ 
    scale_fill_grey(start=.4)+ 
    #scale_y_continuous(limits = c(0, 100), breaks = (seq(0,100,by = 10)))+ 
    geom_bar(position=position_dodge(.9), stat="identity", colour="black", legend = FALSE)+ 
    geom_bar(data=HighlightDataVert, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.80)+ 
geom_bar(data=HighlightDataVert, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.60)+ 
    geom_bar(data=HighlightDataVert, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.40)+ 
    geom_bar(data=HighlightDataVert, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.20)+ 
    geom_bar(data=HighlightDataVert, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.0) + 
    geom_bar(data=HighlightHorizontal, position=position_dodge(.9), stat="identity", colour="black", size=.5)+ 
    geom_bar(data=HighlightHorizontal2, position=position_dodge(.9), stat="identity", colour="black", size=.5)+ 
    geom_bar(data=HighlightHorizontal3, position=position_dodge(.9), stat="identity", colour="black", size=.5)+ 
    geom_bar(data=HighlightHorizontal4, position=position_dodge(.9), stat="identity", colour="black", size=.5)+ 
    geom_bar(data=HighlightHorizontal5, position=position_dodge(.9), stat="identity", colour="black", size=.5)+ 
    geom_bar(data=HighlightHorizontal6, position=position_dodge(.9), stat="identity", colour="black", size=.5)+ 
    geom_bar(data=HighlightHorizontal7, position=position_dodge(.9), stat="identity", colour="black", size=.5)+ 
    geom_bar(data=HighlightHorizontal8, position=position_dodge(.9), stat="identity", colour="black", size=.5)+ 
    geom_bar(data=HighlightMesh, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.80)+ 
geom_bar(data=HighlightMesh, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.60)+ 
    geom_bar(data=HighlightMesh, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.40)+ 
    geom_bar(data=HighlightMesh, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.20)+ 
    geom_bar(data=HighlightMesh, position=position_dodge(.9), stat="identity", colour="black", size=.5, width=0.0)+ 
    geom_bar(data=HighlightMeshHoriz, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
geom_bar(data=HighlightMeshHoriz2, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz3, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz4, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz5, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz6, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz7, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz8, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz9, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz10, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz11, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz12, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz13, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz14, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz15, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz16, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent")+ 
    geom_bar(data=HighlightMeshHoriz17, position=position_dodge(.9), stat="identity", colour="black", size=.5, fill = "transparent") 

Tạo này:

enter image description here

Nó không phải là siêu đẹp, nhưng nó là giải pháp duy nhất tôi có thể nghĩ ra.

Có thể thấy tôi tạo ra một số dữ liệu rất cơ bản. Để có được các đường thẳng đứng, tôi chỉ cần tạo một khung dữ liệu để chứa biến tôi muốn thêm các đường thẳng đứng và vẽ lại đường viền đồ thị nhiều lần giảm chiều rộng mỗi lần.

Điều tương tự cũng được thực hiện cho các đường ngang nhưng cần phải có khung dữ liệu mới cho mỗi lần vẽ lại nơi tôi đã trừ giá trị (trong ví dụ '5') của tôi từ giá trị được liên kết với biến quan tâm. Giảm hiệu quả chiều cao của thanh. Điều này là khó khăn để đạt được và có thể có nhiều cách tiếp cận hợp lý hơn nhưng điều này minh họa làm thế nào nó có thể đạt được.

Mẫu lưới là kết hợp cả hai. Đầu tiên vẽ các đường thẳng đứng và sau đó thêm các đường ngang thiết lập fillfill='transparent' để đảm bảo các đường thẳng đứng không được vẽ lên.

Cho đến khi có bản cập nhật mẫu, tôi hy vọng một số bạn thấy điều này hữu ích.

CHỈNH SỬA 2:

Ngoài ra, các mẫu đường chéo cũng có thể được thêm vào. Tôi thêm một biến bổ sung cho các khung dữ liệu:

Example.Data[4,] <- c(20, 'Diagonal Pattern','Diagonal Pattern') 

Sau đó, tôi đã tạo ra một khung dữ liệu mới để tổ chức tọa độ cho các đường chéo:

Diag <- data.frame(
    x = c(1,1,1.45,1.45), # 1st 2 values dictate starting point of line. 2nd 2 dictate width. Each whole = one background grid 
    y = c(0,0,20,20), 
    x2 = c(1.2,1.2,1.45,1.45), # 1st 2 values dictate starting point of line. 2nd 2 dictate width. Each whole = one background grid 
    y2 = c(0,0,11.5,11.5),# inner 2 values dictate height of horizontal line. Outer: vertical edge lines. 
    x3 = c(1.38,1.38,1.45,1.45), # 1st 2 values dictate starting point of line. 2nd 2 dictate width. Each whole = one background grid 
    y3 = c(0,0,3.5,3.5),# inner 2 values dictate height of horizontal line. Outer: vertical edge lines. 
    x4 = c(.8,.8,1.26,1.26), # 1st 2 values dictate starting point of line. 2nd 2 dictate width. Each whole = one background grid 
    y4 = c(0,0,20,20),# inner 2 values dictate height of horizontal line. Outer: vertical edge lines. 
    x5 = c(.6,.6,1.07,1.07), # 1st 2 values dictate starting point of line. 2nd 2 dictate width. Each whole = one background grid 
    y5 = c(0,0,20,20),# inner 2 values dictate height of horizontal line. Outer: vertical edge lines. 
    x6 = c(.555,.555,.88,.88), # 1st 2 values dictate starting point of line. 2nd 2 dictate width. Each whole = one background grid 
    y6 = c(6,6,20,20),# inner 2 values dictate height of horizontal line. Outer: vertical edge lines. 
    x7 = c(.555,.555,.72,.72), # 1st 2 values dictate starting point of line. 2nd 2 dictate width. Each whole = one background grid 
    y7 = c(13,13,20,20),# inner 2 values dictate height of horizontal line. Outer: vertical edge lines. 
    x8 = c(.8,.8,1.26,1.26), # 1st 2 values dictate starting point of line. 2nd 2 dictate width. Each whole = one background grid 
    y8 = c(0,0,20,20),# inner 2 values dictate height of horizontal line. Outer: vertical edge lines. 
    #Variable = "Diagonal Pattern", 
    Fill = "Diagonal Pattern" 
) 

Từ đó tôi đã thêm geom_paths đến ggplot trên với nhau người gọi tọa độ khác nhau và vẽ các đường vọt xà mong muốn:

+geom_path(data=Diag, aes(x=x, y=y),colour = "black")+ # calls co-or for sig. line & draws 
    geom_path(data=Diag, aes(x=x2, y=y2),colour = "black")+ # calls co-or for sig. line & draws 
    geom_path(data=Diag, aes(x=x3, y=y3),colour = "black")+ 
    geom_path(data=Diag, aes(x=x4, y=y4),colour = "black")+ 
    geom_path(data=Diag, aes(x=x5, y=y5),colour = "black")+ 
    geom_path(data=Diag, aes(x=x6, y=y6),colour = "black")+ 
    geom_path(data=Diag, aes(x=x7, y=y7),colour = "black") 

Điều này dẫn đến những điều sau đây:

enter image description here

Đó là một chút cẩu thả vì tôi không đầu tư quá nhiều thời gian để nhận các đường thẳng hoàn hảo và cách nhau nhưng điều này sẽ là một bằng chứng về khái niệm.

Rõ ràng các dòng có thể nghiêng theo hướng ngược lại và cũng có chỗ cho chia lưới chéo giống như chia lưới ngang và dọc.

Tôi nghĩ đó là tất cả những gì tôi có thể cung cấp ở mặt trước. Hy vọng ai đó có thể tìm thấy một sử dụng cho nó.

CHỈNH SỬA 3: Từ nổi tiếng cuối cùng. Tôi đã đưa ra một lựa chọn mẫu khác. Lần này sử dụng geom_jitter.

Một lần nữa tôi đã thêm biến khác vào khung dữ liệu:

Example.Data[5,] <- c(100, 'Bubble Pattern','Bubble Pattern') 

Và tôi đã ra lệnh làm thế nào tôi muốn mỗi mẫu trình bày:

Example.Data$Variable = Relevel(Example.Data$Variable, ref = c("Diagonal Pattern", "Bubble Pattern","Horizontal Pattern","Mesh Pattern","Vertical Pattern")) 

Tiếp theo tôi tạo ra một cột để chứa các số liên quan đến việc thanh mục tiêu dự định trên trục x:

Example.Data$Bubbles <- 2 

Được theo dõi bởi các cột để tiếp tục ở các vị trí trên trục y của 'bong bóng':

Example.Data$Points <- c(5, 10, 15, 20, 25) 
Example.Data$Points2 <- c(30, 35, 40, 45, 50) 
Example.Data$Points3 <- c(55, 60, 65, 70, 75) 
Example.Data$Points4 <- c(80, 85, 90, 95, 7) 
Example.Data$Points5 <- c(14, 21, 28, 35, 42) 
Example.Data$Points6 <- c(49, 56, 63, 71, 78) 
Example.Data$Points7 <- c(84, 91, 98, 6, 12) 

Cuối cùng tôi đã thêm geom_jitter s đến ggplot trên sử dụng các cột mới cho việc định vị và tái sử dụng 'điểm' để thay đổi kích cỡ của ' bong bóng:

+geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points3, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points4, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points3, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points4, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points5, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points5, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points6, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points6, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points7, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points7, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points3, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points4, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points3, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points4, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points2, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points5, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points5, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points6, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points6, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points7, size=Points), alpha=.5)+ 
    geom_jitter(data=Example.Data,aes(x=Bubbles, y=Points7, size=Points), alpha=.5) 

Mỗi lần âm mưu đang chạy các vị trí jitter các 'bong bóng' khác nhau nhưng đây là một trong những kết quả đầu ra đẹp hơn tôi đã:

enter image description here

Đôi khi 'bong bóng' sẽ nhô ra ngoài biên giới. Nếu điều này xảy ra chạy lại hoặc đơn giản là xuất ở kích thước lớn hơn. Nhiều bong bóng hơn có thể được vẽ trên mỗi gia số trên trục y, sẽ lấp đầy nhiều khoảng trống nếu bạn muốn.

Điều đó làm cho tối đa 7 mẫu (nếu bạn bao gồm đối diện nghiêng đường chéo và lưới chéo của cả hai) có thể bị tấn công trong ggplot.

Xin vui lòng đề xuất thêm nếu có ai đó có thể nghĩ về một số.

EDIT 4: Tôi đã làm việc trên một hàm bao bọc để tự động hóa các mẫu/mẫu trong ggplot2. Tôi sẽ đăng một liên kết sau khi đã mở rộng chức năng cho phép các mẫu trong lô facet_grid vv Đây là một đầu ra với chức năng đầu vào cho một âm mưu đơn giản của thanh làm ví dụ:

enter image description here

tôi sẽ thêm một chỉnh sửa cuối cùng khi tôi đã có sẵn chức năng chia sẻ.

EDIT 5: Here's a link với hàm EggHatch mà tôi đã viết để làm cho quá trình thêm mẫu vào ô geom_bar dễ dàng hơn một chút.

Các vấn đề liên quan