[Tikzdevice-bugs] Question about warnings

Lorenzo Isella lorenzo.isella at gmail.com
Thu Oct 28 15:13:56 CEST 2010



On 10/26/2010 11:51 PM, Charlie Sharpsteen wrote:
> On Mon, Oct 25, 2010 at 10:31 PM, Cameron Bracken
> <cameron.bracken at gmail.com <mailto:cameron.bracken at gmail.com>> wrote:
>
>     I agree it is very strange, it is possible that there is something in
>     the way pgfSweave calls tikzDevice.  I will look into it.
>
>     -Cameron
>
>
> Possibly,
>
> Lorenzo-- were you using pgfSweave when the warnings appeared?
>
> -Charlie


Hi everyone,
I am delving into this. Something strange is happening: the first time I 
run my script from the R shell (see below) I get 36 warnings like the 
one I reported on this list, but when I re-run it, no warnings are output.
I paste below the script I am using, though it may not make much sense 
without the real data. I'll try to put together a self-contained example.

Lorenzo






rm(list=ls())
library(tikzDevice)
library(ggplot2)


log_binning_3 <- function(x_min,x_max,epsi,n_bin){
#epsi <- 0.001
x_max <- x_max+epsi
m <- n_bin-1
r <- (x_max/x_min)^(1/m)
my_seq <- seq(0,m,by=1)
grid <- x_min*r^my_seq

}





vplayout <- function(x, y) viewport(layout.pos.row=x, layout.pos.col=y)



draw9tik <- function(pdfname, a,b,c,d,
                             e,f,g,h2,
                             i,
                                  w,h) {

     #pdf(pdfname,width=w, height=h)
#     CairoPDF(pdfname,width=w, height=h)

     tikz(pdfname, standAlone = TRUE, width=w,height=h)


     grid.newpage()
     pushViewport(viewport(layout=grid.layout(3,3) ) )

         print(a, vp=vplayout(1,1))
         print(b, vp=vplayout(1,2))
         print(c, vp=vplayout(1,3))
         print(d, vp=vplayout(2,1))

         print(e, vp=vplayout(2,2))
         print(f, vp=vplayout(2,3))
         print(g, vp=vplayout(3,1))
         print(h2, vp=vplayout(3,2))
         print(i, vp=vplayout(3,3))





     dev.off()
     tools::texi2dvi(pdfname,pdf=T)


   }


draw9 <- function(pdfname, a,b,c,d,
                             e,f,g,h2,
                             i,
                                  w,h) {

     pdf(pdfname,width=w, height=h)
#     CairoPDF(pdfname,width=w, height=h)

     ## tikz(pdfname, standAlone = TRUE, width=w,height=h)


     grid.newpage()
     pushViewport(viewport(layout=grid.layout(3,3) ) )

         print(a, vp=vplayout(1,1))
         print(b, vp=vplayout(1,2))
         print(c, vp=vplayout(1,3))
         print(d, vp=vplayout(2,1))

         print(e, vp=vplayout(2,2))
         print(f, vp=vplayout(2,3))
         print(g, vp=vplayout(3,1))
         print(h2, vp=vplayout(3,2))
         print(i, vp=vplayout(3,3))





     dev.off()
     ## tools::texi2dvi(pdfname,pdf=T)


   }






list_dir <- c("A-P-A", "P-A-P","E-P-E", "P-E-P","N-P-N", "P-N-P", 
"D-P-D","P-D-P","P-P-P")
names_dir <- c("A-P-A", "P-A-P","C-P-C", "P-C-P","N-P-N", "P-N-P", 
"D-P-D","P-D-P","P-P-P")

p_list <- list()


timeslice_dur <- 20

my_min <- 1

my_max <- 2.8e4 #these are the extremes of the grid given in units of 
timeslice_dur

my_grid <- log_binning_3(my_min, my_max, 0,15)

my_seq <- seq(my_min,my_max)

h2<-hist(my_seq, plot=F, breaks=my_grid)

#Measure the discrete width of each bin, i.e. how many
#points can fall in each bin.

norm_count <- h2$counts


mb <- c( seq(10,100, by=10), seq(200,1e3, by=1e2), seq(2e3, 1e4, 
by=1e3), seq(2e4,1e5,by=1e4), seq(2e5,1e6,by=1e5))


my_sel <- seq(1,length(mb), by=9)

my_label <- rep("",length(mb))
my_label[my_sel] <- expression(10^1 ,10^2,10^3, 10^4,10^5,10^6)




