- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
首先,为 ggplot
指定分类变量顺序的方法是在 data.frame
中对其级别重新排序。其次,要在任何绘图上突出显示一个区域,我们可以使用 geom_rect
。这里需要注意的是,不要将数据传递给geom_rect
,否则不会让我们设置alpha
,这样网格线就不会可见的。现在有2种情况:
geom_rect
(或传递给顶层 ggplot()
),则顺序与 data.frame
,但正如我提到的,矩形不会是透明的
如果我们只将数据传递给 geom_point
层,ggplot 会按字母顺序重新排列离散变量
如何同时拥有这两个条件,即具有预定义的顺序并在所需位置具有透明矩形?
奖励问题:如何在离散变量处创建一个矩形,其边缘位于网格线之间,即按
0.5
调整? vjust
和 hjust
不是这里使用的参数(警告告诉我们)。以及如何使矩形填充整个垂直空间(为此我们需要将 ymax
定义为第 n+1
因子级别,这不存在)。
require(ggplot2)
ex <- data.frame(a = factor(letters[1:10]),
b = factor(rep(c('b', 'a'), 5)),
c = rep(letters[1:5], 2))
ex$a <- factor(ex$a, levels = ex$a[order(ex$b)])
ggplot(
# uncomment this to see the other failure:
# ex, aes(y = a, x = c)
) +
geom_rect(
aes(
xmin = 'b',
xmax = 'd',
ymin = 'd',
ymax = 'j'
),
alpha = 0.2
) +
geom_point(
data = ex,
aes(
y = a,
x = c
)
)
最佳答案
我能做的最好的事情就是通过使用 annotate
(一个数据自由层)来避免 data
问题。你不知何故需要把 geom_point
放在第一位,但我不确定为什么。比例似乎是由第一层决定的,即使我已经在 ggplot
中提供了数据和映射。
ggplot(data = ex, aes(y = a, x = c)) +
geom_point() +
annotate(xmin = 'b', xmax = 'd', ymin = -Inf, ymax = Inf, geom = 'rect', alpha = 0.2)
关于r - ggplot : rearrange factor order and highlight area by `geom_rect` at the same time,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42932758/
我有一个 NSButton带有图像(没有文本),在蓝色背景上。 样式为“Square”,类型为“Momentary Push In”,无边框等。 当我单击按钮时,它周围有一个光矩形,它会突出显示一秒钟
有没有办法用 highlight.js 强调线条? 例如,通过对它们进行不同的着色、更改背景颜色或其他方式。 最佳答案 您可以使用 HTML5 的 mark标签。 让我们以这段 Java 代码为例:
我试图用 highlight.js 做一个简单的例子,但我无法让它工作。我不熟悉highlight.js。这是我的代码,我不知道它有什么问题。任何的想法!提前致谢。 hljs.initHi
原标题是“特定于语言的配色方案防止较简单的配色方案为某些特定于语言的标签着色” 我正在使用 gVim 7.3(在 Ubuntu 12.04 Arch x86/64 上,这很重要)。 更新(2013-0
我将我认为有用的代码示例作为文本文件保存在我的计算机上。我将它们存储为 txt 文件而不是编写它们的语言,以便它们将在 Notepad++ 中打开而不是在编辑器中打开(即我不希望我的 c++ 示例在
所以我在网上搜索了这个问题的解决方案,但到目前为止还没有成功。我正在尝试根据 ASP.NET 中 GridView 中的“突出显示”行更新 SQL 数据库。这是我目前用于突出显示的代码。 //ASP.
如何配置 GitHub 的 Atom 以使其根据名称和/或扩展名自动为文件名设置特定的语法突出显示? 具体来说,我希望它自动将 Ruby 语法高亮设置为 Cocoapods 的 Podfile s。
真的需要一些建议。我正在尝试做几件事。1) 将表格 View 的第一个单元格设置为在第一次加载表格时突出显示。然后用户可以继续选择/突出显示表格中的其他单元格。如何第一次突出显示单元格? 2) 对一行
是否有一些现成的功能/宏可以帮助在不同颜色的源洞察中突出显示不同的单词(原始安装允许突出显示不同的单词,但都以相同的颜色)。 最佳答案 我正在寻找同样的东西。但是从sourceinsight官方引用来
在科莫多中,您的代码块用垂直虚线突出显示,如下图所示 . geany有类似的东西吗? 最佳答案 由于这里没有人回答我,我写信给 geany 邮件列表,他们也向我展示了如何在 geany 中获取它:它被
我正在寻找一个用 JavaScript 编写的全面的语法高亮器,它会自动检测所使用的语言并应用正确的语法高亮。 我从一个简单的谷歌搜索中找到了无数,但它们都必须在 上有某种格式化的类。元素如 .
我正在使用 Lucene 的 Highlighter 类来突出显示匹配搜索结果的片段,并且效果很好。我想从使用 StandardAnalyzer 搜索切换到 EnglishAnalyzer,它将执行词
无论文件类型如何,我都想突出显示某个单词。在我的 .vimrc 中,我添加了: highlight link notes todo syntax match notes contained "TODO
我将 jupyter notebook 与 python 一起使用 db.py 库进行数据库查询。 例如,它可能看起来像(在我的代码单元中): df = db.query(""" SELECT a,b
Closed. This question is off-topic。它当前不接受答案。 想要改善这个问题吗? Update the question,所以它是用于堆栈溢出的on-topic。 已关闭
我如何让它工作,我确实在 nano.rc 和 .nanorc 中添加了颜色语法突出显示配置,但没有任何 react 。 最佳答案 将名为 HOME 的环境变量设置到您的用户目录(cd ~ 将您置于例如
是否可以在 pre 标签中添加一个类来禁用代码高亮?我尝试添加类 prettyprint-false 和 no-prettyprint。 https://code.google.com/p/googl
我在 TextMate2 中工作,但这个问题也可能适用于其他文本编辑器。 我的脚本在 R 中。我打算在脚本上使用 rmarkdown::render() 来创建一个 "report" . 这些报告的聪
我需要在我的网站上发布SAS代码。但是,如果我确实编写HTML来突出显示SAS cod,那将花费我很长时间。 如何将SAS代码转换为外观漂亮的HTML副本? 最佳答案 我只是将您的编辑器中的内容复制/
我想在另一个扩展名上强制突出显示HTML语法(我的一位同事已决定为其模板文件使用其他文件命名方案)。 在其他编辑器中,可以手动选择,但Textmate似乎不适合我。如何使这些.randomtexten
我是一名优秀的程序员,十分优秀!