On 05/08/2012 01:04 PM, Romero, Ingrid C. wrote:> Hi,
>
> My name is Ingrid, in this moment I try to make a plot with filled.contour.
Initially, I can to obtain the graphic but the xaxis was not fine, because the
intervals were not coherent (Attach file 1: Plot_age_ML_contamana_final.pdf)
> I changed the parameters of the each axis, but when I try to run the code
appear two errors:
>
> 1. in if (del == 0&& to == 0) return(to) :
> valor ausente donde TRUE/FALSE es necesario (missing
value where TRUE/FALSE needed)
>
>
> 2. Error en filled.contour(x = as.numeric(new.ages), y =
as.numeric(depths), :
>
> valores insuficientes de 'x' o 'y' (insufficient values
of 'x' or 'y').
>
>
>
> This is the code that I trying to run
>
>
>
> ML.contamana<-read.table("contamana_age_mod.txt"
,header=T,sep="\t",na.strings = "NA")
>
> head(ML.contamana)
>
>
>
> depths<-read.table("contamana_age_mod.txt"
,header=F,sep="\t",na.strings = "NA")
>
> head(depths)
>
> depths<-depths[1,2:ncol(depths)]
>
>
depths1<-c("CTA57PN1","CTA44PN2","CTA44PN3","CTA44PN4","CTA44PN5","CTA44PN6","CTA44PN7","CTATODO")
>
>
>
> # line(a):
>
> ito<-ML.contamana[,2:ncol(ML.contamana)]
>
>
>
> ###IS PART OF THE FIRST SCRIPT
>
> ito2<-as.matrix(ito)
>
> str(ito)
>
> head(ito)
>
> y=1:ncol(ito)
>
> x=1:nrow(ito)
>
>
>
> new.ages<-length(unique(ML.contamana[,1]))
>
> depths2<- sprintf("%4.1f", depths) # to reduce decimals if
needed
>
>
>
> ## Defining Palynological Zones according to Jaramillo et al. 2001
>
> Pal.zones<-c(65.5,61.906, 60.015566,59.012341, 56.1, 55.7,
48.6,38,33.9,32.1,31.5,26.8,23, 17.2, 16.1,
>
> 14.2, 12.7,7.1,4.8)
>
>
>
> lab.zones<-c("KT 65.5","Top T-01 61.9","Top
T-02 60","Top T-03 59","Top T-04a 56.1","Top T-04b
>
> 55.7","Top T-05 48.6","Top T-06 38","Top T-07
33.9","Top T-08 32.1","Top T-09 31.5","Top T-10
>
> 26.8","Top T-11 23","Top T-12 17.7","Top T-13
16.1","Top T-14 14.2","Top T-15 12.7","Top T-16
>
> 7.1","Top T-17 4.8") ## palynological zones tops
>
>
>
> ## To plot
>
> # With this appear the first error
>
> filled.contour(x, y, z = ito2,xlim=c(0,1500), col=c(rainbow(14, start =
4/6, end =2/5)),
>
> plot.title = title(main = "CONTAMANA",
>
> xlab = "AGES Ma", ylab = "SAMPLES",
cex.lab=0.6),
>
> plot.axes = { axis(1,at=c(seq(1,nrow(new.ages), by=100)),cex=0.7,
cex.axis=0.7);
>
> axis(2,at=c(seq(1,ncol(depths), by=1)),labels=c(depths),cex=0.3,
cex.axis=0.7);
>
> axis(3,at=c(Pal.zones), labels=c(Ta.zones),cex=0.3, cex.lab=0.3,
cex.axis=0.7)},
>
> key.title = title(main="Normalized\n Likelihood", cex.main=0.8,
cex=0.5))
>
>
> ##With this appear the second error
>
>
>
> filled.contour(x=as.numeric(new.ages), y= as.numeric(depths), z = ito2,
col=c(rainbow(14, start = 4/6, end
>
> =2/5)), plot.title = title(main = "CONTAMANA", xlab = "AGES
Ma", ylab >
> "SAMPLES"),
>
> plot.axes = {axis(1,cex=0.5,cex.lab=0.3);
>
> axis(2,cex=0.5, cex.lab=0.3);
>
> axis(3,at=c(Pal.zones), labels=c(lab.zones),cex=0.3, cex.lab=0.2)},
>
> key.title = title(main="Normalized\n Likelihood",
cex.main=0.8,cex=0.5))
>
>
Hi Ingrid,
I think your first problem with the x axis could be solved like this:
axis(1,at=Pal.zones,cex=0.7, cex.axis=0.7)
if by "not coherent" you mean that the values on the x axis did not
line
up with the labels for the palynological zones.
Jim