Menu

Deleting a single graph with multiplot enabled

Help
Michael
2016-01-13
2016-01-13
  • Michael

    Michael - 2016-01-13

    (I hope this is the right place, this is my first post here.) I can't find anything online about this, but it seems like the title of this post should be possible! I set multiplot, and have two graphs of data. I need to delete just one, so the clear function doesn't work because it deletes everything (I think). I can't just regraph the data I want to preserve because it is an image, and takes a bit to load, producing an unwanted flashing effect. I've looked at all of the gnuplot functions and I didn't see anything that could do this. Am I missing something obvious?

     
  • Ethan Merritt

    Ethan Merritt - 2016-01-13

    gnuplot> set multiplot layout 2,2
    multiplot> plot x
    multiplot> plot sin(x)
    multiplot> plot cos(x)
    multiplot> plot tan(x)
    multiplot> set multiplot next
    multiplot> set multiplot next
    multiplot> clear
    multiplot> unset multi
    gnuplot>

     
  • Michael

    Michael - 2016-01-13

    Thanks for the quick reply! This is for a multiplot of four separate graphs it looks like though; I'm trying to plot an image, then plot data over it, then clear just the data. Sorry if that wasn't clear from the post. Is that possible? I tried using set multiplot next, but gnuplot says "only valid inside an auto-layout multiplot".

     
  • Ethan Merritt

    Ethan Merritt - 2016-01-13

    ??
    That doesn't require multiplot at all.
    gnuplot> plot FOO with image notitle, DATA with lines title "DATA"

    Now click on the DATA in the plot key; it will toggle the lines on/off

     
  • Michael

    Michael - 2016-01-13

    Sorry, I don't completely understand still. Is FOO supposed to be an image file name? "image.png"? I got Bad data on line 1 of file "image.png". Also, is there a command to delete just the DATA plot? Some sort of remove command that I missed?

    What I've been doing so far is something like:
    multiplot> plot 'fish.jpg' binary filetype=jpg with rgbimage
    multiplot> plot "data.txt"

    Where "data.txt" might contain a bunch of points.

     
  • Ethan Merritt

    Ethan Merritt - 2016-01-13

    I assumed you already knew how to plot the image, and how to plot the data. Use those commands.
    But put them both in the same plot command, no multiplot.
    The plot titles in the key area are hot-points for mouse clicks. If you click on a plot title it will toggle the corresponding plot on or off. That's what you want, as I understand it.

     
  • Michael

    Michael - 2016-01-13

    Ah, thank you, something like the below seems to work without multiplot.
    gnuplot> plot "LightweightMap.png" binary filetype=png w rgbimage, "test_data.txt" with lines title "DATA"

    The toggle is not exactly what I'm looking for though. I should explain better: I am piping commands to gnuplot from C code, and the goal is to have an image as background for data. However this data is continuously changing as the program runs (too quickly to manually hide a separate graph of each data every iteration). To prevent the image from being replotted (which makes the graph go white for a bit) I wanted to only replot the data, deleting the old and plotting the new. So only hiding it won't work here I believe. Is there no command for removing a single set of data?

     
  • Ethan Merritt

    Ethan Merritt - 2016-01-13

    In the development version (5.1) you can trigger the toggle from the command line. I would imagine that means you can trigger it through a pipe but I've never tried that. See "help toggle". But that variant is not in version 5.0.

    I don't think it is possible to do what you want without redrawing the image portion each time. But I don't see why that would necessarily cause a white flash. Are you sure that wasn't a side-effect of using multiplot unnecessarily? Multiplot always clears the screen first, but a normal plot doesn't.

     
  • Michael

    Michael - 2016-01-13

    Oh, that works perfectly now! Multiplot usage got me in the end. Thank you so much for your help!

     

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.