Como pongo mi tabla de código de colores??

Hola buenas noches, estoy haciendo unos histogramas , pero me solicitaron poner una tabla de mis códigos de colores , como se la pongo?
este es mi script:
P<- read.csv("COR_PROT_MED.csv", sep = ",")
hist(x = P$CIRCUNFERENCIA.CEFALICA...cm., xlim = c(-0.2,+0.2),xlab = "Coeficiente de correlacion", ylab = "Frecuencia", main = "HISTOGRAMA MEDIDAS FETALES-LIPIDOS", col = "red")
hist(x = P$CIRCUNFERENCIA.ABDOMINAL...cm.,add = T,xlab = "Coeficiente de correlacion", ylab = "Frecuencia",col = "blue")
hist(x = P$LONGITUD.DE.FEMUR.cm.,add = T,xlab = "Coeficiente de correlacion", ylab = "Frecuencia",col = "yellow")
hist(x = P$PESO.FETAL.ESTIMADO..gr,add = T,xlab = "Coeficiente de correlacion", ylab = "Frecuencia",col = rgb(0,0,0,0.2))

anexo la foto de mi histograma.

de ante mano, gracias por su ayuda.

I used the legend() function.

set.seed(1)
DF <- data.frame(A = rnorm(20), B = rnorm(20, 5, 1))
hist(DF$A, col ="red", xlim = c(-2, 8), breaks = seq(-3, 7, 0.5))
hist(DF$B, col ="green", add = TRUE, breaks = seq(-2, 7, 0.5))
legend(x = "topleft", legend = c("Pop A", "Pop B"), fill = c("red", "green"))

Created on 2020-09-16 by the reprex package (v0.3.0)

1 Like

Gracias :slight_smile: , me ayudaste demasiado.

hola molestandote de nuevo :frowning: , como puedo disminuir el tamaño del cuadro lo que pasa es que me tapa una barras.

set.seed(1)
DF <- data.frame(A = rnorm(20), B = rnorm(20, 5, 1))
hist(DF$A, col ="red", xlim = c(-2, 8), breaks = seq(-3, 7, 0.5))
hist(DF$B, col ="green", add = TRUE, breaks = seq(-2, 7, 0.5))
legend(x = "topleft", legend = c("Pop A", "Pop B"), 
       fill = c("red", "green"))


#usar cex < 1
hist(DF$A, col ="red", xlim = c(-2, 8), breaks = seq(-3, 7, 0.5))
hist(DF$B, col ="green", add = TRUE, breaks = seq(-2, 7, 0.5))
legend(x = "topleft", legend = c("Pop A", "Pop B"), 
       fill = c("red", "green"), cex = 0.5)

Created on 2020-09-16 by the reprex package (v0.3.0)

hay gracias , ya puede realizarlo :slight_smile: , ahora tengo otro problema
hay algunas barras de las gráficas que se sobreponen, sabrás poner textura en las barras como en la ultima imagen con transparencia , es que si solo pongo color con transparencia no se nota dada :frowning:



image

You can find all of this information in the help files.
Puede encontrar toda esta información en la ayuda.

set.seed(2)
DF <- data.frame(A = rnorm(20), B = rnorm(20, 3, 1))
hist(DF$A, col = "red", density = 10, angle = -45, 
     xlim = c(-4, 8), ylim = c(0,9), breaks = seq(-3, 7, 0.5))
hist(DF$B, col = "green", add = TRUE, , density = 10)
legend(x = "topleft", legend = c("Pop A", "Pop B"), 
       fill = c("red", "green"), cex = 0.5)
1 Like


thank :smiling_face::smiling_face::smiling_face::smiling_face::heart:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.