Hello all,
Yesterday I wrote Michael Weylandt to ask for some help in understanding
a line of code he used responding to SarahH's query about controlling
colours in scatter plots. He wrote an excellent explanation that
deserves to be shared here. Below I include the code I wrote while
experim
Success with the lines command and col argument! I have some nice point and
line plots.
Thanks so much for you help. Ongoing project - I will probably be back!
Sarah
--
View this message in context:
http://r.789695.n4.nabble.com/Scatter-plot-using-colour-to-group-points-tp4092794p4097625.html
S
There's also the lines() command which takes a col argument if you want to do
multiple lines (I usually wind up wrapping it in a for loop though there might
be something smarter)
ggplot2 is great, though the learning curve is a little rough: you can get good
help here but if you go down that pa
Thanks all for suggestions.
I now have a nice plot showing the temperature of 6 different sites, each
site distinguished by different coloured points, using nested ifelse. My
apologies I thought I could change the type to "l" and the same arguments
would be applied to line graph, with 6 different
On 11/22/2011 05:00 PM, David Winsemius wrote:
On Nov 21, 2011, at 10:18 PM, R. Michael Weylandt wrote:
I don't think you can do different colors for a single line (not an
ifelse thing, just a what would that mean sort of thing), but a plot
type like "b" "o" or "h" will work the same way.
I
On Nov 21, 2011, at 10:18 PM, R. Michael Weylandt wrote:
I don't think you can do different colors for a single line (not an
ifelse thing, just a what would that mean sort of thing), but a plot
type like "b" "o" or "h" will work the same way.
I think Jim Lemon has a multicolored line function
I don't think you can do different colors for a single line (not an
ifelse thing, just a what would that mean sort of thing), but a plot
type like "b" "o" or "h" will work the same way.
Michael
On Mon, Nov 21, 2011 at 4:23 PM, SarahH wrote:
> I got the colour vector with ifelse to work, great! T
Another approach would be to use ggplot2.
Code can look a bit daunting to begin with but ggplot2 is a
very versitile graphing package and well worth learning.
Simple example
=
library(ggplot2)
mydata <- data.frame(site=c("A","A","A", "
I got the colour vector with ifelse to work, great! Thank you.
Is it possible to use the ifelse colour vector with other plot types? For
example with type=l ? I tried but the graphic came back with blue lines for
both sites and also a straight line connecting the start and end point of
the data?
I think the easiest way to do this is to set up a color vector with
ifelse and hand that off to the plot command: something like
col = ifelse(TEMP3[,"SITE"] == "BG1", "blue", "green") # Syntax is
ifelse(TEST, OUT_IF_TRUE, OUT_IF_FALSE)
For more complicated schemes, a set of nested ifelse()'s can
On Nov 21, 2011, at 2:17 PM, SarahH wrote:
Dear All,
I am very new to R - trying to teach myself it for some MSc
coursework.
I am plotting temperature data for two different sites over the same
time
period which I have downloaded from a university weather station data
archive.
I am usi
11 matches
Mail list logo