我有一个很难搞清楚如何旋转strip.text
的属性theme
从ggplot2
。我使用的是 R 版本 3.4.2 和 ggplot2 版本 2.2.1。
以下是 MWE 的数据。
> dput(dd)
structure(list(type = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 3L,
4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L), .Label = c("blossum",
"happy", "rugged", "theatre"), class = "factor"), min = c(3,
2, 4, 6, 3, 2, 4, 6, 3, 2, 4, 6, 3, 2, 4, 6, 3, 2, 4, 6), max = c(8,
3, 7, 9, 8, 3, …
Run Code Online (Sandbox Code Playgroud) 我一直无法让 Python selenium 连接到selenium/standalone-chrome
,并且正在寻找有关如何解决我的问题的见解。我想避免使用selenium/hub
,但包含它似乎并不能解决我的问题。
这是我的 docker-compose.yml
version: '3.1'
networks:
web:
external: true
services:
chrome:
image: selenium/standalone-chrome:latest
hostname: chrome
networks:
- web
ports:
- "5900:5900"
- "4444:4444"
privileged: true
shm_size: 2g
tests:
build: ./tests
networks:
- web
Run Code Online (Sandbox Code Playgroud)
我在测试容器内运行的测试。在运行脚本之前,入口点会检查以确保 chrome 已启动并正在运行。
#!/usr/bin/env python3
"""Tests that the remote webdriver works."""
import unittest
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class LocalGoogleTestCase(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Chrome()
self.addCleanup(self.browser.quit)
def testPageTitle(self):
self.browser.get('http://www.google.com')
self.assertIn('Google', self.browser.title)
class RemoteGoogleTestCase(unittest.TestCase):
def setUp(self):
self.browser = …
Run Code Online (Sandbox Code Playgroud) 我希望能够调整加载标签的位置,以便它们不会落在箭头上方。但不知道哪里需要调整。可以geom_text
用来调整站点位置的位置,但我找不到向量存储在的位置str(g)
。
library(ggplot2)
library(ggfortify)
df <- data.frame(replicate(10,sample(-10:10,10,rep=TRUE)))
names(df) <- c('up','down','left','right','circle','square','triangle','x','r1','l1')
rownames(df) <- paste('Dummy Site', seq(0,9,1))
g <- autoplot(prcomp(df[,-11], scale=TRUE), data=df,
loadings.label=TRUE, loadings=TRUE,
loadings.label.size=8, loadings.colour='blue',
label.size=5) +
geom_text(vjust=-1, label=rownames(df)) +
theme(plot.background=element_blank(),
panel.background=element_rect(fill='transparent',color='black',size=1),
legend.text=element_text(hjust=1),
legend.key=element_blank())
g
Run Code Online (Sandbox Code Playgroud)
我已经查看ggplot2::theme
并检查了 的帮助文档autoplot
,但找不到任何关于调整标签位置的提及。如果它可以根据箭头的矢量进行调整,则会加分,但静态调整也是可以接受的。
从Notepad和Notepad ++切换后我是vim的新手,但过去四个月我一直在使用它.在我的.vimrc中,我有一个命令可以根据文件扩展名自动更改命令调用.例如,如果我正在编辑R文件,我可以按下<F5>
并执行vim !Rscript %:p<cr>
,但是如果我切换到python文件并按下<F5>
,则vim执行!python %:p<cr>
.我通过在我的.vimrc中添加以下内容来实现此目的:
autocmd BufRead *.R noremap <F5> :!Rscript %:p<cr>
autocmd BufRead *.pl noremap <F5> :!perl %:p<cr>
autocmd BufRead *.py noremap <F5> :!python %:p<cr>
Run Code Online (Sandbox Code Playgroud)
我想知道这是否是基于命令调用执行它的"正确的"vim方式.我知道我使用的一些python文件没有*.py扩展名,所以在这种情况下设置是无用的.
我在目录中有几个数据文件(所有tsvs).一个数据文件如下所示:
Killed Rick Darryl Herschel Tyrese Shane
Zombies 200 300 20 4 100
People 10 2 0 0 0
Dogs 0 0 0 0 0
Run Code Online (Sandbox Code Playgroud)
下一个数据文件是这样的:
Killed Jon Rob Varys Ned Joeffry Mormont
Whites 1 0 0 0 0 0
People 0 10 1 30 0 100
Run Code Online (Sandbox Code Playgroud)
我想合并它,以便数据文件读取如下:
Killed Variable Value
Zombies Rick 200
Zombies Darryl 300
Zombies Herschel 20
Zombies Tyrese 4
Zombies Shane 100
People Rick 10
People Darryl 2
People Herschel 0
People Tyrese 0
People Shane …
Run Code Online (Sandbox Code Playgroud)