R tkrplot layout issue

Viewed 131

I've got a problem with extra space being put to the right and below plots made with tkrplot in R, as below. I've tried changing hscale and vscale, but all that does is magnify/reduce the overall size of each plot, along with the extra unwanted space.

enter image description here

The code that generates these looks like this:

ct <- tkrplot(pane, fun)
tkgrid(ct, row = deRow, column = deCol)

where deRow is 1, and deCol is 1 for the first one, and 2 for the second.

Added: The function for the second plot looks like this:

fun = function(){
  ....
  fp2 = ggplot(df, aes(time, val, color=iPer)) +
    geom_point()+
    geom_path(aes(group = iPer))
  print(fp2)
}

Any help appreciated.

1 Answers

According to Programming Graphical User Interfaces in R By Michael Lawrence, John Verzani :

GRID

The tkgrid geometry manager is used to align widgets in rows and columns. In its simplest usage, a command like

tkgrid(child1,child2,..., childn)

will place the n children in a new row, in columns 1 through n.

...

and guessing you want to use only one row it seems you can call a single tkgrid with both plot as parameters.

I hope this help you,

Saludos!

Related