[Tikzdevice-bugs] Arial and Other Things

Lorenzo Isella lorenzo.isella at gmail.com
Tue Jul 27 18:54:05 CEST 2010


On Mon, 2010-07-26 at 15:19 -0700, Charlie Sharpsteen wrote:
> Hi Lorenzo,
> 
> 
> A minimal example of this would indeed help- it would be a perfect
> test to see if v. 0.5.0 is ready for CRAN as this is the sort of
> problem that version was designed to solve.



Hi guys,
Maybe the snippet at the end of the email cannot be called a minimal
example (I modified a bit one of my figures), but it illustrates the
point.
On my system (ubuntu 10.04, amd64 architecture, ggplot 0.8.8 and
tikzDevice 0.5.0), the snippet below generates fine-looking figure, but
if I uncomment the lines before and after library(tikzDevice) and re-run
it, then the font size of the axis labels changes and e.g. some exponent
of the powers of 10 along the x axis collide with "10".
Any ideas about how to fix this?
Cheers

Lorenzo



##################################################################################

library(ggplot2)

## options( tikzMetricsDictionary = NULL )

library(tikzDevice)

## setTikzDefaults()
## options(tikzLatexPackages=c(getOption("tikzLatexPackages"),
## '\\renewcommand{\\rmdefault}{phv}\n'))



mb<-c(seq(1e-7,1e-6,by=1e-7),seq(2e-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(2e-1,1,by=0.1) )


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

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



mbx<-c(seq(1,10,by=1),seq(2e1,1e2,by=1e1),seq(2e2,1e3,by=1e2),seq(2e3,1e4,by=1e3),seq(2e4,1e5,by=1e4),seq(2e5,1e6,by=1e5))


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

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


x <- seq(1e0,1e4,length=100)
y <- x^(-1)

data_point <- as.data.frame(cbind(x,y))
names(data_point) <- c("x","y")

fn <- "some variable"

gpl <- ggplot(data_point,aes())+

 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(0.5,2e4),breaks=mbx,
label=my_label2x, expand = c(0,0))+


scale_y_continuous( trans="log10", limits=c(1e-6, 2e0),
breaks=mb,label=my_label2 , expand = c(0,0))+

  opts(axis.ticks = theme_segment(colour = "black",
size=1.3),axis.ticks.length = unit(0.15, "cm"))+

 xlab("")+
ylab("")+
opts(axis.title.x = theme_text(size = 20))+

 opts(axis.title.y = theme_text(size = 20, angle=90))+
  opts(title = fn)+


  opts(plot.title = theme_text(size = 25))+
opts(axis.text.x = theme_text(size=26, colour="black",vjust=1))+
opts(axis.text.y = theme_text(size=26, colour="black", hjust=1))
  
tikz('test-figure.tex', standAlone = TRUE, width=5,height=5)

print(gpl)
dev.off()

tools::texi2dvi('test-figure.tex',pdf=T)






















More information about the Tikzdevice-bugs mailing list