Publishing with Octave

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

Publishing with Octave

proxima434
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Publishing with Octave

siko1056
On Fri, 8 Feb 2019, 22:49 proxima434 <[hidden email] wrote:
Hello there,

I would like to publish a script to html using the publishing function.

I have two userinterfaces in my script. In the first GUI you can choose the
machine and in the second GUI

you have multiple plotting options ( for e.g. time vs. speed or time vs.
torque ).

I would like to publish the script including all the plots.

The problem is that the funcion publish('filename') only creates a html
including the current figure.

Is it possible to publish the skript to a html that includes several plots ?

I´m new to programming so I would be grateful for detailed instructions.



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Was it possible to provide a minimal example of the script you would like to publish? This would help me a lot to get a better understanding of the problem.

A generic trick is to call "figure" when starting a new plot.

In contrast to MATLAB, Octaves implementation of publish has problems when creating plots over multiple code sections, interrupted by text markup.  For example try to avoid something like this:

   %%
   % Plot a sine

  figure ();
  plot (0:.2:2*pi, sin(0:.2:2*pi));

  %%
  % and label it

  title ("A sine plot");

Best, 
Kai




Reply | Threaded
Open this post in threaded view
|

Re: Publishing with Octave

proxima434
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Publishing with Octave

siko1056
On Mon, Feb 11, 2019 at 7:06 AM proxima434 <[hidden email]> wrote:
Hello Kai,

here is some more information. (This is just a samplescript of course..)

<http://octave.1599824.n4.nabble.com/file/t373195/1.png>

<http://octave.1599824.n4.nabble.com/file/t373195/2.png>

so I get the html report that I want. The problem though is that I don´t get
the Diagrams in the report-html as soon as I have more than one plot in the
script.


regards,
Alex


Hi Alex,

From what I see in your attached picture listing is that you have a pure script file. There is no publishing markup, thus only pictures are generated. Unfortunately, I cannot run png-files in Octave to check the output myself ;-)

Maybe you take a look at [1] to see from the small examples how publish is intended to be used.  At least to me it is not obvious to use publish for generating a few pictures in your case.

Are you searching for a way to save the generated plots by your tool?

Try

switch (c)
  case 2
   % plot1 commands
   print -dpng "plot1.png"
  case 3
   % plot2 commands
   print -dpng "plot2.png"
  ...

Best,
Kai



Reply | Threaded
Open this post in threaded view
|

Re: Publishing with Octave

proxima434
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Publishing with Octave

siko1056
On Mon, Feb 11, 2019 at 10:40 AM proxima434 <[hidden email]> wrote:
Hi Kai,

thanks a lot for your help !

My target is to create a condition monitoring report.

The company I work for produces machines for foilproduction and I´d like to
create a html-report

including the most important diagrams.

So for eg.: I get the data from one customer than run the script and get my
report.

After that I can load the data of a different customer, run the script and
again get my report with the

most important diagrams like time vs. speed or time vs. torque...

I use more of the publishing markup in the real script. I also thought about
using the print command but

I don´t know how to include the created pngs in the html.

So basically I need a way to publish the script including all the plots not
only the last one opened.


regards,
Alex


Alright, I think to understand the situation better now.  First, if you are using Octave 4.4.1, I suggest to replace the publish.m file by the latest version [1], which will run in 4.4.1 perfectly.
You find the current location of publish by typing "which publish" and then replace that file with [1].  I overhauled that file recently and works more reliable now.

Then you have to modify the script to be publish, such that the following conditions are met:

1) All relevant actions for a particular plot have to happen within a single code cell.  They may not be split by text sections "%%"
2) If you generate multiple plots within a single code cell (for example by a loop), make sure, that in a script all of those plots are kept open.  Use figure() to create a new plot window.
3) You should not call publish at the end of the script.  There is a danger of recursive calls.

I hope to present a minimal example with the attached file pub_tst.m.  Note that is is also allowed to call other scripts or functions from each code cell, so don't be too focused on just a single script to publish.  Call proper subroutines or functions to help you with the export.

Best,
Kai




pub_tst.m (442 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Publishing with Octave

proxima434
CONTENTS DELETED
The author has deleted this message.