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 928 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 28, 2018 by Anmol
• 1,780 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 28, 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 Sahiti
• 6,370 points
4,849 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 17, 2018 in Data Analytics by DataKing99
• 8,250 points
1,899 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,840 points
3,761 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 4, 2018 in Data Analytics by Ali
• 11,360 points
2,469 views
0 votes
2 answers

"Train" and "Test" sets in Data Science

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

answered Aug 3, 2018 in Data Analytics by Abhi
• 3,720 points
1,325 views
0 votes
2 answers

Installing MXNet for R in Windows System

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

answered Dec 4, 2018 in Data Analytics by Kalgi
• 52,350 points
2,424 views
+2 votes
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
• 58,020 points
18,689 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,780 points
8,239 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,780 points
1,333 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP