我绘制了这样的热图:
ggplot(test, aes(start1, start2)) +
geom_tile(aes(fill = logFC), colour = "gray", size=0.05) +
scale_fill_gradientn(colours=c("#0000FF","white","#FF0000"), na.value="#DAD7D3")
Run Code Online (Sandbox Code Playgroud)
这将绘制热图的上三角形。我想绘制的是完全相同的三角形,但斜边为x-axis
。
我该怎么做呢?
编辑:添加了可重现的示例
library(ggplot2)
# dummy data
df1 <- mtcars[, c("gear","carb", "mpg")]
# normal tile plot
gg1 <- ggplot(df1, aes(gear, carb, fill = mpg)) +
geom_tile() +
xlim(c(1, 10)) +
ylim(c(1, 10)) +
theme_void() +
theme(legend.position = "none")
Run Code Online (Sandbox Code Playgroud)
预期输出(手动旋转):
使用基本图的相关文章image()
:
可视化和旋转矩阵
可能的解决方案示例代码位于LDheatmap 包中,使用grid
.
我有这个代码
ggplot()
+ geom_histogram(aes(x=V1, y=(..count..)/sum(..count..)), fill="red", alpha=.4, colour="red", data=coding, stat = "bin", binwidth = 30)
+ geom_histogram(aes(x=V1,y=(..count..)/sum(..count..)), fill="blue", alpha=.4, colour="blue", data=lncrna, stat = "bin", binwidth = 30)
+ coord_cartesian(xlim = c(0, 2000))
+ xlab("Size (nt)")
+ ylab("Percentage (%)")
+ geom_vline(data=cdf, aes(xintercept=rating.mean, colour=Labels), linetype="dashed", size=1)
Run Code Online (Sandbox Code Playgroud)
产生没有图例的漂亮直方图:
在我访问的每个帖子中都遇到同样的问题,他们说放在color
里面aes
.尽管如此,这并没有给出任何传说.
我试过了:
ggplot() + geom_histogram(aes(x=V1, y=(..count..)/sum(..count..),color="red", fill="red"), fill="red", alpha=.4, colour="red", data=coding, stat = "bin", binwidth = 30)
+ geom_histogram(aes(x=V1,y=(..count..)/sum(..count..), color="blue", fill="blue"), fill="blue", alpha=.4, colour="blue", data=lncrna, stat = "bin", binwidth = 30) …
Run Code Online (Sandbox Code Playgroud) 我有一个安装了Semantic MediaWiki扩展的MediaWiki站点.我想测试字符串是否为空.为此,我做:
{{#if: {{{transcript.lncrna}}} | Yes | No}}
Run Code Online (Sandbox Code Playgroud)
显然,{{{transcript.lncrna}}}是空的,它什么都没有.但是,解析器函数#if
告诉我是答案.
怎么了?
我有以下查询:
SELECT mutations.id, genes.loc FROM mutations, genes where mutations.id=genes.id;
Run Code Online (Sandbox Code Playgroud)
并输出:
| SL2.50ch02_51014904 | intergenic |
| SL2.50ch02_51014907 | upstream |
| SL2.50ch02_51014907 | downstream |
| SL2.50ch02_51014907 | intergenic |
| SL2.50ch02_51014911 | upstream |
| SL2.50ch02_51014911 | downstream |
Run Code Online (Sandbox Code Playgroud)
我想要的输出是这样的:
| SL2.50ch02_51014904 | intergenic |
| SL2.50ch02_51014907 | upstream,downstream,intergenic |
| SL2.50ch02_51014911 | upstream,downstream |
Run Code Online (Sandbox Code Playgroud)
我认为GROUP_CONCAT
对此很有用.但是,这样做:
SELECT mutations.id, GROUP_CONCAT(distinct(genes.loc)) FROM mutations, genes WHERE mutations.id=genes.id;
Run Code Online (Sandbox Code Playgroud)
我有一个像这样的独特行:
SL2.50ch02_51014904 | downstream,intergenic,upstream
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
我有一个网页,旨在使用800px宽度的最小分辨率进行查看.我想向浏览分辨率<800px的用户添加警告
该网页旨在使用....的分辨率进行查看
我怎样才能做到这一点?这与CSS Media-Queries不可能有关吗?
我有一个像这样的JSON文件(它是整个JSON文件的一部分):
{
id => "mgp1310",
samples => [
{
envPackage => {
data => {
diss_carb_dioxide => {
aliases => ["sediment_diss_carb_dioxide"],
definition => "concentration of dissolved carbon dioxide",
mixs => 1,
required => 0,
type => "text",
unit => "",
value => "17 mM",
},
},
id => "mge64559",
},
},
],
}
Run Code Online (Sandbox Code Playgroud)
这已由模块JSON解码,使用:
use Data::Dumper;
use JSON;
open($fh, '<', 'hola.txt' );
$json_text = <$fh>;
$perl = decode_json($json_text);
print Dumper($perl);
Run Code Online (Sandbox Code Playgroud)
现在我知道$perl
有一个哈希.所以我想使用打印id
JSON文件print $perl{"id"};
.然而,它打印什么我不知道为什么.