[R] Y-axis label not plotting

Jim Lemon jim at bitwrit.com.au
Wed Nov 27 23:33:19 CET 2013


On 11/28/2013 02:10 AM, Luke M wrote:
> Thanks for the follow-up. Per your suggestion, I was able to plot the
> data for the last 30 days with no problem.
>
> However... I am still confused about the y-axis labels (values, title,
> etc) not plotting. If the scripting works as it should, what could cause
> the labels not to show up? A while ago I think that I accidentally
> changed something (not sure what) on the default settings (I was trying
> to learn how to make plots), and I wonder if this could cause the
> problem I am having...
>
>
>
Hi Luke,
As I wrote, when I ran your code (albeit directly reading in the two 
variables and dropping your timezone in "dates1") I got the axis label 
and tick labels. If it was some default setting, you shouldn't get them 
on _any_ plot. The following gives me a plot that looks okay.

temp1<-c(6.81,26.81,26.81,26.81,26.87,26.87,
26.87,26.87,27.06,27.06,27.06,27.06,
27.06,27.06,27.06,27.06,27.06,27.06,
27.06,27.06,27.06,27.06,27.06,27.06,
27.06,27.06,27.06,27.06,27.06,27.06,
27.06,27.06,27.06,27.06,27.06,27.06,
27.06,27.06,27.06,27.06,27.06,27.00,
27.00,27.06,27.06,27.06,27.00,27.00,
27.06,27.00,27.00,27.00,27.00,27.00,
27.00,27.00,27.00,26.94,26.94,26.94,
26.94,27.00,26.94,26.94,26.94,26.94,
26.94,26.94,26.94,26.94,26.94,27.00,
26.94,26.94,26.94,26.94,26.94,26.94,
26.94,26.94,26.94)

dates1<-c("2013-01-12 18:10:28","2013-10-24 18:10:43",
"2013-10-29 18:10:49","2013-11-14 18:10:52",
"2013-11-14 18:12:10","2013-11-14 18:12:12",
"2013-11-14 18:12:21","2013-11-14 18:12:22",
"2013-11-14 18:17:10","2013-11-14 18:17:11",
"2013-11-14 18:17:13","2013-11-14 18:17:14",
"2013-11-14 18:17:15","2013-11-14 18:17:17",
"2013-11-14 18:17:18","2013-11-14 18:17:20",
"2013-11-14 18:17:21","2013-11-14 18:17:22",
"2013-11-14 18:17:24","2013-11-14 18:17:25",
"2013-11-14 18:17:26","2013-11-14 18:17:28",
"2013-11-14 18:17:29","2013-11-14 18:17:30",
"2013-11-14 18:17:32","2013-11-14 18:17:33",
"2013-11-14 18:17:34","2013-11-14 18:17:36",
"2013-11-14 18:17:37","2013-11-14 18:17:38",
"2013-11-14 18:17:40","2013-11-14 18:17:41",
"2013-11-14 18:17:42","2013-11-14 18:17:44",
"2013-11-14 18:17:45","2013-11-14 18:17:46",
"2013-11-14 18:18:47","2013-11-14 18:18:48",
"2013-11-14 18:18:50","2013-11-14 18:18:51",
"2013-11-14 18:18:52","2013-11-14 18:18:54",
"2013-11-14 18:18:55","2013-11-14 18:18:56",
"2013-11-14 18:18:58","2013-11-14 18:18:59",
"2013-11-14 18:19:10","2013-11-14 18:19:11",
"2013-11-14 18:19:12","2013-11-14 18:19:14",
"2013-11-14 18:19:15","2013-11-14 18:19:16",
"2013-11-14 18:19:18","2013-11-14 18:19:19",
"2013-11-14 18:19:20","2013-11-14 18:19:22",
"2013-11-14 18:19:23","2013-11-14 18:20:24",
"2013-11-14 18:20:26","2013-11-14 18:20:27",
"2013-11-14 18:20:29","2013-11-14 18:20:30",
"2013-11-14 18:20:31","2013-11-14 18:20:33",
"2013-11-14 18:20:34","2013-11-14 18:20:35",
"2013-11-14 18:20:37","2013-11-14 18:20:38",
"2013-11-14 18:20:39","2013-11-14 18:20:41",
"2013-11-14 18:20:42","2013-11-14 18:20:43",
"2013-11-14 18:20:45","2013-11-14 18:20:46",
"2013-11-14 18:20:47","2013-11-14 18:20:49",
"2013-11-14 18:20:50","2013-11-14 18:20:51",
"2013-11-14 18:20:53","2013-11-14 18:20:54",
"2013-11-14 18:20:55")

dates1<-strptime(dates1,"%Y-%m-%d %H:%M:%S")

par(mar=c(5, 6, 4, 2))
plot(dates1, temp1,type="o",col="red",pch=20,xlab="x axis",
  main="my plot",ylab="y axis", ylim=c(0,40), yaxp = c(0,40,10))

Jim



More information about the R-help mailing list