我想在Matlab中给垂直线贴上标签。我可以想象两种选择:要么让图例条目就在每条垂直线的旁边,要么让垂直线在图中编号,然后在图例中重新显示数字。这两者都有可能吗?
我不想使用不同的颜色或图形模式,因为我有几条垂直线,否则图很难读。
X是日期数的向量,y是价格数据。Date1和Date2是x的元素日期。
plot(x,y), grid on;
dateaxis('x',17);
line([Date1 Date1], ylim); % I would like to have a legend entry for this right at the line in the gra
继续我的问题:
我可以用这些代码创建一个数字。
x <- 1:100
y <- x * x
z <- abs(cos(x * pi / (max(x))))
df <- data.frame(x = x, y = y, z = z)
library(ggplot2)
mult <- 200
ggplot(df, aes(x, y)) + geom_line() + geom_ribbon(aes(ymin=y-mult*z, ymax=y+mult*z))
但我现在的问题是如何创造一个传说来反映线条的大小。例如,此图中的图例
ggplot(df,
ggplot使用ggplot移除geom_line绘图的图例。
例如,见下文:
library(plotly)
g <- ggplot(iris)
g = g + geom_line(aes(x = Sepal.Length, y = Sepal.Width, color = Species), size = 0.05)
g # Here is a legend
(gg <- ggplotly(g)) # Legend has now been removed.
有什么办法找回传奇吗?
我正在使用plotly_2.0.19和ggplot2_2.0.0.9000。