数据:
type size amount
T 50% 48.4
F 50% 48.1
P 50% 46.8
T 100% 25.9
F 100% 26.0
P 100% 24.9
T 150% 21.1
F 150% 21.4
P 150% 20.1
T 200% 20.8
F 200% 21.5
P 200% 16.5
Run Code Online (Sandbox Code Playgroud)
我需要使用ggplot(x轴 - >"type",y轴 - >"amount",group by"size")绘制上述数据的条形图.当我使用下面的代码时,我没有按照数据中显示的顺序获得变量"type"和"size".请看图.我已经使用了以下代码.
ggplot(temp, aes(type, amount , fill=type, group=type, shape=type, facets=size)) +
geom_bar(width=0.5, position = position_dodge(width=0.6)) +
facet_grid(.~size) +
theme_bw() +
scale_fill_manual(values = c("darkblue","steelblue1","steelblue4"),
labels = c("T", "F", "P"))
Run Code Online (Sandbox Code Playgroud)
.
为了解决订单问题,我使用了以下的变量"type"的因子方法.请看图.
temp$new = factor(temp$type, levels=c("T","F","P"), labels=c("T","F","P"))
Run Code Online (Sandbox Code Playgroud)

但是,现在我不知道如何修改变量"size"的顺序.它应该是50%,100%.150%和200%.
正如您在下面的数据中所看到的,某些刻面变量"items"缺少x轴变量"type"的某些级别.例如,"items = 32"没有"type = A".
我想摆脱沿着x轴对应于不存在的"类型" 的空白空间(例如,对于32个项目,类型A).
一些数据("临时"):
type items value
A 16 6.3
B 16 8.3
C 16 7.9
B 32 7.7
C 32 8.3
C 64 7.9
Run Code Online (Sandbox Code Playgroud)
绘图代码:
library(ggplot2)
ggplot(temp, aes(x = type, y = value, fill = type)) +
geom_bar(stat = "identity") +
facet_grid( . ~ items)
Run Code Online (Sandbox Code Playgroud)
=======================
编辑:
根据Joran的解决方案,设置scales = "free_x"正在做我想要的.但是,在项目编号32和64下,条的宽度变得非常大.请帮助我为所有条形制作宽度.
ggplot(temp, aes(x = type, y = value, fill = type)) +
geom_bar(stat = "identity") +
facet_grid( . ~ items, scales = …Run Code Online (Sandbox Code Playgroud) 有人可以指导我使用 Linux 上的命令或方法来测量线程或进程所经历的迁移次数吗?谢谢你。
我一直在WEB上搜索删除下面ggplot条形图的图例中的横杆.但是,没有成功.你能帮我解决这个问题.请参阅下面的数据"temp"和我正在使用的代码.你能告诉我如何在酒吧使用模式吗?谢谢.
temp:
type var value
A k1 20
A l1 30
B k1 10
B l1 15
ggplot(temp,aes(type, value)) + geom_bar(stat="identity", aes(group=var, fill=type, facets=var),colour="blue1", position="identity") + facet_grid(.~var) + theme_bw()
Run Code Online (Sandbox Code Playgroud)

有人可以指导我测量LINUX上TLB未命中的命令吗?TLB未命中时可以考虑小页面错误吗?
可能有人帮我加 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
Run Code Online (Sandbox Code Playgroud)
码:
qplot(type, value, geom="bar", fill=c(""),data=temp, group=name,
facets= …Run Code Online (Sandbox Code Playgroud) 我scale_x_discrete()用来定制x轴的刻度和标签.
但是,如图所示,线条切割了右侧y轴,这对我来说不太好看.你能帮我解决这个问题.数据(temp)也显示如下.
> a = ggplot(data = temp, aes(b, c, group=a,shape=a,colour=a), ordered=TRUE) + geom_line() + geom_point()
> a
> b = a + scale_x_discrete(breaks = c("2","4","8","16","32","64","128"), labels=c("2","4","8","16","32","64","128"))
> temp
a b c
1 One 2 5.1
2 One 4 6.6
3 One 8 7.7
4 One 16 8.4
5 One 32 16.1
6 One 64 38.0
7 One 128 49.2
8 Two 2 5.9
9 Two 4 7.7
10 Two 8 9.2
11 Two 16 10.3
12 Two …Run Code Online (Sandbox Code Playgroud) 是否有任何工具或应用程序将openmp转换为pthreads程序?请告诉我.
我有以下时间序列数据.它有60个数据点如下所示.请参阅下面这个数据的简单图表.我用R来绘制这个.我认为如果我在图中的点上绘制移动平均曲线,那么我们可以更好地理解数据中的模式.我不知道如何在R中做到这一点.有人可以帮助我做到这一点.此外,我不确定这是否是识别模式的好方法.如果有更好的方法,也请建议我.谢谢.
x <- c(18,21,18,14,8,14,10,14,14,12,12,14,10,10,12,6,10,8,
14,10,10,6,6,4,6,2,8,6,2,6,4,4,2,8,6,6,8,12,8,8,6,6,2,2,4,
4,4,8,14,8,6,6,2,6,6,4,4,8,6,6)
Run Code Online (Sandbox Code Playgroud)