小编Att*_*s29的帖子

如何使用ggplot2仅在轴上显示整数值

我有以下情节:

library(reshape)
library(ggplot2)
library(gridExtra)
require(ggplot2)



data2<-structure(list(IR = structure(c(4L, 3L, 2L, 1L, 4L, 3L, 2L, 1L
), .Label = c("0.13-0.16", "0.17-0.23", "0.24-0.27", "0.28-1"
), class = "factor"), variable = structure(c(1L, 1L, 1L, 1L, 
2L, 2L, 2L, 2L), .Label = c("Real queens", "Simulated individuals"
), class = "factor"), value = c(15L, 11L, 29L, 42L, 0L, 5L, 21L, 
22L), Legend = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L), .Label = c("Real queens", 
"Simulated individuals"), class = "factor")), .Names = c("IR", 
"variable", "value", …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

66
推荐指数
9
解决办法
5万
查看次数

cor.test()的矩阵版本

Cor.test()采用向量xy参数,但我有一整个数据矩阵,我想成对测试.Cor()把这个矩阵作为一个参数就好了,我希望找到一种方法来做同样的事情cor.test().

其他人的共同建议似乎是使用cor.prob():

https://stat.ethz.ch/pipermail/r-help/2001-November/016201.html

但是这些p值与cor.test()!!! 生成的p值不同 Cor.test()也似乎更适合处理成对删除(我的数据集中有相当多的缺失数据)cor.prob().

有没有人有其他选择cor.prob()?如果解决方案涉及嵌套for循环,那么就是它(我已经足够新了,R因为即使这对我来说也是有问题的).

r correlation

25
推荐指数
4
解决办法
3万
查看次数

如何在R中的条形图中显示每个因子顶部的频率

可能重复:
在R,y轴上以不同比例添加文本到水平条形图?
注释条形上方的值(ggplot刻面)

使用下面的代码,我希望在每列上方显示一个数字,该数字对应于该列的y值.换句话说,我试图让"QnWeight_initial"在灰色条的顶部显示593,所以......

我的数据:

data<-structure(list(V1 = structure(c(2L, 1L), .Label = c("593", "QnWeight_initial"
), class = "factor"), V2 = structure(c(2L, 1L), .Label = c("566", 
"Head"), class = "factor"), V3 = structure(c(2L, 1L), .Label = c("535", 
"V1"), class = "factor"), V4 = structure(c(2L, 1L), .Label = c("535", 
"V2"), class = "factor"), V5 = structure(c(2L, 1L), .Label = c("535", 
"V3"), class = "factor"), V6 = structure(c(2L, 1L), .Label = c("482", 
"Left_Leg"), class = "factor"), V7 = structure(c(2L, 1L), .Label = c("474", 
"Left_Antenna"), …
Run Code Online (Sandbox Code Playgroud)

plot r

14
推荐指数
1
解决办法
7万
查看次数

在grid.arrange中绘制一个图例和间隔良好的通用y轴和主标题

我有以下代码将生成两个pdf文件,其中包含当前工作目录的图:

library(reshape)
library(ggplot2)
require(ggplot2)
source("http://gridextra.googlecode.com/svn/trunk/R/arrange.r")

data<-structure(list(Loci = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 
21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 
34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 52L, 44L, 45L, 
46L, 47L, 48L, 49L, 50L, 51L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 
60L, 61L, 62L), .Label = c("Baez", "Blue", "C147", "C204", "C21", 
"C278_PT", "C294", "C316", "C485", …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

13
推荐指数
1
解决办法
2万
查看次数

如何在水平图中将x轴标签旋转90度

我正在尝试可视化相关性图,我认为我已经让它工作了,除了x轴标签的混乱.有关如何旋转它们的任何建议?许多Base R图的一些参数似乎不适用于水平图.我可能不知道我在说什么.

这是我使用的数据:

cor2<-structure(c(1, -0.0389681095266643, -0.0389681095266643, 0.178476154216706, 
-0.178476154216706, -0.168494117498168, -0.0531355593389041, 
-0.0627159607856109, -0.11922152176561, 0.00887070126495505, 
-0.0721998017906867, -0.140654273521441, 0.0257953297166468, 
-0.0504004052031319, -0.057270788080051, -0.0918121581058645, 
-0.0389681095266643, 1, 1, -0.207885482210833, 0.207885482210833, 
0.221906241587463, 0.285338260198777, 0.370743678038144, 0.219208701879567, 
0.266580102221828, 0.193378655575033, 0.23922965323291, 0.164352387360997, 
0.229607796224011, 0.184412911672718, -0.250294366329347, -0.0389681095266643, 
1, 1, -0.207885482210833, 0.207885482210833, 0.221906241587463, 
0.285338260198777, 0.370743678038144, 0.219208701879567, 0.266580102221828, 
0.193378655575033, 0.23922965323291, 0.164352387360997, 0.229607796224011, 
0.184412911672718, -0.250294366329347, 0.178476154216706, -0.207885482210833, 
-0.207885482210833, 1, -1, -0.836264694082863, 0.0968492347163521, 
-0.529206721168992, -0.368511719318385, -0.370488391611307, -0.446552321746797, 
-0.0946404317035884, -0.166601542941319, -0.371982811624152, 
-0.0551151773556682, -0.0252777576827408, -0.178476154216706, 
0.207885482210833, 0.207885482210833, -1, 1, 0.836264694082863, 
-0.0968492347163521, 0.529206721168992, 0.368511719318385, 0.370488391611307, 
0.446552321746797, 0.0946404317035884, 0.166601542941319, …
Run Code Online (Sandbox Code Playgroud)

r levelplot

13
推荐指数
1
解决办法
1万
查看次数

如何选择具有某一列完整案例的数据?

我试图得到一个数据框(just.samples.with.shoulder.values比方说)只包含非NA值的样本.我试图用这个complete.cases函数来完成这个,但我想我在语法上做了一些错误:

data <- structure(list(Sample = 1:14, Head = c(1L, 0L, NA, 1L, 1L, 1L, 
0L, 0L, 1L, 1L, 1L, 1L, 0L, 1L), Shoulders = c(13L, 14L, NA, 
18L, 10L, 24L, 53L, NA, 86L, 9L, 65L, 87L, 54L, 36L), Knees = c(1L, 
1L, NA, 1L, 1L, 2L, 3L, 2L, 1L, NA, 2L, 3L, 4L, 3L), Toes = c(324L, 
5L, NA, NA, 5L, 67L, 785L, 42562L, 554L, 456L, 7L, NA, 54L, NA
)), .Names = c("Sample", …
Run Code Online (Sandbox Code Playgroud)

r

13
推荐指数
2
解决办法
3万
查看次数

尽管 cy.on('uncaught:exception') 赛普拉斯未捕获断言错误

关于以下错误:

Uncaught Error: Script error.
Cypress detected that an uncaught error was thrown from a cross origin script.
We cannot provide you the stack trace, line number, or file where this error occurred.
Run Code Online (Sandbox Code Playgroud)

参考https://docs.cypress.io/api/events/catalog-of-events.html#To-catch-a-single-uncaught-exception

我正在尝试运行填写表单并单击按钮提交的测试:

it('adds biological sample with maximal input', function(){
    cy.on('uncaught:exception', (err, runnable) => {
    expect(err.message).to.include('of undefined')
      done()
      return false
    });
    cy.get('a').contains('Add biological sample').click();

 . . . 

    cy.contains('Action results');
  });
Run Code Online (Sandbox Code Playgroud)

尽管我的规范包含以下内容,但我还是收到了错误消息:

    cy.on('uncaught:exception', (err, runnable) => {
    expect(err.message).to.include('of undefined')
      done()
      return false
    });
Run Code Online (Sandbox Code Playgroud)

这是测试失败的图像 测试失败.

左下角的错误是,

错误:未捕获的断言错误:预期的 '$f …

cypress

13
推荐指数
2
解决办法
2万
查看次数

如何在ggplot2中独立控制y轴刻度和x轴刻度?

我想从x轴移除轴刻度而不从y轴移除它们.

现在,我可以使用以下方法删除它们:

axis.ticks=theme_blank()
Run Code Online (Sandbox Code Playgroud)

例如:

# Generate data
c <- ggplot(mtcars, aes(factor(cyl)))

c + geom_bar()+opts(axis.ticks=theme_blank())
#c + geom_bar(width=.5)
#c + geom_bar() + coord_flip()
#c + geom_bar(fill="white", colour="darkgreen")
Run Code Online (Sandbox Code Playgroud)

但我不知道如何独立控制它们.

r ggplot2

12
推荐指数
1
解决办法
2万
查看次数

错误TS2339:属性'takeUntil'在类型'Observable <Foo>'和其他rxjs v.6错误上不存在

我刚刚在我的角度项目中更新了很多包.

旧的package.json:

{
  "name": "data-jitsu",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.10",
    "@angular/cdk": "^5.2.5",
    "@angular/common": "5.2.7",
    "@angular/compiler": "5.2.7",
    "@angular/core": "5.2.7",
    "@angular/forms": "5.2.7",
    "@angular/http": "5.2.7",
    "@angular/material": "^5.2.5",
    "@angular/platform-browser": "5.2.7",
    "@angular/platform-browser-dynamic": "5.2.7",
    "@angular/router": "5.2.7",
    "@types/youtube": "0.0.29",
    "angular-froala-wysiwyg": "^2.7.2-1",
    "angular2-materialize": "^15.1.10",
    "angularfire2": "^4.0.0-rc0",
    "core-js": "^2.4.1",
    "d3": "^4.13.0",
    "firebase": "^3.9.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.0.0",
    "materialize-css": "^0.100.2",
    "ngx-youtube-player": "0.0.41",
    "rxjs": "^5.5.6",
    "zone.js": …
Run Code Online (Sandbox Code Playgroud)

rxjs typescript rxjs5 angular rxjs6

10
推荐指数
1
解决办法
7026
查看次数

如何在Angular Material中使用mat-slide-toggle的MatSlideToggleChange

我正在尝试使用表单中的开关来切换相同表单中两个下拉菜单之一的外观.我相信这意味着我想使用MatSlide切换发出的MatSlideToggleChange类.遗憾的是,该文档未提供如何将MatSlideToggleChange类与MatSlide一起使用的示例.

有没有人以这种方式使用MatSlide?

material-design angular-material angular

7
推荐指数
2
解决办法
9045
查看次数