- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试绘制堆叠的geom_area图,但想用一条线勾勒出每个区域图(在第一个“红色”区域而不是蓝色区域工作)。这是我的最佳尝试,但我不知道如何将线型也堆叠起来。有想法吗?
df= data.frame(Time=as.numeric(strsplit('1939 1949 1959 1969 1979 1989 1999 2009 2019 2029 2039 2049 1939 1949 1959 1969 1979 1989 1999 2009 2019 2029 2039 2049', split=' ')[[1]] ),
Acres=as.numeric(strsplit('139504.2 233529.0 392105.3 502983.9 685159.9 835594.7 882945.1 1212671.4 1475211.9 1717971.7 1862505.7 1934308.0 308261.4 502460.8 834303.1 1115150.7 1430797.8 1712085.8 1973366.1 1694907.7 1480506.0 1280047.6 1164200.5 1118045.3', split=' ')[[1]] ),
WUClass= strsplit('DenseUrban DenseUrban DenseUrban DenseUrban DenseUrban DenseUrban DenseUrban DenseUrban DenseUrban DenseUrban DenseUrban DenseUrban Urban Urban Urban Urban Urban Urban Urban Urban Urban Urban Urban Urban', split=' ')[[1]]
)
a=ggplot(df,aes(x = Time,y = Acres,fill=WUClass))+ geom_area( position = 'stack' )
plot(a)
a+ geom_line(aes(position = 'stack'))
最佳答案
要将轮廓添加到该区域,只需更改colour
:
ggplot(df,aes(x = Time,y = Acres,fill=WUClass)) +
geom_area( position = 'stack') +
geom_area( position = 'stack', colour="black", show_guide=FALSE)
ggplot(df,aes(x = Time, y = Acres, fill=WUClass, group=WUClass)) +
geom_area() + geom_line(aes(ymax=Acres), position="stack")
关于r - geom_area区域和轮廓图ggplot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12323060/
使用 geom_area 处理绘图时遇到了一些问题。我有一个包含日期和计数的数据框,如下所示: dates <- c("02/01/00", "02/04/00", "02/07/00", "02/1
我有看起来像这样的数据: df % ggplot(aes(x, y)) + geom_area() 但图表真的很刺耳。我如何将锯齿状边缘平滑成这样的: 谢谢! 最佳答案 扩展 Axem
我试图让 geom_area 具有取决于 Y 轴值的双色。 例如,如果我们有一个最大 X 值为 50 的 geom_area,我希望填充颜色低于 10 时为蓝色,高于 10 时为红色。 样本数据; d
我想根据因子变量“状态”区分绘图颜色的区域。我使用 fill=Status,但是,我看到绘图区域出现了中断。关于如何避免这种情况以及为什么会发生这种情况的任何想法/建议? df1 <- data.fr
我正在使用 geom_area绘制一个非常简单的数据集。使用 geom_line 绘图时一切正常,但是当我切换到 geom_area 时绘制更高的值。查看图表,将是代表我的问题的最佳方式: requi
我正在尝试使用 ggplot 的 geom_area 以不同颜色填充曲线下区域的切片(x 轴) .但不知何故,我无法使区域的侧面垂直。这是一个最小的可重现示例: library(ggplot2) x
我正在尝试生成一个堆叠区域图,但是 ggplot 会生成重叠区域。我试过其他与我类似的例子,但它们有效而我的无效。 > cx date type visitors 1 2009-1
R 新手,stackoverflow 新手,所以请原谅我.... 我正在尝试使用 ggplot2 在 R 中绘制时间序列图。我想显示两个折线图,它们在给定日期的值下方填充。我一直在尝试使用 geom_
我想将 geom_area() 的起始 y 级别从零移开。这是在下面的例子中,第一个函数调用没问题,但我怎样才能纠正第二个调用的情节: library(ggplot2) set.seed(123) m
对于数据: def.percent period valence 1 6.4827843 1984-1985 neg 2 5.8232425 1985-1986 ne
我正在尝试制作一个区域图,其中不同区域相互重叠而不是堆叠。 我有一个看起来像这样的数据框: r variable value 1 45.0 Cat 1 4.0572
这是这里问题的延续:Create non-overlapping stacked area plot with ggplot2 我有一个由以下代码创建的 ggplot2 面积图。我想要来自 names
使用 geom_area() 时是否可以强制执行堆栈顺序? ?我不明白为什么 geom_area(position = "stack")在 1605 年左右的堆栈顺序中产生这种奇怪的波动。 数据框中没
我有一些样本队列数据,在使用 ggplot() 绘制时未进行颜色编码或按正确的时间顺序显示。以下代码用于生成绘图: library(ggplot2) blues dput(cohort.chart)
我编写了以下函数来制作自定义堆叠图: stacked_plot % mutate(!!date_col := floor_date(!!date_col, unit = !!date_un
这个问题已经有答案了: Determining the area of Shapefiles (2 个回答) 已关闭去年。 我想使用 ggplot2 获取曲线下的面积。问题是我只有连续尺度(时间)上的
我正在使用 ggplot2 使用 geom_area 绘制以下数据。这些值被设计为 x 轴镜像。但《狗》情节的结局并没有反射(reflect)出来。 但是从这个数据帧中可以看出,狗应该以 x=100
在继续阅读之前,建议您下载并查看this question posted in this forum 中的原始代码。 . 我运行这个 ggplot 代码: ggplot(data=data, aes
我一直在尝试生成一个带有离散 x 变量的堆积面积图(因为我想显示财政年度,即“2013/14”,而不是日历年)。但是,将 x 轴变量转换为一个因子会阻止在最终图表中呈现 geom。 有解决办法吗? l
我有一个 geom_area 图,如下所示: 我想将 x 轴以上的所有内容着色为绿色,将 x 轴以下的所有内容着色为红色。我的数据中有一个类别列,其中包含所有正值的字符串“正”和所有负值的“负”,因此
我是一名优秀的程序员,十分优秀!