获得R图类型"b".用文字代替点 [英] Getting R plot type "b" with text instead of points

查看:78
本文介绍了获得R图类型"b".用文字代替点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ggplot2中是否有一种方法可以获取图类型"b"?参见示例:

is there a way in ggplot2 to get the plot type "b"? See example:

x <- c(1:5)
y <- x 
plot(x,y,type="b")

理想情况下,我想用它们的值替换点,使其具有类似于此著名示例的内容:

Ideally, I want to replace the points by their values to have something similar to this famous example:

这里有一些示例数据(我想在绘图类型为"b"的构面中绘制每个猫"):

Here some sample data (I want to plot each "cat" in a facet with plot type "b"):

df <- data.frame(x=rep(1:5,9),y=c(0.02,0.04,0.07,0.09,0.11,0.13,0.16,0.18,0.2,0.22,0.24,0.27,0.29,0.31,0.33,0.36,0.38,0.4,0.42,0.44,0.47,0.49,0.51,0.53,0.56,0.58,0.6,0.62,0.64,0.67,0.69,0.71,0.73,0.76,0.78,0.8,0.82,0.84,0.87,0.89,0.91,0.93,0.96,0.98,1),cat=rep(paste("a",1:9,sep=""),each=5))

关于, 芭蕉叶

推荐答案

gridExtra中有一个实验性的功能,可以在Grid图形中实现,

There's an experimental grob in gridExtra to implement this in Grid graphics,

 library(gridExtra)
 grid.newpage() ; grid.barbed(pch=5)

这篇关于获得R图类型"b".用文字代替点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