# ggplot2 画出的一系列正弦曲线
sines = outer(1:20, 1:4, function(x, y) sin(x / 20 * pi * y))
df = expand.grid(x = 1:20, y = factor(1:4))
df$sines = as.vector(sines)
p = ggplot(df, aes(x = x, y = sines, color = y)) +
geom_point(aes(shape = y)) +
geom_line() +
labs(x = "$x$") +
guides(col = guide_legend("$y$"), shape = guide_legend("$y$") )
print(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.