- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道如何在ggplot2
中的轮廓线上获取数据标签。谢谢
require(grDevices) # for colours
x <- seq(-4*pi, 4*pi, len = 27)
y <- seq(-4*pi, 4*pi, len = 27)
r <- sqrt(outer(x^2, y^2, "+"))
rx <- range(x <- 10*1:nrow(volcano))
ry <- range(y <- 10*1:ncol(volcano))
ry <- ry + c(-1, 1) * (diff(rx) - diff(ry))/2
plot(
x = 0
, y = 0
, type = "n"
, xlim = rx
, ylim = ry
, xlab = ""
, ylab = ""
)
contour(
x = x
, y = y
, z = volcano
, add = TRUE
)
library(ggplot2)
library(reshape2)
volcano3d <- melt(volcano)
names(volcano3d) <- c("x", "y", "z")
# Basic plot
v <- ggplot(volcano3d, aes(x, y, z = z))
v + stat_contour()
最佳答案
使用directlabels程序包并从this中选择解决方案
# Basic plot
v <- ggplot(volcano3d, aes(x, y, z = z))
library(directlabels)
v2 <- v + stat_contour(aes(colour = ..level..))
direct.label(v2, method="bottom.pieces")
关于r - 带有数据标签的stat_contour,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13627735/
当我将stat_contour与多边形一起使用时,某些区域不应该被填充,因为那里没有数据,我在图中标记了它们。有谁知道如何避免这种情况?另外,坐标轴和绘图区域之间有空格,如何去掉?! 这是绘图代码:
我有一些数据要在多面水平图(等高线)中显示,并且非常惊讶地在其中一个数据基本恒定的面板中看到奇怪的嘈杂等高线。我将整个图层(所有面板)的 binwidth 设置为 1,并且此面板的数据子集在 1 +/
我想使用 ggplot 显示等高线图和 stat_contour对于我的两类数据 facet_grid .我想根据数据突出显示特定级别。这是一个类似的虚拟示例,使用通常的 volcano数据。 lib
我正在寻找完全填充由 ggplot2 的 stat_contour 生成的轮廓的方法。目前的结果是这样的: # Generate data library(ggplot2) library(resha
是否可以使用来自不同数据帧的数据覆盖来自 ggplot2 的多个 stat_contour 图? 我已经阅读了覆盖不同几何体的解决方案,但为此我特别想使用 stat_contour。 两个数据集的 X
我是 ggplot2 的新手,我正在尝试复制我使用 filled.contour 创建的图形与 ggplot2。 下面是我的代码: require(ggplot2) require(reshape2)
我是一名优秀的程序员,十分优秀!