Hey, I'm doing my thesis and I need to produce a lot of plots. With 2 I have a problem that I can't get past: http://r.789695.n4.nabble.com/file/n4630611/question.png The left one has lines instead of dots. All I want is a basic line (it's a time series). So I used the type="l" command, but that doesn't work, and so do other commands I tried. I only get a line when I use a time series, but than my graphs don't look similar, as it gives numbers for dots,... This is the basis of what I used: plot(ID, settlepw$T.local, type="l",ylab="Temperature(?C)", xlab="") plot(day, hatch$T.local, type="l", ylab="", ylim=c(15,25), xlab=" ") For the second plot, I wanted no dots but a line (idem as previous), but that doesn't work either. Can someone please help? I assume it is probably not so difficult, but I couldn't find the answer at all. Thanks a lot in advance! -- View this message in context: http://r.789695.n4.nabble.com/default-plot-but-stripes-appear-and-other-plot-problems-tp4630611.html Sent from the R help mailing list archive at Nabble.com.
Uwe Ligges
2012-May-19 15:57 UTC
[R] default plot, but stripes appear (and other plot problems)
On 19.05.2012 17:40, bets wrote:> Hey, > > I'm doing my thesis and I need to produce a lot of plots. With 2 I have a > problem that I can't get past: > > http://r.789695.n4.nabble.com/file/n4630611/question.png > > The left one has lines instead of dots. All I want is a basic line (it's a > time series). So I used the type="l" command, but that doesn't work, and so > do other commands I tried. I only get a line when I use a time series, but > than my graphs don't look similar, as it gives numbers for dots,... > > This is the basis of what I used: > > plot(ID, settlepw$T.local, type="l",ylab="Temperature(?C)", xlab="") > plot(day, hatch$T.local, type="l", ylab="", ylim=c(15,25), xlab=" ")We need a reproducible example to understand what is going on. Here,m we do not evenm know what kind of data you are using. See the posting guide for how to ask better. Best, Uwe Ligges> For the second plot, I wanted no dots but a line (idem as previous), but > that doesn't work either. > Can someone please help? I assume it is probably not so difficult, but I > couldn't find the answer at all. > Thanks a lot in advance! > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/default-plot-but-stripes-appear-and-other-plot-problems-tp4630611.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Sorry, I hoped this was already clear enough. Ok?, here are the first rows of the relevant part of the data: Datum week T.local 29/06/11 1 19.272420 5/07/11 2 19.305034 13/07/11 3 17.766046 20/07/11 4 17.394985 27/07/11 5 19.520233 3/08/11 6 18.528367 And this is for the second graph: day datum T.regional 1 23-mrt-11 15.59 2 24-mrt-11 15.52 3 25-mrt-11 15.51 4 26-mrt-11 15.54 5 27-mrt-11 15.60 6 28-mrt-11 15.23 7 29-mrt-11 15.23 8 30-mrt-11 15.22 9 31-mrt-11 15.77 10 01-apr-11 16.23 -- View this message in context: http://r.789695.n4.nabble.com/default-plot-but-stripes-appear-and-other-plot-problems-tp4630611p4630619.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2012-May-19 19:20 UTC
[R] default plot, but stripes appear (and other plot problems)
On May 19, 2012, at 12:36 PM, bets wrote:> Sorry, I hoped this was already clear enough.Below you offer two examples of console output without naming the objects from which they came or the code you are attempting to us. (Also in the all-to-typical manner of those posting through Nabble youexpect us to refer to early postings rather than including context. Presumably you are making implicit reference to an effort to using this code: plot(ID, settlepw$T.local, type="l",ylab="Temperature(?C)", xlab="")> > Ok?, here are the first rows of the relevant part of the data: > > Datum week T.local > 29/06/11 1 19.272420 > 5/07/11 2 19.305034 > 13/07/11 3 17.766046 > 20/07/11 4 17.394985 > 27/07/11 5 19.520233 > 3/08/11 6 18.528367There is no "ID" variable, so that coe should fail. If the goal were to use that first columns as a Date field then you would need to convert it to a date class. settlepw$ID <- as.Date(settlepw$Datum, "%y/%m/%d")> > And this is for the second graph: > > day datum T.regional > 1 23-mrt-11 15.59 > 2 24-mrt-11 15.52 > 3 25-mrt-11 15.51 > 4 26-mrt-11 15.54 > 5 27-mrt-11 15.60 > 6 28-mrt-11 15.23 > 7 29-mrt-11 15.23 > 8 30-mrt-11 15.22 > 9 31-mrt-11 15.77 > 10 01-apr-11 16.23 >plot(day, hatch$T.local, type="l", ylab="", ylim=c(15,25), xlab=" ") That one may require that you present an appropriate vector of month abbreviations for you language. I am a langauge weenie and only have English and a bit of German in my repetoire. My installation of R only has the built-in variable: month.abb [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec" Maybe there is a format that will do what you need. See: ?strptime Reading that help page suggests there may be support for locale- specific abbreviations, so you could try: hatch$day2 <- as.Date(hatch$datum, "%d-%b-%y")>-- David Winsemius, MD West Hartford, CT
Hey, Thanks for the reply. I tried tod do change this in two ways: -with the formula, as you recommended (and after reading ?strptime some similar formulas as well), but this did not help. -by replacing the date to the form dd/mm/yy. But this didn't change anything to the plot layout as well. The same is valid for my second plot problem. If there are still suggestions, please tell me :). -- View this message in context: http://r.789695.n4.nabble.com/default-plot-but-stripes-appear-and-other-plot-problems-tp4630611p4630631.html Sent from the R help mailing list archive at Nabble.com.
Rui Barradas
2012-May-19 21:53 UTC
[R] default plot, but stripes appear (and other plot problems)
Hello, Could you post the output of dput(head(settlepw, 10)) dput(head(hatch, 10)) Just copy the output and paste it in a post. These functions give the first 10 lines (head) and the structure of your datasets. I'm asking this because with the two example datasets you gave in an earlier post, plot works, at least with me. Like this we can see exactly what your data looks like, how it is represented. Rui Barradas bets wrote> > Hey, > > Thanks for the reply. I tried tod do change this in two ways: > -with the formula, as you recommended (and after reading ?strptime some > similar formulas as well), but this did not help. > -by replacing the date to the form dd/mm/yy. But this didn't change > anything to the plot layout as well. > The same is valid for my second plot problem. > > If there are still suggestions, please tell me :). >-- View this message in context: http://r.789695.n4.nabble.com/default-plot-but-stripes-appear-and-other-plot-problems-tp4630611p4630632.html Sent from the R help mailing list archive at Nabble.com.