Re: GTK3 + gnuplot
On Wed, Sep 19, 2018 at 12:19 AM Allin Cottrell wrote: > > The question now is: "How to embed a gnuplot graphic in gtk3? > > Could you say, please, where to find a simple example, just to undestand > > how it is possible to do that? > > Get gnuplot to produce a PNG file, load the PNG into a GdkPixbuf, then > stick the GdkPixbuf onto a cairo surface. Do not do that. With high probability, an application using PNG as an intermediate plot format will get HiDPI wrong and things will look either blurry or tiny. Plot to SVG, then render that. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK3 + gnuplot
Hi Arkkimede, With gnuplot you can output to a file and then open the file with GTK+. https://gitlab.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/Pipes/gnuplot5.c At one time gnuplot could directly write to GTK but that was a possible security problem so it no longer works to do this. Gnuplot has 3d graphing plots and I think that it does this with cairo. You can graph in 3d with cairo but you need to do a few extra calculations before drawing with cairo. The Graphene library has a number of functions that are very helpful for drawing in 3d. It is part of GTK4 but you can use it in GTK3. https://developer.gnome.org/graphene/stable/ch01.html Another option is to write your own helper functions for drawing with cairo in 3d. https://gitlab.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/perspective3.c https://gitlab.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/perspective4.c https://gitlab.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/shadow1.c https://gitlab.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/shadow2.c https://gitlab.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/spring2.c So options abound for putting together a 3d plotting widget in GTK. Eric -Original Message- From: arkkimede via gtk-app-devel-list To: gtk-app-devel-list list Sent: Tue, Sep 18, 2018 9:20 am Subject: GTK3 + gnuplot Hi! I've developed an application in c to make measurements, with a GUI that manage the inputs and it is able to produce graphical results in terms of 2d plots, realized by mean of the library Cairo. Now I have the necessity to produce 3d plots (3d radiation pattern of antennas). To realize 3d plots by mean of a 2d library, is not impossible but very hard. A solution could be using gnuplot that I'he yet used to produce high quality 3d plots. The question now is: "How to embed a gnuplot graphic in gtk3? Could you say, please, where to find a simple example, just to undestand how it is possible to do that? Thank you ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK3 + gnuplot
On Tue, 18 Sep 2018, arkkimede via gtk-app-devel-list wrote: The question now is: "How to embed a gnuplot graphic in gtk3? Could you say, please, where to find a simple example, just to undestand how it is possible to do that? Get gnuplot to produce a PNG file, load the PNG into a GdkPixbuf, then stick the GdkPixbuf onto a cairo surface. You could take a look at https://sourceforge.net/p/gretl/git/ci/master/tree/gui/gpt_control.c in particular the function render_pngfile(). -- Allin Cottrell Department of Economics Wake Forest University, NC ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK3 + gnuplot
That would be awkward in gnuplot--you'd have to create the plot and then load it as a pixmap or some such. But there's a utility call plplot that's designed to be embedded in other applications and it might work better. https://tschoonj.github.io/blog/2015/07/05/embedding-plplot-in-gtk-drawingareas/ and https://sourceforge.net/p/plplot/mailman/message/26169132/ might help. On 18/09/18 12:19, arkkimede via gtk-app-devel-list wrote: Hi! I've developed an application in c to make measurements, with a GUI that manage the inputs and it is able to produce graphical results in terms of 2d plots, realized by mean of the library Cairo. Now I have the necessity to produce 3d plots (3d radiation pattern of antennas). To realize 3d plots by mean of a 2d library, is not impossible but very hard. A solution could be using gnuplot that I'he yet used to produce high quality 3d plots. The question now is: "How to embed a gnuplot graphic in gtk3? Could you say, please, where to find a simple example, just to undestand how it is possible to do that? Thank you ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GTK3 + gnuplot
Hi! I've developed an application in c to make measurements, with a GUI that manage the inputs and it is able to produce graphical results in terms of 2d plots, realized by mean of the library Cairo. Now I have the necessity to produce 3d plots (3d radiation pattern of antennas). To realize 3d plots by mean of a 2d library, is not impossible but very hard. A solution could be using gnuplot that I'he yet used to produce high quality 3d plots. The question now is: "How to embed a gnuplot graphic in gtk3? Could you say, please, where to find a simple example, just to undestand how it is possible to do that? Thank you ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list