Can someone let me know the various colors which produced the excellent color mix in the 4-panel plot on this link:?
http://www.enr.gov.nt.ca/state-environment/13-projected-trends-temperature-and-precipitation-arctic
I need the color ramp on the right of the plot for precipitation.
I tried something like:
col=colorRampPalette(c( "red3","orange","gold1", "yellow", "lightskyblue","steelblue3", "royalblue3",
"darkblue","darkblue"))(30))
but could not get it right. A list of colors in R is found here:
http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf
Many thanks.
AZ.
You can identify the colors using the Eyedropper Tool in Firefox, although it's a bit tedious. As you can see below, the actual palette is close but not quite the same as the Color Brewer palette.
actual <- c('#2F2C62', '#42399B', '#4A52A7', '#59AFEA', '#7BCEB8', '#A7DA64',
'#EFF121', '#F5952D', '#E93131', '#D70131', '#D70131')
library(colorRamps)
barplot(cbind(1:11,1:11),beside=TRUE,names=c("actual","brewer.pal(11,'RdYlBu')"),
col=c(rev(actual),brewer.pal(11,"RdYlBu")))
It looks very close to the color scheme called 'RdYlBl' from RColorBrewer.
Here is how it looks like:
require('RColorBrewer')
display.brewer.pal(11,'RdYlBu')
(to use it: brewer.pal(11,'RdYlBu'))
Related
I have to make this exact plot but I can't seem to find the right color in the hexadecimal chart.
Also does anyone know how to change the labels on the y-axis as well. My values show up as 1e+07 instead of 10,000.
Here is the code I used to make my plot
The data is from the USAarrests data set from R.
p=ggplot(data=examdata,aes(Assault,Population))
p=p+geom_point(size=3,color="red",shape="asterisk")
p=p+geom_smooth(color="Purple",lty="dashed",fill="#71F563")
Here is the picture after I tried the color code you all found.
Edited Plot]2
I think I have to change the alpha on it, but I dont know how to do that with fill. Sorry if these questions have been asked.
I looks like a custom color palette to me. You can use an color picker tool (such as https://imagecolorpicker.com/) to see the exact hex. I tried it out and got this:
Green (CI): #7ef376
Purple (dashed line): #a251ef
Red (data points): #e93f33
Can you also show the code so we know what you did to get your y-axis?
Hey I want to create my own custom palette of color in R using the brewer.pal() function. And then I want to view it using the image function.
ny<-brewer.pal(7,"Blues")
image(x=1:7,y=1,z=as.matrix(1:7),col=ny)
This code gives 7 shdes of blue, however i want to give my own choice of 7 different colors.
image(x=1:7,y=1,z=as.matrix(1:7),col=c("Reds","Blues"))
I thought of trying this function, but its obvious wrong. Can someone please help me. I specifically want to use the brewer.pal() and image() funcions
If you'd prefer a gradient between 2+ colors of your choosing, you could also use colorRampPalette
pretty = colorRampPalette(c('#EF6780', '#80ef67', '#6780ef'))
image(x=1:7,y=1,z=as.matrix(1:7),col=pretty(200))
You can specify colors as hexadecimal colors in R. For example
image(x=1:7,y=1,z=as.matrix(1:7),col= "#CC6666")
References:
http://www.color-hex.com/
http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/
I was wondering if anybody had much experience with the function bplot in R, I am making a 3d plot and the plot works fine. The only thing I want to change is the gradient of colour which you get from drape=TRUE. At the moment it has a single pink colour fading into blue, I really need a third colour in the middle to highlight the central data better as this is the most important for my study, and at the moment in some of the plots I am doing its too difficult to pick out and correlate with the level of y in the colour scale bar.
Does anybody have any idea how to do this?
I need more reputation to post an image of the plot but you can see what I mean in the second image of this thread.
Plot Regression Surface
Many thanks
Aaron
Try adding a colorRampPalette argument to your plot like so:
col.regions = colorRampPalette(colors=c("red","yellow"))(1000)
This will give you a gradient of 1000 shades between red and yellow, You can use any of the R colors in the color ramp, and you can specify more than two e.g.colors=c("red","orange3","palegoldenrod") if you like. You should put this argument at the same place you are putting drape=TRUE
Is it possible to have different colours in my plot in Scilab? I use the mtlb_hold to hold the graph and it works fine, but my problem is that then I have the same colours in my graph. In Matlab with the hold command, I have different colours. Is it possible to have different colours in Scilab too?
Thank you in advance.
Just found it. In the plot function, for example plot(), you can pass a second argument which specifies the color that will be used. For example, you can use use b for blue color, g for green, r for red and call plot() like this: plot(z,"r").
The SciLab documentation provides examples for using colors:
https://help.scilab.org/doc/5.3.3/en_US/color.html
The plot2d()-function e.g. accepts an attribute style, where you can even specify a color for each function with its full name:
plot2d(x,[sin(x),cos(x)],style=[color("red"),color("green")]);
Does R have color palettes?
In other words, I am looking for an array of 6 or so color names that go well together in a graph or plot; maybe there are some predefined schemes like that?
RColorBrewer, as mentioned by deinst, is very useful -- even though it was designed for maps rather than line charts.
A number of other packages offer help with palettes:
gplots has colorpanel(), rich.colors(), ...
hcl-colors
colorRamps
colorspace
caTools
caTools
...
as can be seen from a quick query on 'palette' at rseek.org.
The easiest way to generate a palette is using generic functions from the basic grDevices package:
rainbow()
topo.colors()
terrain.colors()
heat.colors()
These are useful if the desired number of colors doesn't exceed 7-8. The only necessary argument is the number of colors in palette.
There is also gray() function which can be used to generate various schades of gray.
Or you could do something like:
pal <- colorRampPalette(c("red", "blue", "plum"))
barplot(t(as.matrix(mydf)), beside=TRUE, col=pal(3))
Look at the RColorBrewer package. The colors are not named, but I think that they are close to what you are looking for.
Visit this page before using RColorBrewer. Select the number of your data classes in the top and then define the nature of your data. You may also find this page useful.
No one mention this but look at palette function (?palette) which define default pallet.
palette()[1:6] gives you first six default colours.