我想用ggplot探索directlabels包.我试图在简单折线图的端点处绘制标签; 但是,标签面板会剪切标签.
我想可能有另一个解决方案使用annotate或其他一些geoms.但我想用直接标签来解决.请参阅下面的代码和图片.谢谢.
library(ggplot2)
library(directlabels)
library(tidyr)
#generate data frame with random data, for illustration and plot:
x <- seq(1:100)
y <- cumsum(rnorm(n = 100, mean = 6, sd = 15))
y2 <- cumsum(rnorm(n = 100, mean = 2, sd = 4))
data <- as.data.frame(cbind(x, y, y2))
names(data) <- c("month", "stocks", "bonds")
tidy_data <- gather(data, month)
names(tidy_data) <- c("month", "asset", "value")
p <- ggplot(tidy_data, aes(x = month, y = value, colour = asset)) +
geom_line() +
geom_dl(aes(colour = asset, …Run Code Online (Sandbox Code Playgroud) 我不熟悉R中的circlize包.但是,我的第一个和弦图的输出看起来是椭圆形而不是圆形,如文档示例所示.我能做什么?代码和图片如下.
#random matrix, for illustration
mat
E1 E2 E3 E4 E5 E6
S1 8 13 18 6 11 14
S2 10 12 1 3 5 7
S3 2 16 4 17 9 15
chordDiagram(mat)
Run Code Online (Sandbox Code Playgroud)
这是我的输出:

这就是我要的 :
