I have a table of 33291 rows. When i try to plot the graph with gradient colour using "colorRampPalette" command but the out put graph is colourless or in black colour.But when i try the same command with small values it is working why it so? Color <- colorRampPalette(c("red","blue")) plot(x,y,col=Color(33292)) -- View this message in context: http://r.789695.n4.nabble.com/Colour-gradient-is-not-working-tp4708000.html Sent from the R help mailing list archive at Nabble.com.
Your example is not reproducible. You pass 33292 colors to plot, but never specify how to use them so only the first color (red) is used. If it worked with a smaller number of colors, you were using something other than the default plot function. If it works with a smaller number of colors, but not more, you may have overloaded the plot device. ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of sreenath Sent: Monday, June 1, 2015 6:12 AM To: r-help at r-project.org Subject: [R] Colour gradient is not working. I have a table of 33291 rows. When i try to plot the graph with gradient colour using "colorRampPalette" command but the out put graph is colourless or in black colour.But when i try the same command with small values it is working why it so? Color <- colorRampPalette(c("red","blue")) plot(x,y,col=Color(33292)) -- View this message in context: http://r.789695.n4.nabble.com/Colour-gradient-is-not-working-tp4708000.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
1. Don't use Nabble for the r-help mailing list. 2. Read the posting guide, and read http://adv-r.had.co.nz/Reproducibility.html 3. The following code works for me. Your error is not due to requesting too many colours... n <- 100000 x <- rnorm(n) y <- rnorm(n) myPalette <- colorRampPalette(c("red", "blue")) plot(x, y, pch = ".", col = myPalette(n)) ... although (obviously) most of the 100,000 colour values are the same: R > length(unique(myPalette(n))) [1] 259 B. On Jun 1, 2015, at 10:37 AM, David L Carlson <dcarlson at tamu.edu> wrote:> Your example is not reproducible. You pass 33292 colors to plot, but never specify how to use them so only the first color (red) is used. If it worked with a smaller number of colors, you were using something other than the default plot function. If it works with a smaller number of colors, but not more, you may have overloaded the plot device. > > ------------------------------------- > David L Carlson > Department of Anthropology > Texas A&M University > College Station, TX 77840-4352 > > -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of sreenath > Sent: Monday, June 1, 2015 6:12 AM > To: r-help at r-project.org > Subject: [R] Colour gradient is not working. > > I have a table of 33291 rows. When i try to plot the graph with gradient > colour using "colorRampPalette" command but the out put graph is colourless > or in black colour.But when i try the same command with small values it is > working why it so? > > Color <- colorRampPalette(c("red","blue")) > > plot(x,y,col=Color(33292)) > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Colour-gradient-is-not-working-tp4708000.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
Try this plot(1:33292, 1:33292,col=Color(33292)) and then decide again whether or not it is working. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 6/1/15, 4:12 AM, "sreenath" <sreenath.rajur at macfast.ac.in> wrote:>I have a table of 33291 rows. When i try to plot the graph with gradient >colour using "colorRampPalette" command but the out put graph is >colourless >or in black colour.But when i try the same command with small values it is >working why it so? > >Color <- colorRampPalette(c("red","blue")) > >plot(x,y,col=Color(33292)) > > > > >-- >View this message in context: >http://r.789695.n4.nabble.com/Colour-gradient-is-not-working-tp4708000.htm >l >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.
sir i done this plot(1:33292, 1:33292,col=Color(33292)) command then it gives the coloured line but again it is not working in my data why? -- View this message in context: http://r.789695.n4.nabble.com/Colour-gradient-is-not-working-tp4708000p4708036.html Sent from the R help mailing list archive at Nabble.com.
How can i use colour gradient according to y axis if the y values not increasing gradualy -- View this message in context: http://r.789695.n4.nabble.com/Colour-gradient-is-not-working-tp4708000p4708595.html Sent from the R help mailing list archive at Nabble.com.
1. Don't ignore previous advice On Jun 1, 2015, at 10:59 AM, Boris Steipe <boris.steipe at utoronto.ca> wrote:> 1. Don't use Nabble for the r-help mailing list. > > 2. Read the posting guide, and read http://adv-r.had.co.nz/Reproducibility.html >2. Map your values to a range of integers that you can use as indices of your colour vector. The rank() function may be useful for this. However this is probably a bad idea from an information design point of view: it is likely that the resulting plot is misleading by presenting a continuity in colour where there is a discontinuity in values. B. PS. Seriously: don't ignore previous advice. I will not respond to further questions if you do. On Jun 13, 2015, at 1:09 AM, sreenath <sreenath.rajur at macfast.ac.in> wrote:> How can i use colour gradient according to y axis if the y values not > increasing gradualy > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Colour-gradient-is-not-working-tp4708000p4708595.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.