avoid producing a eps-graphic with 2 pages by mixing traditional and grid graphics

+1 vote

I used this r-programm to generate an eps-graphic. unfortunately it produces a graphic with

one empty page and then the correct one and the problem is the graphic mixing

bv_setEPS1<-function(width1,height1)#set eps boundingbox
{
   args<-list(width=width1,height=height1)
   force <- list(onefile = TRUE, horizontal = FALSE, paper = "special")
   args[names(force)] <- force
   do.call("ps.options", args)
}
 
 
pievalues<-c(3,3,3,3)
 
h<-17.9*0.75*(15/25.2)/2.54
w<-17.9*0.75/2.54
sc<-0.75*17.9/25.2
 
bv_setEPS1(width1=w,height1=h)
ifont<-"Helvetica"
 
postscript(file="filename")#zeichne EPS
 
pushViewport(viewport(  #A
   layout=grid.layout(3,1,widths=sc*unit(c(25.2),c("cm")),
               heights=sc*unit(c(0.5,2,12.5),c("cm","cm","cm")))))
              
pushViewport(viewport(layout.pos.col=1, layout.pos.row=3))#main region  
par(mai=c(0,0,0,0))
layout(matrix(c(1,2),byrow=TRUE,ncol=2),widths=c(1,1))#lcm(6),lcm(6)))
       scal<-1.5
bisector<-bv_pie3D(x=pievalues,edges=100,radius=0.9*scal,height=0.16*scal,theta=pi/18*4,start=pi/2,border=par("fg"),
                col=pieColors,labels=NULL,labelpos=NULL,labelcol=par("fg"),labelcex=0.75*scal,
                sector.order=NULL,explode=0.0,shade=0.4,main="",pty="s")
popViewport()#main region
             
#oberer balken  
pushViewport(viewport(layout.pos.col=1, layout.pos.row=2,
           gp=gpar(fill=rgb(216,232,200,maxColorValue=255),
           col=rgb(216,232,200,maxColorValue=255) )))
grid.rect()
#beschriftung oberer balken
grid.text(bv_gnames(g),
          gp=gpar(col="black",fontfamily=ifont,cex=sc),
          just=c("center","center"))
popViewport()#oberer balken
             
popViewport()#A
             
dev.off()  
The result is like this:       

Aug 23, 2018 in Data Analytics by terasi
• 170 points

recategorized Aug 24, 2018 by Vardhan 42 views

2 answers to this question.

+1 vote

The bv_set() is missing from your code hence I can't reproduce the result and tweak the parameters to bring the output in one page.

You can refer to following page to customize the plot parameters: https://bit.ly/2ocZroZ

answered Aug 27, 2018 by Anmol
• 1,620 points
0 votes
Supplement: The function bv_pie3D must be plotrix::pie3d and is a traditional

graphic from the plotrix package. The Viewport functions are from grid graphics.

I have also exprimentet with baseViewports() recommended for combining

traditional grid graphics but without sucess.
answered Aug 27, 2018 by terasi
• 170 points
@terasi, how does @bolder's answer below help?

Related Questions In Data Analytics

0 votes
1 answer

How to export a graph to .eps file with R?

The easiest way that I could suggest ...READ MORE

answered Apr 27, 2018 in Data Analytics by darklord
• 6,140 points
804 views
0 votes
1 answer

How to filter a data frame with dplyr and tidy evaluation in R?

Requires the use of map_df to run each model, ...READ MORE

answered May 16, 2018 in Data Analytics by DataKing99
• 8,100 points
61 views
0 votes
1 answer

Dynamically select element from a list and work with it - Shiny R

Follow these steps: Import the data into R Check ...READ MORE

answered Dec 5, 2018 in Data Analytics by Maverick
• 10,040 points
397 views
0 votes
2 answers

What is difference between Distributed search head and Search head cluster?

 A distributed environment describes the separation of ...READ MORE

answered Dec 3, 2018 in Data Analytics by Ali
• 10,450 points
127 views
0 votes
2 answers

"Train" and "Test" sets in Data Science

Normally to perform supervised learning you need ...READ MORE

answered Aug 2, 2018 in Data Analytics by ANMOL
• 3,620 points
33 views
0 votes
2 answers

Installing MXNet for R in Windows System

You can install it for python in ...READ MORE

answered Dec 3, 2018 in Data Analytics by Kalgi
• 37,320 points
250 views
+1 vote
3 answers

Problem with installation of Wordcloud in anaconda

Using Anaconda Python 3.6 version For Windows ...READ MORE

answered Aug 7, 2018 in Data Analytics by Priyaj
• 56,160 points
2,685 views
0 votes
1 answer

How to pass command line arguments to run a Rscript

1. For taking an argument from the ...READ MORE

answered Aug 6, 2018 in Data Analytics by Anmol
• 1,620 points
82 views
0 votes
2 answers

When scoring a logistic regression model , is having the predicted variable in test dataset mandatory ?

Answer to your follow up question: We can ...READ MORE

answered Oct 17, 2018 in Data Analytics by Anmol
• 1,620 points
39 views