Proposal: Saving graphs from Qt and wxt terminals

classic Classic list List threaded Threaded
59 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Proposal: Saving graphs from Qt and wxt terminals

Philipp K. Janert

I'd like to drum up support for a feature that I
don't have the prerequisites to implement myself,
but that might not be very difficult to do for
somebody with the right background.

I think it would be wonderful if both current
interactive terminals (Qt and wxt) would allow
the user to "save" the current graph to file in
a range of file formats (basically PNG and PDF).

The way I imagine this would be similar to the
way most (if not all) current GUI applications
handle this action: when the user selects the
corresponding menu entry or presses the button,
a file selection dialog pops up, in which the
user can select/enter the path- and filename
under which to save the graph, and also the
file format. Hit "Ok", and the file is created.

The current "copy to clipboard" function goes
a long way in this direction, but is not perfect.
It introduces a dependency on the clipboard and
how it works (under different window managers),
and may require the user to start another application.
(For instance, I can "paste" from the clipboard
into the Gimp, but I have not found a way to save
directly from clipboard to file - which is what
I really need.)

"Saving a graph" from gnuplot has always been awkward,
and of course there are good and venerable historical
reasons for that. But with the Cairo/wxt/Qt-based
terminals, we are in a position to make this process
so much better - the "copy-to-clipboard" feature
shows what it could be like! All I am suggesting
is an additional dialog that let's the user choose
a filename. I think that would bring gnuplot's behavior
much closer to what users are expecting, given their
experience with other GUI applications.

(The classic, text-based process would continue
to exist, unchanged, for scripting purposes and
fine-grained control.)

But: I can't do it myself. I have never programmed
wxt (and Qt most recently almost 10 years ago) and I
am not going to figure out how to enter this functionality
into gnuplot. (I did take a look at wxt_gui.cpp and
realized quickly that this is beyond me.) But for
someone who knows these libraries, this might not be
that difficult a task: both libs provide complete
widgets for file selection dialog (wxFileDialog and
QFileDialog, resp). Would it be very difficult to
hook them up in the right places?

I think it would make a world of a difference to
people - and do much to dispell the myth that
gnuplot is "hard to learn".

Best,

                Ph.

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Bastian Märkisch
Am 24.10.2014 um 08:18 schrieb Philipp K. Janert:

>
> I'd like to drum up support for a feature that I
> don't have the prerequisites to implement myself,
> but that might not be very difficult to do for
> somebody with the right background.
>
> I think it would be wonderful if both current
> interactive terminals (Qt and wxt) would allow
> the user to "save" the current graph to file in
> a range of file formats (basically PNG and PDF).
>

FYIW, the qt terminal does already have that feature (at least in
version 5), but misses a scripting possibility. This is addressed by
patch #665:
https://sourceforge.net/p/gnuplot/patches/665/

   Bastian

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Petr Mikulik
In reply to this post by Philipp K. Janert
> I think it would be wonderful if both current
> interactive terminals (Qt and wxt) would allow
> the user to "save" the current graph to file in
> a range of file formats (basically PNG and PDF).

This reminds me: there is an undocumented command for printing
the current graph (i.e. for showing a Print(er) dialog):
  screendump
This, however, works for the "windows" terminal only, otherwise
gnuplot says
  screendump not implemented

Currently:
- Windows terminal has icons to:
  - print the graph
  - save it as EMF
- OS/2 pm terminal has menu item for:
  - print the graph
- Qt has a tiny arrow with a menu for:
  - print the graph
  - export the graph to png, svg, image

Some ideas:
- The screendump command could work for Qt as well.
- This command should be documented.
- Cannot wxt have the same export/print icons as Qt?
- Generalize it as "screendump <terminal name>"?

---
PM

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Plotter-2
In reply to this post by Philipp K. Janert
On 10/24/14 08:18, Philipp K. Janert wrote:

>
>
> I'd like to drum up support for a feature that I
> don't have the prerequisites to implement myself,
> but that might not be very difficult to do for
> somebody with the right background.
>
> I think it would be wonderful if both current
> interactive terminals (Qt and wxt) would allow
> the user to "save" the current graph to file in
> a range of file formats (basically PNG and PDF).
>
> The way I imagine this would be similar to the
> way most (if not all) current GUI applications
> handle this action: when the user selects the
> corresponding menu entry or presses the button,
> a file selection dialog pops up, in which the
> user can select/enter the path- and filename
> under which to save the graph, and also the
> file format. Hit "Ok", and the file is created.
>
> The current "copy to clipboard" function goes
> a long way in this direction, but is not perfect.
> It introduces a dependency on the clipboard and
> how it works (under different window managers),
> and may require the user to start another application.
> (For instance, I can "paste" from the clipboard
> into the Gimp, but I have not found a way to save
> directly from clipboard to file - which is what
> I really need.)
>
> "Saving a graph" from gnuplot has always been awkward,
> and of course there are good and venerable historical
> reasons for that. But with the Cairo/wxt/Qt-based
> terminals, we are in a position to make this process
> so much better - the "copy-to-clipboard" feature
> shows what it could be like! All I am suggesting
> is an additional dialog that let's the user choose
> a filename. I think that would bring gnuplot's behavior
> much closer to what users are expecting, given their
> experience with other GUI applications.
>
> (The classic, text-based process would continue
> to exist, unchanged, for scripting purposes and
> fine-grained control.)
>
> But: I can't do it myself. I have never programmed
> wxt (and Qt most recently almost 10 years ago) and I
> am not going to figure out how to enter this functionality
> into gnuplot. (I did take a look at wxt_gui.cpp and
> realized quickly that this is beyond me.) But for
> someone who knows these libraries, this might not be
> that difficult a task: both libs provide complete
> widgets for file selection dialog (wxFileDialog and
> QFileDialog, resp). Would it be very difficult to
> hook them up in the right places?
>
> I think it would make a world of a difference to
> people - and do much to dispell the myth that
> gnuplot is "hard to learn".
>
> Best,
>
> Ph.
>

In principal I agree that there is a need here. Firing up another
program just to use its saveAs dialogue seems suboptimal.

This need arises because the current output of , say the png terminal,
looks very different from the interactive version of graph. I long since
gave up trying to tune the two to be sufficiently similar and use the
clipboard function.

One quick way to do this, which could be a first step without all the
dialogues would be to add a termopt :
eg.
termopt saveDir="/tmp/gnuplot" saveFormat="png"

Default could be `pwd` . I usually save my plots in the same directory
that the data I'm working on is in.

This could then be done with a single click from the interface, with
some default compression parameters for png.

This would be most useful to me. I don't want to have to go through a
metric tonne of option dialogues like gimp does or do battle with the
standard file dialogues that require a lot of clicking if you want to go
anywhere other "my documents".

