aboutsummaryrefslogtreecommitdiff
path: root/remote_plot.c
diff options
context:
space:
mode:
authorXiao Pan <xyz@flylightning.xyz>2025-04-26 07:28:20 -0700
committerXiao Pan <xyz@flylightning.xyz>2025-04-26 07:28:20 -0700
commit2d9707e4609552eca377585b4beb9aa16a60ea31 (patch)
tree7f31fbf1a2000a2638e8a3ca73cd65e35ee3e011 /remote_plot.c
parentcd899f07c6487cc6c7b4cad2cc0601c3db132eed (diff)
Dynamic plots size and arrangements
Diffstat (limited to 'remote_plot.c')
-rw-r--r--remote_plot.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/remote_plot.c b/remote_plot.c
index 7c456c0..0ef797b 100644
--- a/remote_plot.c
+++ b/remote_plot.c
@@ -396,7 +396,13 @@ static void draw_function (GtkDrawingArea *area,
plsdev( "extcairo" );
- //plsetopt("geometry", "600x400");
+ {
+ char str[12];
+ sprintf(str,"%dx%d",
+ gtk_widget_get_width(data->area),
+ gtk_widget_get_height(data->area));
+ plsetopt("geometry", str);
+ }
// change to white background and black foreground, and gray color palette
// http://plplot.org/docbook-manual/plplot-html-5.15.0/color.html
@@ -408,7 +414,10 @@ static void draw_function (GtkDrawingArea *area,
plspal1("cmap1_gray.pal", 1);
// Initialize plplot
- plstar(1,plot_counts);
+ if(plot_counts>3)
+ plstar(3,(plot_counts+2)/3);
+ else
+ plstar(1,plot_counts);
pl_cmd( PLESC_DEVINIT, cr );
for(int i=0;i<(VOLTLEN+TEMPLEN);i++)
@@ -485,12 +494,13 @@ static void activate (GtkApplication *app, gpointer user_data)
gtk_window_set_title (GTK_WINDOW (window), "remote_plot");
gtk_window_set_default_size (GTK_WINDOW (window), 1000, 1000);
- gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (data->area), 600);
- gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (data->area), 600);
+ //gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (data->area), 600);
+ //gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (data->area), 600);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (data->area),
draw_function,
user_data, NULL);
- //gtk_widget_set_vexpand(data->area,TRUE);
+ gtk_widget_set_vexpand(data->area,TRUE);
+ gtk_widget_set_hexpand(data->area,TRUE);
button = gtk_button_new_with_label ("Print data");
g_signal_connect (button, "clicked", G_CALLBACK (print_data), user_data);