mby <- c(seq(1e-6,1e-5,by=1e-6),seq(2e-5,1e-4, by=1e-5), 
seq(2e-4,1e-3,by=1e-4),seq(2e-3,1e-2,by=1e-3),seq(2e-2,1e-1,by=1e-2),seq(1e-1,1,by=1e-1) 
)


my_sel <- seq(1,length(mby), by=9)

my_labely <- rep("",length(mby))
my_labely[my_sel] <- expression(10^-6 ,10^-5,10^-4, 10^-3,10^-2,10^-1,10^0)




for (i in seq(length(list_dir))){

fn <- paste(list_dir[i],"/delta_tab_tac.dat", sep="")


   t_ab_ac <- read.table(fn, header=FALSE)
t_ab_ac <- as.matrix(t_ab_ac)


   h1<-hist(t_ab_ac/timeslice_dur, plot=F, breaks=my_grid) #I divide
#by timeslice_dur in order to have a distribution varying in general
#by the unit.

sel <- which(h1$counts>0)


y_max <- h1$counts[sel]/sum(h1$count)/norm_count[sel]

y_min <- rep(1e-6,length(y_max))

x_min <- my_grid[1:length(my_grid)-1][sel]*timeslice_dur

x_max <- my_grid[2:length(my_grid)][sel]*timeslice_dur

  data_new <- cbind(y_max,y_min,x_min,x_max)



data_new <- as.data.frame(data_new)
names(data_new) <- c("y_max","y_min","x_min","x_max")

p_list[[i]]<- ggplot(data_new,aes())+
geom_rect(aes(ymin = y_min, ymax = y_max,xmin=x_min,xmax=x_max), 
colour="black", fill="blue")+
  ## geom_point(data=data_point,aes(x=x,y=y),colour="red", shape=2, size=5)+
  ##  geom_point(data=data_point,aes(x=x,y=y),colour="red", shape=2, 
size=4.8)+
  ##   geom_point(data=data_point,aes(x=x,y=y),colour="red", shape=2, 
size=4.6)+
    opts( panel.background=theme_rect(fill='white', size=1.5))+
   opts(panel.grid.minor = theme_blank())+
opts(panel.grid.major = theme_blank())+

## scale_x_continuous(trans = "log10",limits=c(1,2e4),breaks=mbx, 
label=my_label2x, expand = c(0,0))+
## scale_y_continuous( trans="log10", limits=c(1e-6, 1e-1), 
breaks=mb,label=my_label2 , expand = c(0,0))+

scale_x_continuous(trans = "log10", limits=c(10, 6.1e5), breaks=mb, 
labels=my_label)+
scale_y_continuous( trans="log10", limits=c(1e-6, 2e-1), 
breaks=mby,labels=my_labely)+

   opts(axis.ticks = theme_segment(colour = "black", 
size=1.3),axis.ticks.length = unit(0.15, "cm"))+
##scale_y_continuous(trans = "log10")+
## scale_x_log10()+
## scale_y_log10()+
  xlab("$\\Delta t_{ABC}$ [sec]")+
ylab("$P(\\Delta t_{ABC})$")+
opts(axis.title.x = theme_text(size = 20))+
## opts(axis.title.y = theme_text(size = 20, angle=90,hjust=0.3))+
  opts(axis.title.y = theme_text(size = 20, angle=90))+
   opts(title = names_dir[i])+

     ## geom_vline(xintercept = 900, col="#D4D4D4", size=.7)+
     ## geom_vline(xintercept = 3600, col="#D4D4D4",size=.7)+

     ## geom_text(aes(y=2.5e-2,x=700,label="15 min", angle=90), size=9, 
col="black")+
     ## geom_text(aes(y=2.5e-2,x=3000,label="1 hour", angle=90), size=9, 
col="black")+


   opts(plot.title = theme_text(size = 25))+
opts(axis.text.x = theme_text(size=18, colour="black",vjust=1))+
opts(axis.text.y = theme_text(size=18, colour="black", hjust=1))





}


width <- 15
height <- 15



draw9tik( "panel-abc-tik.tex", p_list[[1]],p_list[[2]],p_list[[3]],
        p_list[[4]],p_list[[5]],p_list[[6]],p_list[[7]],
        p_list[[8]],p_list[[9]], width, height)


## draw9( "panel-abc-_no_tik.pdf", p_list[[1]],p_list[[2]],p_list[[3]],
##        p_list[[4]],p_list[[5]],p_list[[6]],p_list[[7]],
##        p_list[[8]],p_list[[9]], width, height)




More information about the Tikzdevice-bugs mailing list