小编CCu*_*tis的帖子

什么是默认的ggplot2绘图边距?

我无法在任何地方找到相关信息.我知道如何设置它们但想要知道默认值(顶部,右侧,底部和左侧),因此在为绘图设置边距时,它不是一个猜谜游戏.

r ggplot2

19
推荐指数
1
解决办法
4479
查看次数

Problems Using grid.edit() in Rscript

I'm having problems using grid.edit() from an Rscript. I'm using grid.edit() to increase the thickness of hollow points in the legend and chart. I took this from this post (Change thickness of a marker in ggplot2). Just looks way better IMO. I know that from source files and Rscripts you can get ggplot objects to plot using print(p), but I need to use grid.edit() so I'm not sure how to fix this. Working example below.

My …

r ggplot2 r-grid

3
推荐指数
1
解决办法
980
查看次数

图像 r 中的反向轴

有谁知道在函数中反转轴的好方法可以说 y 轴,而不影响绘图image

假设我想制作以下情节

image(1:10,1:10,matrix(1:100,10,10)).

这工作正常,但如果我想显示从10:1. image不让你做image(10:1,1:10,matrix(1:100,10,10))。我必须创建自己的轴并将它们添加到绘图中还是有更简单的方法?

axis r image

2
推荐指数
1
解决办法
2152
查看次数

R不再接受GMT + n/GMT-n格式的时区

?timezones 状态 "Most platforms support time zones of the form GMT+n and GMT-n, which assume at a fixed offset from UTC (hence no DST)."

我今年早些时候使用旧代码tz="GMT-8".只有对我的计算机的更改已经更新到R版本"R version 3.2.2 (2015-08-14)"并通过向我的Rprofile添加一行代码从旧用户帐户迁移我的库"C:\Program Files\R\R-3.2.2\library\base\R".只是要详细的代码了.libPaths(c("C:/Users/XXXX XXXX/Documents/R/win-library/3.2",.Library.site)).为什么我的系统突然不接受这种tz格式?我可以更改哪些系统设置来解决此问题?

下面的工作示例.

tdat<-c("11/19/2014 12:45", "11/19/2014 13:00", "11/19/2014 13:15", 
"11/19/2014 13:30", "11/19/2014 13:45", "11/19/2014 14:00", "11/19/2014 14:15", 
"11/19/2014 14:30", "11/19/2014 14:45", "11/19/2014 15:00")

as.POSIXct(strptime(tdat,"%m/%d/%Y %H:%M",tz="GMT-8"))

Warning messages:
1: In strptime(tdat, "%m/%d/%Y %H:%M", tz = "GMT-8") :
  unknown timezone 'GMT-8'
2: In as.POSIXct.POSIXlt(strptime(tdat, "%m/%d/%Y %H:%M", …
Run Code Online (Sandbox Code Playgroud)

timezone r timezone-offset

2
推荐指数
1
解决办法
1705
查看次数

滚动联接由data.table中的第二个变量分组

您好,我想使用该data.table软件包在R中执行滚动联接。在“日期”(Date)列上进行连接时有多个匹配项,因此我想在“字段”(Field)列上使用byin中的参数data.table来防止来自不同字段的数据连接在一起。

示例数据

d1<-structure(list(Field = c("6", "W62", "6", "6", "12S", "19-1", 
"6", "6", "12S", "7", "6", "12S", "W62", "6", "12S", "W62", "12S", 
"6", "6", "7", "12S", "12S", "W62", "7", "12S", "6", "12S", "7", 
"12S", "7", "6", "7", "12S", "7", "6", "6", "6", "6", "12S", 
"7", "7", "6", "6", "12S", "7", "12S", "12S", "12S", "19-1", 
"6"), Date = structure(c(16994, 17240, 17240, 17401, 17048, 17417, 
17387, 17394, 17382, 17414, 17029, 17403, 17045, 17359, 17179, 
17281, 17152, 16972, …
Run Code Online (Sandbox Code Playgroud)

join r data.table

1
推荐指数
1
解决办法
904
查看次数

ggplot2通过常规的“顶部”,“底部”,“左侧”,“右侧”,“中心”指定geom_text位置

我正在ggplot中制作一些图形,并且在不指定x和y位置的情况下无法弄清楚如何在图形文本中进行绘制。

比方说,我在做这样的曲线图。

sp <- ggplot(mpg, aes(hwy, cty, label = "sometext"))+
    geom_point()
Run Code Online (Sandbox Code Playgroud)

我想在每个图形中添加以相同方式打印的标签。调用以下命令仅在提供给的每个x,y值处打印文本aes

sp + geom_text()
Run Code Online (Sandbox Code Playgroud)

我可以操纵提供的xy数据geom_text()以确保文本在图形之间保持相同的相对位置,但是有没有一种简单的方法可以通过默认位置(例如“顶部”,“底部”等)来调用位置?即sp + geom_text(position="top")

r ggplot2 geom-text

1
推荐指数
5
解决办法
7062
查看次数

标签 统计

r ×6

ggplot2 ×3

axis ×1

data.table ×1

geom-text ×1

image ×1

join ×1

r-grid ×1

timezone ×1

timezone-offset ×1