gset term & octave

View: New views
6 Messages — Rating Filter:   Alert me  

gset term & octave

by mbn () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

I am trying to generate png image from a plot in Octave.

My environment is the following (Linux):

===========================
$ octave -v
GNU Octave, version 2.1.57

$ gnuplot --version
gnuplot 4.0 patchlevel 0

===========================


When I use gset term, I get random garbage (with or without ; at the end is the same):


===========================
octave:1> gset term png
PNG

IHDR,Vs[aO`)PLTE   @@nn@@nn  @@ @ @@`@@`@`@0``@@@@````@`c0@@@` @`@`@ ` ```    
...


octave:2> gset output 'myfile.png'
===========================

At the end, the image is generated but why am I getting all that garbage? I have tried that in several Linux boxes (RedHat) and I always receive the same error.

How can I solve that?

Thanks in advance

gset term & octave

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10-Mar-2008, mbn wrote:

| I am trying to generate png image from a plot in Octave.
|
| My environment is the following (Linux):
|
| ===========================
| $ octave -v
| GNU Octave, version 2.1.57

That version is more than four years old now, and was just a
development snapshot anyway.  I strongly encourage you to upgrade to
the latest stable release, version 3.0.0.  With 3.0.0, you can use

  print -dpng myfile.png

to create a png file of the current plot (assuming your version of
gnuplot has been compiled so that it can generate PNG files).

jwe


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: gset term & octave

by Javier Arantegui-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

On 3/10/08, John W. Eaton <jwe@...> wrote:
> With 3.0.0, you can use
>
> print -dpng myfile.png
>
> to create a png file of the current plot (assuming your version of
> gnuplot has been compiled so that it can generate PNG files).

I know that I'm not the smartest member of the list, and maybe I'm the
only one who finds this confusing. Honestly I haven't read all the
documentation, and surely that's my problem.

When you type "help print" in Octave or read the available
documentation of print
(http://www.gnu.org/software/octave/doc/interpreter/Printing-Plots.html#Printing-Plots),
you get:


— Function File: print (filename, options)

Print a graph, or save it to a file
filename defines the file name of the output file. If no filename is
specified, output is sent to the printer.
options:
-Pprinter
 Set the printer name to which the graph is sent if no filename is specified.
-color
etc.


I though that the correct syntax was something like this:

print (test.fig, -dfig -color)

I believed that print was a sort of function. Obviously it didn't work.

Maybe it would be better to use the man approach to this, like in this
example (man ls):


NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...


I think that this is clearer for newbies.

Javier


--
Lee mi blog: "Un pequeño paso para Neil" http://up3n.wordpress.com/

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: gset term & octave

by Thomas Weber-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Am Donnerstag, den 13.03.2008, 11:34 +0100 schrieb Javier Arantegui:

> Hello,
>
> On 3/10/08, John W. Eaton <jwe@...> wrote:
> > With 3.0.0, you can use
> >
> > print -dpng myfile.png
> >
> > to create a png file of the current plot (assuming your version of
> > gnuplot has been compiled so that it can generate PNG files).
>
> I know that I'm not the smartest member of the list, and maybe I'm the
> only one who finds this confusing. Honestly I haven't read all the
> documentation, and surely that's my problem.
>
> When you type "help print" in Octave or read the available
> documentation of print
> (http://www.gnu.org/software/octave/doc/interpreter/Printing-Plots.html#Printing-Plots),
> you get:
>
>
> — Function File: print (filename, options)
>
> Print a graph, or save it to a file
> filename defines the file name of the output file. If no filename is
> specified, output is sent to the printer.
> options:
> -Pprinter
>  Set the printer name to which the graph is sent if no filename is specified.
> -color
> etc.
>
>
> I though that the correct syntax was something like this:
>
> print (test.fig, -dfig -color)

This will work, if you put your arguments as strings:
        print('test.fig', '-dfig', '-color')
The part about the string should be clear, as color, dfig and so on
might be variable names. The comma in the second argument list is
probably not that clear.


> I think that this is clearer for newbies.

I'd actually say an example would be more helpful.

        Thomas

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: gset term & octave

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 13-Mar-2008, Thomas Weber wrote:

| > I think that this is clearer for newbies.
|
| I'd actually say an example would be more helpful.

I can't promise to accept them, but all patches are certainly
considered for inclusion in future versions...

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: gset term & octave

by mbn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This sort of "fixed" my problem:

  gset term x11
  gset output "/dev/null"

....

  gset term png;
  eval(sprintf('gset output \"%s.png\"',file_name_prefix));

The garbage is not shown anymore.

However, is annoying to specify X11 at the begining because I get a window with a plot that appears and dissapears quickly before I am able to set the terminal to png and save the plot.

Can somebody suggest a way to do this without the X11 window being shown with the plot?

Thanks in advance.


P.S. I also tried without setting the terminal to X11 and priting directly to the PNG but I see in the resulting .png only one of the series I try to plot and not the others (although after looking at the size of the file I think they are somehow there). Why could this be happening?



mbn wrote:
Hello

I am trying to generate png image from a plot in Octave.

My environment is the following (Linux):

===========================
$ octave -v
GNU Octave, version 2.1.57

$ gnuplot --version
gnuplot 4.0 patchlevel 0

===========================


When I use gset term, I get random garbage (with or without ; at the end is the same):


===========================
octave:1> gset term png
PNG

IHDR,Vs[aO`)PLTE   @@nn@@nn  @@ @ @@`@@`@`@0``@@@@````@`c0@@@` @`@`@ ` ```    
...


octave:2> gset output 'myfile.png'
===========================

At the end, the image is generated but why am I getting all that garbage? I have tried that in several Linux boxes (RedHat) and I always receive the same error.

How can I solve that?

Thanks in advance