- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个包含多个错误栏的条形图。像这样:http://flyordie.sin.khk.be/r/histogram%20error%20bars.PNG我有以下数据集: http://flyordie.sin.khk.be/r/output.csv
我尝试过使用 ggplot2 和 lattice graphics,但没有找到适合我需要的东西。
我当前显示条形图的代码是这样的:
data <- read.csv("c:/output.csv")
data
par(las=3)
barplot(data$PlateId,
height=data$HC.Maximum,
names.arg=data$PlateId,
col="lightblue")
为了显示最高的错误栏,我使用了这段代码 库(ggplot2)
limits <- aes(ymax = qc$HC.Maximum, ymin = qc$HC.Minimum)
p <- ggplot(qc, aes(colour=HC.Median,x=PlateId))
p + geom_bar(position="dodge")+ geom_errorbar(limits,position="dodge")
但我不知道如何将它们放在同一个图形上(就像我的例子一样)
数据:
qc <- structure(list(row = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Row", class = "factor"),
ID = 1:14, PlateId = c(35276L, 35279L, 35280L, 35281L, 35282L,
35290L, 35291L, 35292L, 35293L, 35294L, 35295L, 35296L, 35297L,
35298L), LC.Median = c(439688.495, 509376.055, 475218.99,
497368.215, 481801.9, 468603.43, 494713.175, 459047.385,
482819.47, 495162.31, 449592.51, 460564.95, 478715.915, 452293.465
), LC.Stdev = c(52290.12229, 49648.49436, 55743.10306, 62002.53552,
46908.66149, 52489.615, 48016.94019, 52082.23899, 47934.37133,
58977.84845, 45827.62648, 53514.21095, 49638.98286, 139686.144
), LC.Minimum = c(279610.16, 423651.45, 356422.31, 411639.77,
397362.84, 345178.07, 406073.72, 352834.86, 339035.77, 369554.11,
348688.39, 357341.56, 370463.11, 210367.91), LC.Maximum = c(498195.9,
630648.53, 614625.78, 686737.35, 621372.36, 576491.41, 579708.95,
580633.28, 580125.9, 622108.73, 530234.87, 563616.65, 614936.33,
730272.63), HC.Median = c(507356.465, 553226.525, 447067.77,
452223.76, 453439.37, 422491.755, 447438.8, 435034.635, 446148.105,
438089.69, 466748.63, 440005.81, 454927.74, 483599.71), HC.Stdev = c(65355.46121,
72762.07338, 80118.37641, 43653.99318, 73389.12355, 62590.47601,
46421.36678, 62822.88532, 61175.4241, 64418.56174, 63101.2232,
68166.51814, 61256.74139, 87354.9441), HC.Minimum = c(381552.05,
391124.94, 280614.72, 395454.12, 291433.84, 252579.15, 331661.03,
296223.64, 240262.37, 299431.98, 375224.27, 278780.87, 310275.66,
213170.04), HC.Maximum = c(626483.6, 635111.41, 555357.3,
528822.8, 534172.42, 514927.42, 538385.26, 533024.74, 524973.99,
544335.94, 564954.87, 572206.98, 547489.1, 565338.09), zPrime = c(-3.96,
-23.73, -7.88, -5.81, -5.32, -5.54, -4.48, -7.98, -6.99,
-5.63, -22.54, -33.83, -11.92, -17.44), Sb = c(1.17, 1.03,
0.91, 0.91, 0.89, 0.89, 0.9, 0.92, 0.92, 0.89, 1.04, 0.98,
0.95, 1.09), Sn = c(1.37, 0.3, -0.83, -0.76, -1.22, -1.01,
-1.08, -0.74, -0.86, -0.95, 0.31, -0.2, -0.52, 0.27)), .Names = c("row",
"ID", "PlateId", "LC.Median", "LC.Stdev", "LC.Minimum", "LC.Maximum",
"HC.Median", "HC.Stdev", "HC.Minimum", "HC.Maximum", "zPrime",
"Sb", "Sn"), class = "data.frame", row.names = c(NA, -14L))
最佳答案
在创建多层图时,我采用以下方法:
ggplot
的初始调用中定义通用美学请注意,我已经修改了您的代码,因为我无法让您的示例运行:
geom_bar
提供明确的 binwidth=1
以删除警告position=dodge
因为这是默认的和多余的geom_bar
提供明确的 stat=identity
代码:
ggplot(qc, aes(x=PlateId)) +
geom_bar(aes(y=HC.Median), binwidth=1, stat="identity", fill="cyan") +
geom_errorbar(aes(ymin=HC.Minimum, ymax=LC.Minimum), colour="red") +
geom_errorbar(aes(ymin=LC.Maximum, ymax=HC.Maximum), colour="purple")
关于r - 具有多个重叠误差线的条形图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5728785/
我有一个任务,必须求解线性方程组 Ax =B,其中 A 是 10000 量级的稀疏矩阵。我正在使用 csparse 来求解它。在我的初始实现中,出于演示目的,A 是 3*3 阶单位矩阵,B ={1,2
我正在尝试训练随机森林模型,但出现以下错误。我需要对分类模型使用不同的设置来解决 RMSE 问题吗?我尝试将“好”转换为一个因素,但这引发了一个新错误。 错误: Error in train.defa
当使用 %Lf 打印时,一个大的 double 值被改变以下组合的值给出正确的结果小数点前9位/小数点后6位例如用 %Lf 打印的小数点前 9 位的值输入:3435537287.32输出:343553
我正在尝试实现高度为 100% 的重复垂直背景。遗憾的是,每当我试图通过仅添加纯文本来扩展页面的高度时,具有 100% 高度和背景重复的背景就会被切掉。我只想让背景重复。这是屏幕截图。 http://
所以我有: t = [0.0, 3.0, 5.0, 7.2, 10.0, 13.0, 15.0, 20.0, 25.0, 30.0, 35.0] U = [12.5, 10.0, 7.6, 6.0,
我使用了 Nister 的 5 点法来计算基本矩阵。使用 RANSAC 和 Sampson 错误阈值进一步改进了异常值拒绝。我随机选择 5 个点集,估计基本矩阵并评估匹配向量的 Sampson 误差。
为分类问题运行 gbm 函数时。我收到以下错误: Error in res[flag, ] 0.5,1,0) table(pred,df$Group) pred 0 1 0 98
我使用 Angular ngTagsInput,我的列表如下: [{text: "4353453"}, {text: "453453"}, {text: "4534534"}, {text: "53
我正在尝试 Angular 问题,并且坚持理解错误,这意味着如果我无法理解错误,我将无法前进,例如 zone.js:654 Unhandled Promise rejection: Failed to
我有一个关于在线性混合模型上运行事后测试的问题: 我正在 lme4 中运行一个线性混合模型,分为 3 组,每组 5 条蛇,每组采用不同的通气率 (Vent),在不同的位置进行测量时间点 (Time),
我正在尝试运行逻辑回归并不断收到“NA”错误。问题是它说有 NA 的列没有 NA,全是 0 或 1。我的代码如下: #V1=race, V2=momcounts of breast cancer, V
我在输出之间得到随机 NaN。 Random Temp:61.816288952756864 'F Random Temp:NaN 'F Random Temp:NaN 'F Random Temp:
我正在尝试通过取下平板框架来减少我的大炮天文图像,这很有效。但它使所有值都非常低(所以几乎是黑色图片),这就是为什么我也想将其乘以平均值。然而这给了我一个错误。 (虽然没有乘法它也能工作。) 有人知道
我正在使用 adaboost 构建一个模型,并尝试让 roc 图发挥作用。这是我的代码: ens=fitensemble(X,y,'AdaBoostM1',100,'Tree'); [ytest, s
当尝试使用 Protractor 和 Angular Testing 模态窗口上的可见按钮时,我收到以下错误: UnknownError: unknown error: Element is not
我正在尝试使用命令通过 Yeoman 构建 Angular “哟有 Angular ” 一切正常,直到我到达 tmp 目录: npm ERR! Error: EACCES, mkdir '/home/
我在使用 OpenCV 计算立体声对的校正时遇到一些问题:stereoCalibrate 返回高均方根误差,我得到了错误的校正对。我尝试了我的整改程序和 opencv 提供的 stereo_calib
我在 Mac (OS X 10.9) 上安装了 Yeoman,并且正在尝试运行 yo angular。 我收到以下错误: path.js:384 throw new TypeError('Ar
我有运行循环的线程。我需要该循环每 5 毫秒运行一次(1 毫秒错误)。我知道 Sleep() 函数并不精确。 你有什么建议吗? 更新。我不能用其他方式做到这一点。在循环结束时,我需要某种 sleep
我一直在试验 FFT 算法。我使用 NAudio 以及来自互联网的 FFT 算法的工作代码。根据我对性能的观察,生成的音调不准确。 我将 MIDI(从 GuitarPro 生成)转换为 WAV 文件(
我是一名优秀的程序员,十分优秀!