The gimp solution is full of options if you want to tune everything and
has full saveAs ( sorry that's called 'export' now :? ) capability.

What would be nice in gnuplot is a one line configuration command
entered from a console that allows a one click save afterwards. A simple
text entry for file name is all that is needed. Default to last used
name to overwrite or change.

I agree that both the wx and qt libs would require a steep learning
curve for someone not familiar with them.

The simplest way would be to also specify the file name in termopts.
This would make getting the nuts and bolts of a mechanism in place
relatively simple.



If I had to do something like one console command :
termopt saveDir="/tmp/gnuplot" saveFormat="png" saveFile="test.png"

then a single click interaction on the interactive terminal this would
be significant  time saver for me and would provide a satisfactory
minimalistic  solution.

Error conditions could be reported directly to the console.

Maybe this is something Philipp could achieve without spending weeks in
the bowels of library code.



I don't see any sense in saving  a graphic as PDF. Maybe someone could
say why people do this. AFAIK it justs adds a wrapper around the image
and bloats it.

I can't think what situations would be able to display a PDF that cannot
display a png directly.


Regards. Peter.






------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Allin Cottrell
On Fri, 24 Oct 2014, [hidden email] wrote:

[...]
> I don't see any sense in saving  a graphic as PDF. Maybe someone could
> say why people do this. AFAIK it justs adds a wrapper around the image
> and bloats it.

Not at all. People save plots as PDF because they want them to be scalable
without horrid pixelation, and to exploit the full resolution of the final
output device (e.g. a 2400 dpi printer). For this purpose you want a
vector format -- PDF, EPS or SVG -- not a bitmap.

Allin Cottrell

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

sfeam
In reply to this post by Plotter-2

On Friday, 24 October 2014 10:24:50 AM [hidden email] wrote:

 

> In principal I agree that there is a need here. Firing up another

> program just to use its saveAs dialogue seems suboptimal.

 

It's quite painless in practice. Try this:

 

set term png

set output "|display png:-"

plot $whatever

 

# plot will appear on your screen.

# if you like it and want to save it, then

 

set output 'itsakeeper.png'

replot

 

 

I use the "display" command from ImageMagick, but if you prefer some

other viewer you can substitute the display command as appropriate.

 

Ethan

 

 

 

> This need arises because the current output of , say the png terminal,

> looks very different from the interactive version of graph. I long since

> gave up trying to tune the two to be sufficiently similar and use the

> clipboard function.

>

> One quick way to do this, which could be a first step without all the

> dialogues would be to add a termopt :

> eg.

> termopt saveDir="/tmp/gnuplot" saveFormat="png"

>

> Default could be `pwd` . I usually save my plots in the same directory

> that the data I'm working on is in.

>

> This could then be done with a single click from the interface, with

> some default compression parameters for png.

>

> This would be most useful to me. I don't want to have to go through a

> metric tonne of option dialogues like gimp does or do battle with the

> standard file dialogues that require a lot of clicking if you want to go

> anywhere other "my documents".

>

> The gimp solution is full of options if you want to tune everything and

> has full saveAs ( sorry that's called 'export' now :? ) capability.

>

> What would be nice in gnuplot is a one line configuration command

> entered from a console that allows a one click save afterwards. A simple

> text entry for file name is all that is needed. Default to last used

> name to overwrite or change.

>

> I agree that both the wx and qt libs would require a steep learning

> curve for someone not familiar with them.

>

> The simplest way would be to also specify the file name in termopts.

> This would make getting the nuts and bolts of a mechanism in place

> relatively simple.

>

>

>

> If I had to do something like one console command :

> termopt saveDir="/tmp/gnuplot" saveFormat="png" saveFile="test.png"

>

> then a single click interaction on the interactive terminal this would

> be significant time saver for me and would provide a satisfactory

> minimalistic solution.

>

> Error conditions could be reported directly to the console.

>

> Maybe this is something Philipp could achieve without spending weeks in

> the bowels of library code.

>

>

>

> I don't see any sense in saving a graphic as PDF. Maybe someone could

> say why people do this. AFAIK it justs adds a wrapper around the image

> and bloats it.

>

> I can't think what situations would be able to display a PDF that cannot

> display a png directly.

>

>

> Regards. Peter.

>

>

>

>

>

>

> ------------------------------------------------------------------------------

> _______________________________________________

> gnuplot-beta mailing list

> [hidden email]

> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

 


------------------------------------------------------------------------------

_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Philipp K. Janert
In reply to this post by Plotter-2

[snip]

>
> I don't see any sense in saving  a graphic as PDF. Maybe someone
> could say why people do this. AFAIK it justs adds a wrapper around
> the image and bloats it.
>
> I can't think what situations would be able to display a PDF that
> cannot display a png directly.
>

Because PDF is a vector format, in the same
way that Postscript is! Whenever there is a
need to scale a graph, you need a vector format.

Postscript is (increasingly) becoming a niche
format, and PDF is taking its place as print-quality
vector format.


------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Philipp K. Janert
In reply to this post by sfeam
On Fri, 24 Oct 2014 08:58:31 -0700
sfeam <[hidden email]> wrote:

> On Friday, 24 October 2014 10:24:50 AM [hidden email] wrote:
>
> > In principal I agree that there is a need here. Firing up another
> > program just to use its saveAs dialogue seems suboptimal.
>
> It's quite painless in practice.  Try this:

Well, it appears painless because we gnuplot users
have been used to jumping through these hoops
for the last 25 years! Try explaining it to
someone NEW to gnuplot and then watch their
reaction. Would we really design it the way it
is, if we starting over today?

I want to make sure my motivation is understood:
obviously, graphs can be saved from gnuplot. But
the way it's done is unnecessarily cumbersome and
not in line with current-day expectations.

I also don't suggest to replace the standard,
command-based process.

Instead, my suggestion really boils down to this:
given that there already is the "copy-to-clipboard"
function, can we extend it and have it copy to a
file, instead of the clipboard?

>
> set term png
> set output "|display png:-"
> plot $whatever
>
> # plot will appear on your screen.
> # if you like it and want to save it, then
>
> set output 'itsakeeper.png'
> replot
>
>
> I use the "display" command from ImageMagick, but if you prefer some
> other viewer you can substitute the display command as appropriate.
>
> Ethan
>
>

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Philipp K. Janert
In reply to this post by Plotter-2

[snip]

> This need arises because the current output of , say the png
> terminal, looks very different from the interactive version of graph.
> I long since gave up trying to tune the two to be sufficiently
> similar and use the clipboard function.

That was actually not the reason for my suggestion
at all. I am not trying to solve the problem that
graphs made by the gd-lib png terminal look different
from the ones made by the wxt terminal.

My motivation is "ease of use", in a GUI-spirit:
click the "save" button, and gnuplot does what
every other GUI application does when you hit
the "save" button. Namely, offer a file dialog,
and save to file.

>
> One quick way to do this, which could be a first step without all the
> dialogues would be to add a termopt :
> eg.
> termopt saveDir="/tmp/gnuplot" saveFormat="png"

Yes, I agree, I have toyed with the idea of adding
a command, let's call it "export" (to distinguish it
from "save", which saves commands) that would accept
a terminal type and a filename as arguments and do
all of the required steps (including reinstating the
interactive terminal to its previous settings), like so:

export "graph.png" pngcairo

One could even supply addtl options, and pass them on
to the selected terminal. As you said, I'd be capable
of putting that together, and maybe I will (one day).

[snip]

>
> This would be most useful to me. I don't want to have to go through a
> metric tonne of option dialogues like gimp does or do battle with the
> standard file dialogues that require a lot of clicking if you want to
> go anywhere other "my documents".

Keep in mind that I am not necessarily thinking of
the power-user in power-mode. I am thinking of the
occasional user, or a power-user who "just wants to
save this graph". Different use case, equally valid.

>
> What would be nice in gnuplot is a one line configuration command
> entered from a console that allows a one click save afterwards. A
> simple text entry for file name is all that is needed. Default to
> last used name to overwrite or change.

[snip]
 
> If I had to do something like one console command :
> termopt saveDir="/tmp/gnuplot" saveFormat="png" saveFile="test.png"
>
> then a single click interaction on the interactive terminal this
> would be significant  time saver for me and would provide a
> satisfactory minimalistic  solution.

That's still a two-step process. Why not roll it all into
one?

In any case, I think having such functionality would be
goodness. Nevertheless, I think it would make sense to
also have a proper, GUI-style way of saving a graph -
in particular since we are already 3/4 of the way there
(with the clipboard feature).

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Plotter-2
In reply to this post by Allin Cottrell
On 10/24/14 17:45, Allin Cottrell wrote:

>
> On Fri, 24 Oct 2014, [hidden email] wrote:
>
> [...]
>> I don't see any sense in saving  a graphic as PDF. Maybe someone could
>> say why people do this. AFAIK it justs adds a wrapper around the image
>> and bloats it.
>
> Not at all. People save plots as PDF because they want them to be
> scalable without horrid pixelation, and to exploit the full resolution
> of the final output device (e.g. a 2400 dpi printer). For this purpose
> you want a vector format -- PDF, EPS or SVG -- not a bitmap.
>
> Allin Cottrell
>

Thanks,  that is the point of pdf terminal. I make quite a bit of use of
SVG myself.  I do not think this makes sense for clipboard copy of
interactive terminals.which is necessarily a bitmap.

Peter.



------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Philipp K. Janert
In reply to this post by Bastian Märkisch
On Fri, 24 Oct 2014 08:55:49 +0200
Bastian Märkisch <[hidden email]> wrote:

> Am 24.10.2014 um 08:18 schrieb Philipp K. Janert:
> >
> > I'd like to drum up support for a feature that I
> > don't have the prerequisites to implement myself,
> > but that might not be very difficult to do for
> > somebody with the right background.
> >
> > I think it would be wonderful if both current
> > interactive terminals (Qt and wxt) would allow
> > the user to "save" the current graph to file in
> > a range of file formats (basically PNG and PDF).
> >
>
> FYIW, the qt terminal does already have that feature (at least in
> version 5), but misses a scripting possibility. This is addressed by
> patch #665:
> https://sourceforge.net/p/gnuplot/patches/665/
>

Thanks for the reminder; I need to check this out
again. (Qt does not work for me (see previous
string on this list!), so I need to find another
installation to take a look.)

>    Bastian


------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

sfeam
In reply to this post by Petr Mikulik
On Friday, 24 October, 2014 09:10:51 Petr Mikulik wrote:

> > I think it would be wonderful if both current
> > interactive terminals (Qt and wxt) would allow
> > the user to "save" the current graph to file in
> > a range of file formats (basically PNG and PDF).
>
> This reminds me: there is an undocumented command for printing
> the current graph (i.e. for showing a Print(er) dialog):
>   screendump
> This, however, works for the "windows" terminal only, otherwise
> gnuplot says
>   screendump not implemented
>
> Currently:
> - Windows terminal has icons to:
>   - print the graph
>   - save it as EMF
> - OS/2 pm terminal has menu item for:
>   - print the graph
> - Qt has a tiny arrow with a menu for:
>   - print the graph
>   - export the graph to png, svg, image
>
> Some ideas:
> - The screendump command could work for Qt as well.

How would this be different from the existing qt->png output?

> - This command should be documented.
> - Cannot wxt have the same export/print icons as Qt?

The Qt library provides conversion routines for png, pdf, and svg.

I am not so familiar with the wxt library, but so far as I can see from the
available routines the closest equivalent would end up doing exactly the
same thing as "set term pngcairo; replot" for png output.
Same for pdf ouput.
We don't have a svgcairo terminal, however.

> - Generalize it as "screendump <terminal name>"?

Wouldn't that be "screendump 'filename'"?

        Ethan

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Daniel J Sebald
In reply to this post by Philipp K. Janert
On 10/24/2014 01:18 AM, Philipp K. Janert wrote:

>
> I'd like to drum up support for a feature that I
> don't have the prerequisites to implement myself,
> but that might not be very difficult to do for
> somebody with the right background.
>
> I think it would be wonderful if both current
> interactive terminals (Qt and wxt) would allow
> the user to "save" the current graph to file in
> a range of file formats (basically PNG and PDF).
>
> The way I imagine this would be similar to the
> way most (if not all) current GUI applications
> handle this action: when the user selects the
> corresponding menu entry or presses the button,
> a file selection dialog pops up, in which the
> user can select/enter the path- and filename
> under which to save the graph, and also the
> file format. Hit "Ok", and the file is created.

I just compiled gnuplot for WXT...  It looks like wxWidgets terminal is
quite similar to Qt and it shouldn't be too difficult to make them
consistent.  One would need to use the GUI features that come with the
library and wxWidgets has a file dialog:

http://docs.wxwidgets.org/3.0/classwx_file_dialog.html

So that part is easy.  I'd say that perhaps some thought should be put
into what the desired layout is though--agreeing on that is probably the
difficult part.

I consider x11 interactive and a few years ago I wrote a patch to
enhance the clipboard for that terminal.  What I recall of X11 is that
the format saved to clipboard wasn't really decided until the calling
program wanted to paste, at which point the X11 term would provide the
suitable format.  Anyway, I had programmed the shortcut keys Cntrl-A to
highlight the graph with the typical bluish tint and Cntrl-C to paste to
the clipboard.  The point was to make working with the terminal much
more fluent.

One thing to be careful of is the fact that saving to PDF (which is
certainly welcome in my opinion because the first word of PDF means
"portable") in the Qt terminal isn't using the PDF terminal.  There are
no colors in the PDF output via Qt, whereas the PDF terminal creates a
PDF output with colors.  Do we want as setup in which the interactive
terminals use the PDF terminal, or a setup in which the interactive
terminals use their own custom PDF output?

Some other comments:

Right now, WXT is not copying anything to clipboard.  While the Qt
terminal copies so that the plot image appears in a WYSIWYG word
processor, WXT terminal doesn't create anything.

Also the WXT terminal has a fixed aspect ratio where Qt terminal does not.

The aspect ratio for WXT (and PDF terminal output) seems much more
wide/flat than it used to.

The default pen color is now magenta where for years it was red.  Was
that change intentional?

Dan

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

sfeam
On Friday, 24 October, 2014 15:17:01 Daniel J Sebald wrote:

> On 10/24/2014 01:18 AM, Philipp K. Janert wrote:
> >
> > I'd like to drum up support for a feature that I
> > don't have the prerequisites to implement myself,
> > but that might not be very difficult to do for
> > somebody with the right background.
> >
> > I think it would be wonderful if both current
> > interactive terminals (Qt and wxt) would allow
> > the user to "save" the current graph to file in
> > a range of file formats (basically PNG and PDF).
> >
> > The way I imagine this would be similar to the
> > way most (if not all) current GUI applications
> > handle this action: when the user selects the
> > corresponding menu entry or presses the button,
> > a file selection dialog pops up, in which the
> > user can select/enter the path- and filename
> > under which to save the graph, and also the
> > file format. Hit "Ok", and the file is created.
>
> I just compiled gnuplot for WXT...  It looks like wxWidgets terminal is
> quite similar to Qt and it shouldn't be too difficult to make them
> consistent.  One would need to use the GUI features that come with the
> library and wxWidgets has a file dialog:
>
> http://docs.wxwidgets.org/3.0/classwx_file_dialog.html
>
> So that part is easy.  I'd say that perhaps some thought should be put
> into what the desired layout is though--agreeing on that is probably the
> difficult part.
>
> I consider x11 interactive and a few years ago I wrote a patch to
> enhance the clipboard for that terminal.  What I recall of X11 is that
> the format saved to clipboard wasn't really decided until the calling
> program wanted to paste, at which point the X11 term would provide the
> suitable format.  Anyway, I had programmed the shortcut keys Cntrl-A to
> highlight the graph with the typical bluish tint and Cntrl-C to paste to
> the clipboard.  The point was to make working with the terminal much
> more fluent.
>
> One thing to be careful of is the fact that saving to PDF (which is
> certainly welcome in my opinion because the first word of PDF means
> "portable") in the Qt terminal isn't using the PDF terminal.  There are
> no colors in the PDF output via Qt, whereas the PDF terminal creates a
> PDF output with colors.  Do we want as setup in which the interactive
> terminals use the PDF terminal, or a setup in which the interactive
> terminals use their own custom PDF output?
>
> Some other comments:
>
> Right now, WXT is not copying anything to clipboard.

Works fine here.  Full color full resolution bitmap is sent to clipboard.
Ctrl-V in GIMP or soffice  pastes it into an open document or canvas.

> While the Qt
> terminal copies so that the plot image appears in a WYSIWYG word
> processor, WXT terminal doesn't create anything.

[shrug] works fine for me.

> Also the WXT terminal has a fixed aspect ratio where Qt terminal does not.

Again not true here.   The copy/paste is just a bitmap of whatever the
current display shows.  You can change the aspect ratio to anything
you like either with "set term wxt size XX,YY"  or by resizing the open
window with the mouse.

> The default pen color is now magenta where for years it was red.  Was
> that change intentional?

Very much so.
See, e.g. current lead story on lwn.net
"Accessibility and the graphics stack" (may not be accessible to
non-subscribers until next week)
        http://lwn.net/Articles/617594/

Or see "help set colors" in version 5rc2 or current cvs.

        Ethan

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

sfeam
In reply to this post by Daniel J Sebald

On Friday, 24 October, 2014 15:17:01 Daniel J Sebald wrote:

>

> One thing to be careful of is the fact that saving to PDF (which is 

> certainly welcome in my opinion because the first word of PDF means 

> "portable") in the Qt terminal isn't using the PDF terminal.  There are 

> no colors in the PDF output via Qt

 

Weird. I get a perfectly normal full-color PDF.

 

> Do we want as setup in which the interactive  terminals use the

> PDF terminal, or a setup in which the interactive  terminals use their

> own custom PDF output?

 

I have been thinking that it would be nice to have build options for

two flavors of gnuplot.

 

gnuplot+Qt

no dependence on cairo or wxt

svg pdf png output via the Qt libraries

default terminal is qt

 

gnuplot+wxt

no dependence on Qt libraries

pdf png output via cairo (can it do svg?)

default terminal is wxt

 

Either of these options could also do away with dependence on libgd,

so long as people can live without gif/jpeg output.

 

Given that it looks like wxt3 is causing problems for people who are

building on bleeding edge linux systems (or building on OSX),

the qt-only build option could become important.

 

Ethan


------------------------------------------------------------------------------

_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Philipp K. Janert
In reply to this post by sfeam

[snip]

> > Some other comments:
> >
> > Right now, WXT is not copying anything to clipboard.
>
> Works fine here.  Full color full resolution bitmap is sent to
> clipboard. Ctrl-V in GIMP or soffice  pastes it into an open document
> or canvas.

I can confirm that. It works for me as well,
full-color etc.

>
> > While the Qt
> > terminal copies so that the plot image appears in a WYSIWYG word
> > processor, WXT terminal doesn't create anything.
>
> [shrug] works fine for me.

Again, it works for me, but I did notice that
the graph, while on the clipboard, did now show
up in klipper or parcellite - they always showed
"empty clipboard". Since I am not too familiar
with either application, I may not fully understand
what to expect.

>
> > Also the WXT terminal has a fixed aspect ratio where Qt terminal
> > does not.
>
> Again not true here.   The copy/paste is just a bitmap of whatever the
> current display shows.  You can change the aspect ratio to anything
> you like either with "set term wxt size XX,YY"  or by resizing the
> open window with the mouse.
>
> > The default pen color is now magenta where for years it was red.
> > Was that change intentional?
>
> Very much so.
> See, e.g. current lead story on lwn.net
> "Accessibility and the graphics stack" (may not be accessible to
> non-subscribers until next week)
> http://lwn.net/Articles/617594/
>
> Or see "help set colors" in version 5rc2 or current cvs.
>
> Ethan


------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Philipp K. Janert
In reply to this post by Philipp K. Janert

[snip]

>
> One thing to be careful of is the fact that saving to PDF (which is
> certainly welcome in my opinion because the first word of PDF means
> "portable") in the Qt terminal isn't using the PDF terminal.  There
> are no colors in the PDF output via Qt, whereas the PDF terminal
> creates a PDF output with colors.  Do we want as setup in which the
> interactive terminals use the PDF terminal, or a setup in which the
> interactive terminals use their own custom PDF output?

I thought one could use the native APIs of the
rendering library to handle the transformation
to the desired graphics format (in the spirit
of pngcairo and pdfcairo - both rendered, similarly,
using the same lib). I think Qt can do that, too.

Best,

                Ph.


------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Daniel J Sebald
In reply to this post by sfeam
On 10/24/2014 05:04 PM, Ethan A Merritt wrote:

> On Friday, 24 October, 2014 15:17:01 Daniel J Sebald wrote:
>> On 10/24/2014 01:18 AM, Philipp K. Janert wrote:
>>>
>>> I'd like to drum up support for a feature that I
>>> don't have the prerequisites to implement myself,
>>> but that might not be very difficult to do for
>>> somebody with the right background.
>>>
>>> I think it would be wonderful if both current
>>> interactive terminals (Qt and wxt) would allow
>>> the user to "save" the current graph to file in
>>> a range of file formats (basically PNG and PDF).
>>>
>>> The way I imagine this would be similar to the
>>> way most (if not all) current GUI applications
>>> handle this action: when the user selects the
>>> corresponding menu entry or presses the button,
>>> a file selection dialog pops up, in which the
>>> user can select/enter the path- and filename
>>> under which to save the graph, and also the
>>> file format. Hit "Ok", and the file is created.
>>
>> I just compiled gnuplot for WXT...  It looks like wxWidgets terminal is
>> quite similar to Qt and it shouldn't be too difficult to make them
>> consistent.  One would need to use the GUI features that come with the
>> library and wxWidgets has a file dialog:
>>
>> http://docs.wxwidgets.org/3.0/classwx_file_dialog.html
>>
>> So that part is easy.  I'd say that perhaps some thought should be put
>> into what the desired layout is though--agreeing on that is probably the
>> difficult part.
>>
>> I consider x11 interactive and a few years ago I wrote a patch to
>> enhance the clipboard for that terminal.  What I recall of X11 is that
>> the format saved to clipboard wasn't really decided until the calling
>> program wanted to paste, at which point the X11 term would provide the
>> suitable format.  Anyway, I had programmed the shortcut keys Cntrl-A to
>> highlight the graph with the typical bluish tint and Cntrl-C to paste to
>> the clipboard.  The point was to make working with the terminal much
>> more fluent.
>>
>> One thing to be careful of is the fact that saving to PDF (which is
>> certainly welcome in my opinion because the first word of PDF means
>> "portable") in the Qt terminal isn't using the PDF terminal.  There are
>> no colors in the PDF output via Qt, whereas the PDF terminal creates a
>> PDF output with colors.  Do we want as setup in which the interactive
>> terminals use the PDF terminal, or a setup in which the interactive
>> terminals use their own custom PDF output?
>>
>> Some other comments:
>>
>> Right now, WXT is not copying anything to clipboard.
>
> Works fine here.  Full color full resolution bitmap is sent to clipboard.
> Ctrl-V in GIMP or soffice  pastes it into an open document or canvas.
>
>> While the Qt
>> terminal copies so that the plot image appears in a WYSIWYG word
>> processor, WXT terminal doesn't create anything.
>
> [shrug] works fine for me.
OK.  WXT Copy/Paste works for GIMP, but not for oowriter.  Qt Copy/Paste
works for both GIMP and oowriter.  Maybe it is oowriter with an issue;
I'll investigate a bit.


>> Also the WXT terminal has a fixed aspect ratio where Qt terminal does not.
>
> Again not true here.   The copy/paste is just a bitmap of whatever the
> current display shows.  You can change the aspect ratio to anything
> you like either with "set term wxt size XX,YY"  or by resizing the open
> window with the mouse.

When resizing the window, I'm seeing the plot change size but using the
maximum size that fits within whatever is the minimum axis that
maintains aspect ratio.  The rest of the screen is then grey.  I've
attached a small screenshot.


>> The default pen color is now magenta where for years it was red.  Was
>> that change intentional?
>
> Very much so.
> See, e.g. current lead story on lwn.net
> "Accessibility and the graphics stack" (may not be accessible to
> non-subscribers until next week)
> http://lwn.net/Articles/617594/
>
> Or see "help set colors" in version 5rc2 or current cvs.
All right.  I remember the color discussion about a half year back now.

Dan

------------------------------------------------------------------------------

_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Screenshot-Gnuplot (window id : 0).png (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

Daniel J Sebald
In reply to this post by sfeam
On 10/24/2014 05:19 PM, Ethan A Merritt wrote:

> On Friday, 24 October, 2014 15:17:01 Daniel J Sebald wrote:
>
>>
>
>>  One thing to be careful of is the fact that saving to PDF (which is
>
>>  certainly welcome in my opinion because the first word of PDF means
>
>>  "portable") in the Qt terminal isn't using the PDF terminal.  There are
>
>>  no colors in the PDF output via Qt
>
> Weird. I get a perfectly normal full-color PDF.

The color is working for me now.  I'm not sure what happened.  It could
have been some bad interaction from me messing around with multiple
terminals in the same session...


>>  Do we want as setup in which the interactive  terminals use the
>
>>  PDF terminal, or a setup in which the interactive  terminals use their
>
>>  own custom PDF output?
>
> I have been thinking that it would be nice to have build options for
>
> two flavors of gnuplot.
>
> gnuplot+Qt
>
> no dependence on cairo or wxt
>
> svg pdf png output via the Qt libraries
>
> default terminal is qt
>
> gnuplot+wxt
>
> no dependence on Qt libraries
>
> pdf png output via cairo (can it do svg?)
>
> default terminal is wxt
>
> Either of these options could also do away with dependence on libgd,
>
> so long as people can live without gif/jpeg output.

I doubt that one.  There would likely be complaints.


> Given that it looks like wxt3 is causing problems for people who are
>
> building on bleeding edge linux systems (or building on OSX),
>
> the qt-only build option could become important.

Build options are fine by me, given it is the interactive terminal in
question.  But the default should still include all decent terminals.

I notice that gnuplot doesn't allow wxt and Qt in the same session.
What is the issue there?  I see this:

/* The qt and wxt terminals cannot be used in the same session. */
/* Whichever one is used first to plot, this locks out the other. */
void *term_interlock = NULL;

I suppose shutting down the existing external program with a terminal
change isn't the most graceful because it closes plot windows.  On the
other hand, neither is having to exit the program to switch the terminal
very elegant--plus doing so would close all existing windows, what is
apparently to be avoided.

Dan

------------------------------------------------------------------------------
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Saving graphs from Qt and wxt terminals

sfeam
In reply to this post by Daniel J Sebald

On Saturday, 25 October 2014 12:01:57 AM Daniel J Sebald wrote:

> On 10/24/2014 05:04 PM, Ethan A Merritt wrote:

> > On Friday, 24 October, 2014 15:17:01 Daniel J Sebald wrote:

> >> Also the WXT terminal has a fixed aspect ratio where Qt terminal does not.

> >

> > Again not true here. The copy/paste is just a bitmap of whatever the

> > current display shows. You can change the aspect ratio to anything

> > you like either with "set term wxt size XX,YY" or by resizing the open

> > window with the mouse.

>

> When resizing the window, I'm seeing the plot change size but using the

> maximum size that fits within whatever is the minimum axis that

> maintains aspect ratio. The rest of the screen is then grey. I've

> attached a small screenshot.

 

Ah, I understand.

See Feature Request #314

 

The new aspect ratio isn't applied until the next replot.

The qt terminal has a tool widget to toggle whether you

want this to happen automatically. The wxt should have one also.

Patches welcome.

 

Ethan

 


------------------------------------------------------------------------------

_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
123