@@ -89,22 +89,24 @@ ggplot(df, @aes(x = x, y = y, text = t)) +
8989
9090# Control where the text appears relative to the point:
9191
92- ggplot (df, @aes (x = x, y = y, text = t )) +
92+ ggplot (df, @aes (x = x, y = y)) +
9393 geom_point (size = 15 ) +
94- geom_text (fontsize = 20 , align = (:center , :bottom )) +
94+ geom_text (@aes (text = t), fontsize = 20 , align = (:center , :bottom )) +
9595 lims (x = (0.5 , 2.5 ), y = (0.5 , 2.5 ))
9696
9797# Different alignment options:
9898
99- ggplot (df, @aes (x = x, y = y, text = t )) +
99+ ggplot (df, @aes (x = x, y = y)) +
100100 geom_point (size = 15 ) +
101- geom_text (fontsize = 20 , align = (:left , :center )) +
101+ geom_text (@aes (text = t), fontsize = 20 , align = (:left , :center )) +
102102 lims (x = (0.5 , 2.5 ), y = (0.5 , 2.5 ))
103103
104104# ## Labeling Real Data
105105
106106# Label species on a scatterplot (using summarized data):
107107
108+ import Statistics: mean
109+
108110species_centroids = @chain penguins begin
109111 @group_by (species)
110112 @summarize (
0 commit comments