Search code examples
jsongnuplot

Getting a surface graph from a json file in gnuplot


I'm not a dev, I'm doing this for a school project. I'm trying to put the following dataset into a surface plot in windows gnuplot. qt type terminal, if that's important.

https://files.catbox.moe/nbc6l1.json

As you can see, it's a huge set of data. Pulled directly from an image and into a csv file, which I converted to json.

When I type in "splot 'C:\Users\tyler\ESRP Data\sampleOutput.json'", this is what I get.

As you can see, there's only a single line, when there should be something approaching an intensity chart in a 3 dimensional space. Is it a problem with the data? Do I need a specific command to do this?


Solution

  • It would help if you attached an example of your image data to the question, and also if you provided a link to a plot similar to the one you are trying to create. There are many different styles one might use to represent a surface. I will attempt to guess at a possible solution.

    Input image (scribbled in GIMP and saved as a png image):

    Scribbled in GIMP and saved as a png file

    Gnuplot surface plot:

    set border -1
    unset tics
    
    # surface represented by colored lines in 3D
    # down-sample by 4x in each dimension to get an interpretable surface
    set palette defined (0 "blue", 1 "white")
    splot 'scribble.png' binary filetype=png every 4:4:4 using 1:2:3:3 with lines lc palette
    

    enter image description here