Symbols
The argument pch, an abbreviation for plot character, is the standard argument to set the character that will be plotted in a number of R functions. Values of 0 to 20 specify a symbol the color which is by default black. The color of these symbols can be changed by supplying colors to the argument col. pch values from 21 to 25 are filled symbols that require two colors to be specified to the arguments col and bg. Most other character supplied to pch other than this will plot that character.
Code to generate the table above:
# This just sets up an empty plotting field
plot(x = c(0, 4.5),
y = c(0, 5),
main = "pch arguments",
xaxt = "n",
yaxt = "n",
xlab = "",
ylab = "",
cex.main = 2.5,
col = "white"
)
# This will plot all of the standard pch arguments
y = rep(5:0, each=5)
for (i in 0:25) {
points(x = i %% 5, y = y[i+1], pch = i,cex = 2, col="blue", bg="red")
text(0.3 + i %% 5, y = y[i+1], i, cex = 2)
}
Colors
A blessing or curse of R is that it has a bewildering range of options for choosing colors schemes. However, my interaction with R colors usually come in 2 flavors. 1) I need a color ramp to show continuous variation in some variable - like a heat map 2) I need to display a small number of discrete states. Below I go over my way of dealing with both of these.
Color choices for continuous data
Two simple and quick options here that often work fine are heat.colors and viridis. Heat colors is the default red to white color scheme you find on most heat maps.
heatmap with heat.colors palette:

Viridis is relatively new package imported from the python world and has lots of advantages. Viridis is color blind friendly and has been shown to be interpreted more accurately by viewers.

You can also always just make your own color ramp using the graphics package function colorRampPalette. You use this function by supplying two colors it then creates a function that takes a numeric value and returns a vector of the same length with colors interpolated between the two specified colors. This is an example of giving it the University of Minnesota's colors: #ffcc33 (gold) and #7a0019 (maroon).

code for the plots above:
data("Harman23.cor")
data <- color="#0000ff" font="" harman23.cor="">1]]
image(data, col = heat.colors(16))
library(viridis)
image(data, col = viridis(18))
rgpal <- color="#ff0000" font="">colorRampPalette(colors = c("#ffcc33", "#7a0019"))
image(data, col = rgpal(17), main = "University of Minnesota Colors", cex.main = .7)
Color choices for limited discrete data
I think this is a particularly important part of constructing plots and all to often it gets insufficient attention. My favourite tool here is the colorBrewer website http://colorbrewer2.org/. To use this website 1) pick the number of categories you have 2) pick “qualitative 3) try different color schemes. This website makes it super easy to try and play with lots of color schemes. 4) Once you find a set of colors that you like just copy and paste the hex codes as arguments to col.

Hi to every one, the contents present at this site are
ReplyDeleteactually remarkable for people experience, well, keep up the good work fellows.
Hadoop Training in Chennai