And I've just found the expand
parameter in the gWidgets doc...
So using
right_side = ggroup(horizontal = F, container = main_group, expand = T)
instead of
right_side = ggroup(horizontal = F, container = main_group)
did the trick.
Question
I tried to create a GUI with two ggraphics
elements inside holding two plots.
Everything works fine except the scaling of the plots when the gwindow
is resized.
I wonder if the problem lies in the way I create the ggroups
or, in the end, if it is possible at all.
I know that I can set absolute parameters for the plot's size, however, for usability reasons it would be nice if it scales with the size of the GUI's window (such as a normal plot does).
Here is a working example code:
require(gWidgets)
options('guiToolkit'='RGtk2')
window = gwindow("Test")
#The main group...
main_group = ggroup(horizontal = T, container = window)
#...including two groups (left and right)
left_side = ggroup(horizontal = F, container = main_group)
right_side = ggroup(horizontal = F, container = main_group)
#Something on the left
test_frame = gframe("Foo", container = left_side)
another_frame = gframe("bar", container=left_side)
#the two horizontally aligned plots on the right
plot1 = ggraphics(container=right_side)
dev1 = dev.cur();
plot2 = ggraphics(container = right_side)
dev2 = dev.cur();
Sys.sleep(0.5) # avoiding alignment errors
plot(rnorm(100,2))
dev.set(dev1)
plot(rnorm(100,2))
However, when only one plot is used it seems to scale at least vertically but not horizontally.
Solution
And I've just found the expand
parameter in the gWidgets doc...
So using
right_side = ggroup(horizontal = F, container = main_group, expand = T)
instead of
right_side = ggroup(horizontal = F, container = main_group)
did the trick.