(Assuming you aren't going into ggplot2) You can have a look here, it might offer a nice solution:
http://rgm2.lab.nig.ac.jp/RGM2/R_man-2.9.0/library/shape/man/colorlegend.html Also, you can use ?cut to change your coloring to specific chunks (although having a full gradient is probably nicer) ----------------Contact Details:------------------------------------------------------- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Thu, Nov 18, 2010 at 5:18 PM, Alaios <ala...@yahoo.com> wrote: > Thanks a lot for your help > > I tried first this > test<-(myvalues)-mean(myvalues) > > so to put the values close to the 0...30 scale... > then I passed this as an argument > > plot(x,y,col=test) > > which plots the places where the robots are with a small color. I think > this is ok for now. What I want next is also to plot some color bar so the > reader can by inspecting first this color bar to say "Ah the read is for the > range of 5-10 watts" > > Also I tried legend... which creates small boxes below the dots which is Do > not what I want exactly. I would like below every plot to write some text > but not inside any box that will cover part of the image. > > Best Regards > Alex > > --- On *Thu, 11/18/10, Tal Galili <tal.gal...@gmail.com>* wrote: > > > From: Tal Galili <tal.gal...@gmail.com> > Subject: Re: [R] Help me with R plotting > To: "Alaios" <ala...@yahoo.com> > Cc: "Rhelp" <r-help@r-project.org> > Date: Thursday, November 18, 2010, 2:13 PM > > > ?plot > Will give a good solution > > #Example: > set.seed(5) > xx <- data.frame(x = runif(50), y = runif(50), z = sample(c(1:3), 50, T)) > with(xx, plot(x, y, col = z, pch = 19)) > > Now you can start going into how to play with the colors, and how to add > ?legend to the image... > > Tal > > > > ----------------Contact > Details:------------------------------------------------------- > Contact me: tal.gal...@gmail.com<http://mc/compose?to=tal.gal...@gmail.com>| > 972-52-7275845 > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | > www.r-statistics.com (English) > > ---------------------------------------------------------------------------------------------- > > > > > On Thu, Nov 18, 2010 at 4:08 PM, Alaios > <ala...@yahoo.com<http://mc/compose?to=ala...@yahoo.com> > > wrote: > > Hello everyone. > I want some help with plots. > I have some robots in an area. Every robot is placed on x,y coordinates and > every robot has a power consumption of some watts. I would like to show > where are the robots by showing in a map dots (where every dots is the x,y > coordinate). > Below that dot it would be nice to write the watt consumption but also use > some colors to denote different classes of consumption. So 10-20watt should > be denoted by blue 20-30 with red, 30-40 with pink and so on. > > Which is the appropriate plot function for that? > > Regards > Alex > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org <http://mc/compose?to=r-h...@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. > > > > [[alternative HTML version deleted]] ______________________________________________ R-help@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.