Menu

#2276 qt terminal and multiplot: redraw entire page on unset multiplot?

None
closed-fixed
nobody
None
2020-07-16
2020-06-06
Florian
No

Hello,

firstly, I am working with macOS 10.15.4, gnuplot version 5.2.8 and I am using the qt terminal.

I am animating my data by looping over a multiplot command. by doing so I can see white flashes in the output on the screen. I think the reason for this is that whenever I call set multiplotin the loop, the entire page gets cleared and then each plot gets redrawn separately when a plot command is issued.

under help multiplot i found the following hint:

'For some terminals, no plot is displayed until the command unset multiplot
is given, which causes the entire page to be drawn and then returns gnuplot
to its normal single-plot mode. For other terminals, each separate plot
command produces an updated display.'
i have tested this on my system and I found out that the qt terminal does redraw on each plot command.

to get rid of those flashes, I wanted to ask if it is possible to force redrawing of the entire page only when unset mutiplot is issued in the qt terminal?
if this is not possible, is there another interactive terminal that comes with this behavior?

PS: I can get rid of the flashes if I plot separate graphs in separate terminals. however, sometimes i would like to plot everything in the same terminal, so that is why i use multiplot.

thanks for your answers.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2020-06-07

    Not sure I understand what you want, but possibly the key is to never issue the unset multiplot command. Consider the following set of commands:

      set multiplot layout 2,2
      i = 0
      set obj 1 rect from graph 0,0 to graph 1,1 fs solid fc "white"
      unset tics
      while (1) {
          i = i+1
          plot sin(i*x)
          plot cos(i*x)
          plot exp(i*x)
          plot i/x
          pause 4
      }
    

    This will replace all four plots in the 2x2 layout every 4 seconds, looping forever. The individual plots are drawn sequentially to quadrants A B C D A B C D A... within the layout, each time replacing whatever was in that quadrant previously.

    It gets messier if you want to re-draw the tics each time to match a new range, since they are outside the plot area that gets cleared. If the ranges are constant this is not a problem.

     

    Last edit: Ethan Merritt 2020-06-07
  • Florian

    Florian - 2020-06-07

    Hello Ethan,

    thank your for your reply. I tested your approach and it works for me.

    Out of curiousity: Could you please expand on how to re-draw the tics?

    Thank you for your help.

     

    Last edit: Florian 2020-06-07
    • Ethan Merritt

      Ethan Merritt - 2020-06-07

      The "layout" option to multiplot is a convenience that frees you from having to manually set the origin and size of each subplot. But it doesn't do things in the right order to support what you want to do. If you want to clear the whole of each subplot separately, you would have to back off to the full multiplot procedure. Something like

      set multiplot
      while (1) {
          set origin 0.0,0.0; set size 0.5,0.5
          clear
          plot "one"
          set origin 0.0,0.5; set size 0.5,0.5
          clear
          plot "two"
          set origin 0.5,0.5; set size 0.5,0.5
          clear
          plot "three"
          set origin 0.5,0.0; set size 0.5,0.5
          clear
          plot "four"
          pause 4
      }
      
       
  • Florian

    Florian - 2020-06-07

    Thank you. I have tried using the clear command before, but I encountered the problem that not all subplots are cleared with this command.
    E.g. using your code as a template and running

    set multiplot
    i = 0
    while (1) {
      i = i + 1
      set origin 0.0,0.0; set size 0.5,0.5
      clear
      plot sin(i*x)
      set origin 0.0,0.5; set size 0.5,0.5
      clear
      plot cos(i*x)
      set origin 0.5,0.5; set size 0.5,0.5
      clear
      plot exp(i*x)
      set origin 0.5,0.0; set size 0.5,0.5
      clear
      plot i / x
      pause 1
    }
    

    on my machine produces the plot I have attached here. You can see that the two subplots on the top are not cleared at all.

    This over-drawing also happens if I use the multiplot layout (together with set multiplot next/prev to chose the right plot to clear).

    Am I missing something here?

     
  • Ethan Merritt

    Ethan Merritt - 2020-06-07

    Hmm. Yeah, I see that there is something weird with the clear command on the qt terminal. It works for output to wxt or x11. I will look into it.

    So I guess we have to replace the "clear" command with a manually positioned backing rectangle. I used a colored one so I could confirm what is happening.
    Here's a modified loop:

    set multiplot
    i = 0
    set obj 1 rect fs solid fc "light-cyan" behind
    
    while (1) {
      i = i + 1
      set origin 0.0,0.0; set size 0.5,0.5
      set obj 1 rect from screen 0.0,0.0 to screen 0.5, 0.5
      plot sin(i*x)
    
      set origin 0.0,0.5; set size 0.5,0.5
      set obj 1 rect from screen 0.0,0.5 to screen 0.5, 1.0
      plot cos(i*x)
    
      set origin 0.5,0.5; set size 0.5,0.5
      set obj 1 rect from screen 0.5,0.5 to screen 1.0, 1.0
      plot exp(i*x)
    
      set origin 0.5,0.0; set size 0.5,0.5
      set obj 1 rect from screen 0.5,0.0 to screen 1.0, 0.5
      plot i / x
    
      pause 4
    }
    
     
  • Florian

    Florian - 2020-06-07

    I could not test with wxt and x11 yet (I have to reinstall gnuplot with those terminals enabled).

    But I tested your second approach (with manually positioned rectangles in the background) and it works on my machine.

    Thanks for all your help!

     
  • Ethan Merritt

    Ethan Merritt - 2020-06-08

    Since the failure on qt is "clearly" a bug (heh), move this issue to the bug tracker

     
  • Ethan Merritt

    Ethan Merritt - 2020-06-10
    • status: open --> pending-fixed
    • Group: -->
    • Priority: 5 -->
     
  • Ethan Merritt

    Ethan Merritt - 2020-07-16
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.