- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有人可以帮我添加 A-atype B-btype C-ctype
ONLY 作为下面 qplot 图的图例。我的图例应该在图表的顶部,也应该是水平的。另请参阅下面的数据和我用于生成图表的 qplot 代码。
数据:
type name value
A john 47.6
B john 55.6
C john 57.7
A amy 13.15
B amy 23.1
C amy 24.9
A lily 14.0
B lily 18.1
C lily 21.9
A sam 38.8
B sam 44.8
C sam 45.9
A frank 63.6
B frank 64.4
C frank 64.7
A xia 52.8
B xia 54.1
C xia 56.4
A yan 53.8
B yan 56.1
C yan 58.6
代码:
qplot(type, value, geom="bar", fill=c(""),data=temp, group=name,
facets= .~name,stat="identity")
+ theme_bw()
+ opts(axis.title.y=theme_text(size=16,angle=90),axis.title.x=theme_text(size=16,angle=0))
+ opts(axis.text.x=theme_text(size=10))
+ opts(axis.text.y=theme_text(size=14))
+ opts(strip.background = theme_rect(colour = 'steelblue', fill = 'white', size = 2))
+ opts(legend.title=theme_blank())
+ opts(legend.position="top")
最佳答案
您正在寻找这样的东西吗?首先绘制图例,然后去掉图例的彩色键。 fill = type
绘制图例。 scale_fill_manual
确保条形具有相同的颜色,并在图例中插入所需的标签。 guides
删除了彩色键,或者更确切地说,它将键着色为白色,只留下图例标签。可能,调用 guides
时的 fill = NA
也可以。编辑: ggplot2 版本 2 的更新代码
library(ggplot2)
temp = read.table(text = "
type name value
A john 47.6
B john 55.6
C john 57.7
A amy 13.15
B amy 23.1
C amy 24.9
A lily 14.0
B lily 18.1
C lily 21.9
A sam 38.8
B sam 44.8
C sam 45.9
A frank 63.6
B frank 64.4
C frank 64.7
A xia 52.8
B xia 54.1
C xia 56.4
A yan 53.8
B yan 56.1
C yan 58.6", header = TRUE, sep = "")
qplot(type, value, geom="col", fill=type, data=temp, group=name, facets= .~name) +
scale_fill_manual(values = rep("salmon",3), labels = c("A - atype", "B - btype", "C - ctype")) +
guides(fill = guide_legend(override.aes = list(fill = "white"))) +
theme_bw() +
theme(axis.title.y=element_text(size=16,angle=90),
axis.title.x=element_text(size=16,angle=0),
axis.text.x=element_text(size=10),
axis.text.y=element_text(size=14),
strip.background = element_rect(colour = 'steelblue', fill = 'white', size = 2),
legend.title=element_blank(),
legend.position="top",
legend.key = element_rect(colour = NA))
关于r - 我自己在qplot上的传奇,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11061725/
我正在使用 IAmStartedByMessages 开始 nsb 传奇。在处理这个特定消息时,我正在执行某种业务逻辑,如果某些情况失败,我不希望 Saga 被持久化。我怎样才能实现这个目标? 谢谢,
我需要为我的矢量图层创建符号。我的矢量图层有动态样式,我想在 Canvas 或 svg 中创建图例。有谁知道如何根据 ol.style 为我的图例渲染符号? 最佳答案 我们最近在 GeoExt 3 中
据我了解,这三个概念都与长时间运行的事务相关。 据我了解,流程管理器是一个有限状态机,它只是对事件使用react并发出命令。它不包含任何业务逻辑,它只是进行路由。它的目标是让您进入最终状态,您知道您的
我正在尝试复制以下图表 我遇到的问题是如何在每个堆叠的盒子的左侧和中间制作图例(每个盒子中的系列词)。我搜索了 amCharts 但没有运气。有没有办法做到这一点或如何覆盖或扩展 amCharts 以
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 3年前关闭。 Improve this qu
我想创建一个由消息“Event1”开始的传奇,但它会忽略收到具有相同应用 ID 的“重复”开始消息(这可能是由于两个或多个用户在短时间内点击了 UI 按钮) .文档似乎表明这种方法可行: 佐贺声明 I
我试图让图例为循环中绘制的每个项目添加一个条目。因此,“vgs”可能被绘制了 6 次,对于每一次我都想为名称“vgs”添加一个条目以及为“vgs”的特定实例绘制的颜色。我的代码目前似乎为最后一个实例创
我是 React Redux 新手。只是尝试 Redux Saga 并遇到一些我无法理解的错误消息。这是我的 rootSaga: import { takeEvery } from 'redux-sa
我有一个已经调用并且必须等待的 promise 。基本上: const foo = () => Promise.resolve('foo'); // The real promise takes ti
我有一个已经调用并且必须等待的 promise 。基本上: const foo = () => Promise.resolve('foo'); // The real promise takes ti
默认情况下,MATLAB 将图例条目的文本部分放在图中所用内容的样本之后。有什么办法可以扭转这种局面吗?例如,使用下面的代码,图例中的第一个条目是一个深蓝色矩形,后跟文本 I'm;我希望它是相反的(即
我是 python 和 matplotlib 的初学者。我想创建一个带有图例的水平条形图。我的代码: import matplotlib.pyplot as plt plt.rcdefaults()
Epic商城限时免费购买《雷曼:传奇》游戏 需要的上 《雷曼:传奇》是一款动作闯关冒险题材的游戏 截止21/6前 免费购买 活动地址:http://t.cn/Aigo55Nx
我正在尝试使用 redux-saga 编写一个 api。我有这样的 servicesSaga.js import { FETCH_USER } from '../actions/actionTypes
我在基于此 real-world example 的小型项目中使用 Redux/sagas 工作流,但这些逻辑并不那么复杂。我应该如何使用更全面的 API(即 Reddit 的 API)而不会使事情变
我有一个 controller saga,它曾经有一个步骤来启动一个进程,该进程在一个事务中包含 3 个 Action 。我现在正在将这个子流程重构为一个单独的传奇。这样做的结果是,原始 saga 将
我的应用程序有两个部分。它们每个都有自己的 saga 中间件,但两者都不会同时实例化。它总是一个或另一个。例如,一个 saga 处理登录,另一个处理主页。 我想知道在我的应用程序的两个部分之间导航时应
你好 Stack Overflow 社区! 我正在寻找一个好的实践和实现来等待组件中的分派(dispatch)操作。 我知道 React-Native 和 Redux-Saga 只是说:不要等待,让商
传奇新手,我在我的根传奇中使用它: function* rootSaga() { yield [ cycleRoot(), // fetches root cy
我正在使用 Redux Saga 模板,它使用包含 yield call() 实例的生成器函数。基本上看起来像这样: function *a(){ yield call(); } yield ta
我是一名优秀的程序员,十分优秀!