Menu

#209 Add --outbuf for panplot command

None
closed
nobody
None
4
2024-05-21
2024-02-22
No

Currently, the panplot command does not support the --outbuf option. Thus, one cannot create panel-plots using the new gridplot framework. Here is the documentation:

https://gretl.sourceforge.net/gretl-help/cmdref.html#panplot

Having this feature would be useful of one works with panel data.

Thank you
Artur

Discussion

  • Sven Schreiber

    Sven Schreiber - 2024-02-22

    Sorry, Artur, it's not true that gridplot cannot be used. That's why the gpbuild ... end gpbuild variant exists.

     
    👍
    1
  • Artur Tarassow

    Artur Tarassow - 2024-02-22

    Good point, Sven! What you have in mind is:

    set verbose off
    open grunfeld -q
    
    list L = invest value
    
    gpbuild Plots
        panplot invest --overlay
        panplot value --overlay
    end gpbuild
    
    gridplot Plots --output=display
    

    And that, indeed, works.

    Ok, I should re-specify what I ask for. The use-case is that one writes a function where you pass a list of k variables and one loops over that list to collects panel-plots. This array is then passed to the gridplot command.

    Using gpbuild requires to specify explicitly your commands for each series.

     
  • Artur Tarassow

    Artur Tarassow - 2024-02-22

    I just saw that the boxplot command also does not support the --outbuf option:
    https://gretl.sourceforge.net/gretl-help/cmdref.html#boxplot

     
    • Sven Schreiber

      Sven Schreiber - 2024-02-22

      Yes, there are many commands that do not. This whole issue was discussed when introducing gridplot and so on. Here's what I believe is the recommended solution:

      set verbose off
      open grunfeld -q
      
      list L = invest value
      strings ps = array(nelem(L))
      
      loop foreach i L
          panplot $i --overlay --output="mytemp$i.plt"
          ps[i] = readfile("mytemp$i.plt")
      endloop 
      
      gridplot ps --output=display
      
       
      👍
      1
      • Artur Tarassow

        Artur Tarassow - 2024-02-22

        Very nice. That works! Thank you.

        Question: Shall we close the ticket? But then this circumvention should be documented, I think.

         
  • Allin Cottrell

    Allin Cottrell - 2024-02-22

    boxplot has supported the outbuf option for some time now (though that's not stated in the help text). panplot was supposed to support outbuf but was not actually hooked up to do so; that's now fixed in git.

     
    👍
    1
    • Artur Tarassow

      Artur Tarassow - 2024-02-23

      Thank you, Allin!

       
  • Sven Schreiber

    Sven Schreiber - 2024-02-22

    So is the idea now to have --outbuf available for every relevant command?

     
  • Sven Schreiber

    Sven Schreiber - 2024-02-22

    The only remaining issue is documentation...

     
  • Sven Schreiber

    Sven Schreiber - 2024-04-14

    To be clear, there are several plotting commands that aren't documented as supporting the outbuf option, although they do (tested with 2024a):

    • tsplots (and scatters)
    • rmplot
    • qqplot
    • panplot
    • kdplot
    • (couldn't test hfplot right now)
    • boxplot
     
    • Allin Cottrell

      Allin Cottrell - 2024-04-15

      That's true, but what actually is the use case? Now that we have gpbuild and gridplot I can't offhand think of much use for this option, which was introduced as a convenience for multiplot.gfn. Personally, I'd be more inclined to remove the option in those cases than to document it. But it could remain, undocumented, if there's an obscure use case that we ought to preserve.

       
      • Artur Tarassow

        Artur Tarassow - 2024-04-17

        Just for understanding you correctly, Allin:
        You're arguing that there is no need for the --outbuf option -- for instance for the panplot command -- as the user can always run the approach proposed by Sven? Concrete: Store the output as a plt file and read-in its content:

        ~~~
        panplot $i --overlay --output="mytemp$i.plt"
        ps[i] = readfile("mytemp$i.plt")
        ~~~

        Artur

         
        • Sven Schreiber

          Sven Schreiber - 2024-04-17

          From the documentation, in a gpbuild ... end gpbuild block you don't need temp files, the needed strings array is filled automatically. It's not totally clear to me whether a loop is also allowed inside a gpuild block, however. (Don't have time for testing myself right now.)

           
  • Sven Schreiber

    Sven Schreiber - 2024-04-17

    Indeed loops are supported, so the updated example above on how to use the stuff without the --outbuf option would probably be (tested):

    set verbose off
    open grunfeld -q
    
    list L = invest value
    strings ps 
    
    gpbuild ps
        loop foreach i L
            panplot $i --overlay
        endloop
    end gpbuild
    
    gridplot ps --output=display
    

    It was discussed that for special and pretty advanced usage the outbuf option could stay, but would not be heavily documented. Perhaps only in the context of the gnuplot command entry. In that sense this ticket could probably be closed; perhaps the implication is that some documentation would actually have to be removed.

     
  • Sven Schreiber

    Sven Schreiber - 2024-05-21
    • status: open --> closed
    • Group: -->
     
  • Sven Schreiber

    Sven Schreiber - 2024-05-21

    OK, as discussed before what remained to be done was to leave the documentation of the outbuf option only for the gnuplot and plot (and partly gridplot) commands, and do not advertise it actively in all the other plotting commands. (Because you can always use the temp file approach there, and if you're really clever, outbuf should still work.)
    That has now been done, and so I'm closing this.

     

Log in to post a comment.