Sorry, this is my first post here. I hope I am not wasting your time. I have been trying to get gnuplot to draw a 3D graph of a regular array of x,y,x values. I am running on Mac OSX Snow Leopard using gnuplot 4.6 patchlevel 5. There are two issues I cannot seem to solve, though I get a graphed output. This happens whether I use autoscale or provide the xrange, yrange and zrange. However, the results are different, but both wrong. In each case, the z range in the data is actually 0 to 255 (x and y ranges are 0 to 127). The data comes from a png image that I converted to ascii text x,y,z triplets.
1) I cannot get the z axis to show up. However, data in the z direction is graphed.
2) It is not scaling the z-axis data correctly or not accessing data in my file correctly. The plot only shows data going from 0 to 35 rather than 0 to 255 as in the text file.
I am attaching a zip file containing 6 files: two scripts -- one for autoscale and one for setting the ranges. Also there are two png files for the corresponding graphed results. I am also including the actual png image from which the data was extracted and my text file of the x,y,z triplets.
Perhaps I am doing something wrong. This is my first attempt at a 3D plot.
Thanks for your attention to this.
Regards
Fred Weinhaus
fmw@alink.net
Sorry, I did not know I needed to log in. So perhaps you can change the creator to my name Fred Weinhaus in this ticket.
Also I wanted to mention that the script files I sent were not run as scripts, but simply copied and pasted into a terminal window.
Thanks
Fred Weinhaus
On further bit of information. I installed gnuplot via MacPorts. MacPorts reports
gnuplot @4.6.5_0+aquaterm+luaterm+pangocairo+wxwidgets+x11 (active)
Issue 1)
You turned off the Z axis line using the command
set border 15
You can turn it on again by saying
set border 31
or just
set border
Last edit: Ethan Merritt 2014-07-25
I had tried that, but thought it had not worked. Now, when I do that again, it seems to work. I forgot about the change from 15 to 31 for 3D.
Sorry for the false alarm.
But thank you for your time
Last edit: Fred Weinhaus 2014-07-25
Issue 2)
Your data file contains 128 data sets, separated by blank lines.
The splot command you issued only plots the first of these.
This is probably not what you want, but since I don't exactly what you are aiming for I can't suggest a different splot command.
gnuplot can read a png image file directly, which may bypass the issue of how to create an ascii data file from it. Try
splot 'zelda3_ncc.png' binary filetype=png
"Your data file contains 128 data sets, separated by blank lines.
The splot command you issued only plots the first of these."
Yes, it contains 256 rows of 256 columns, corresponding to the image that I sent.
When I fix the set border 31, it now plots the data correctly in the z direction. but only if I comment out
set dgrid3d 20,20
But then I have no control over the grid size or color
However,
"splot 'zelda3_ncc.png' binary filetype=png"
That only works if I comment out
set dgrid3d 20,20
otherwise, I get an error message
"Gridding of the color column is not implemented"
and when I comment it out, I have no control over the grid size nor line color (it is black or dark blue rather than red), when I use
splot 'surface_image.png' binary filetype=png with lines linestyle 1
If I just use
splot 'surface_image.png' binary filetype=png
then I don't get lines, only red cross-shaped points.
Is there another way to get gridded data with control of the grid size and color of lines?
Sorry, I did not know you could read png files directly. I had read about using binary data, but did not know it would work with PNG, because of all the meta data with the PNG file.
Last edit: Fred Weinhaus 2014-07-25
I don't understand what you are trying to do.
The "set dgrid3d" is not appropriate when your input data is already on a natural grid, which is always true for a png or other image file. What are you trying to accomplish with this command?
I suggest starting with no extraneous commands at all. To generate a 3Dsurface with lines it should be sufficient to say
Beyond that it depends what you are trying to do.
I don't understand the question. Your data is already gridded.
Color of lines - certainly, whatever color you like:
I thought set dgrid3d converted the dense grid to a coarser one according to the two argument provided for it.
I guess I am mistaken.
Rereading the documentation, I found my solution. It is to use every 3:3. That skips regular intervals and makes the plot coarser.
Last edit: Fred Weinhaus 2014-07-25
This ticket can be marked resolved or closed. It was my lack of understanding splot 3D and not a bug.
Thanks to Ethan Merritt for all his help.
Last edit: Fred Weinhaus 2014-07-25