Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

plot 2d contour with contour labels from nonuniform matrix data file

660 views
Skip to first unread message

xlr...@gmail.com

unread,
Sep 2, 2016, 4:25:49 PM9/2/16
to
I have been able to generate a 2d contour plot from a nonuniform matrix data file by using
set contour
unset surface
set view map
splot 'datafile' nonuniform matrix with lines

But I can't figure out how to get contour labels.
I would also like to control how many contour labels are created.
I am using Windows 7.
Thanks

Gavin Buxton

unread,
Sep 3, 2016, 11:36:20 AM9/3/16
to
Don't know if this would work, but you might be able to output your contour as a table, and then plot each contour as a line in a 2D plot. To change the contour number you could use cntrparam. I haven't looked at the nonuniform matrix stuff, but presume this is not too dissimilar to dgrid3d? But the outputing to a table, and then plotting the lines in the new file was the only way to change contour colors at one time.

xlr...@gmail.com

unread,
Sep 6, 2016, 12:59:02 AM9/6/16
to
I've tried the table method with 2d plot, but I couldn't get the plot I want.

I have
10 x values.
180 y values (not equally spaced).
1800 z values.

If I put each of these in a separate data block in the same data file, how can I specify them in an splot command? Sort of like...
splot 'datafile' using x:y:z with lines
but x, y and z are different data blocks read from the same file.

Gavin Buxton

unread,
Sep 6, 2016, 1:02:10 PM9/6/16
to
The not equally spaced part should be cool, but you might have to rewrite your data in a different format:

http://psy.swansea.ac.uk/staff/carter/gnuplot/gnuplot_3d.htm

is the norm. Although I haven't tried the new "nonuniform matrix" bit you originally mentioned, which might work out better.

There's a quick example of the table output for plotting contours at the bottom of this page:

http://lowrank.net/gnuplot/plot3d-e.html

Hope that helps.

xlr...@gmail.com

unread,
Sep 7, 2016, 3:26:09 PM9/7/16
to
The stuff I posted in the other thread "Plotting data array as variable (not in files)"
https://groups.google.com/forum/#!topic/comp.graphics.apps.gnuplot/UdiiC2cBQNo
is working great.

The problem was, for some unknown reason, splot would create a 2d contour plot with lines, but not with labels. This problem only happened with a nonuniform matrix input file.

xlr...@gmail.com

unread,
Sep 8, 2016, 12:46:16 AM9/8/16
to
I figure out my problem getting lines and labels together on the same contour plot from a nonuniform matrix. I needed to specify "using 1:2:3". Once I did that, everything worked :)

I don't need to use the array trick or multiplot. But I learned a lot through the struggle.

Gavin Buxton

unread,
Sep 8, 2016, 10:03:01 AM9/8/16
to
I'm curious to see how it turned out... any chance of a pic?

xlr...@gmail.com

unread,
Sep 8, 2016, 5:49:05 PM9/8/16
to
> I'm curious to see how it turned out... any chance of a pic?

Here are the commands. I am using Internet Explorer 11 and I don't see any way to attach an image.

set view map scale 1
unset surface
set contour base
set cntrlabel format '%8.3g' font ',7' start 10 interval 20
unset hidden3d
set cntrparam levels discrete 0,25 ,50 ,75 ,100 ,200 ,300 ,400 ,500 ,600 ,700 ,800 ,900
set xlabel "Axial, inches"
set ylabel "Circumferential, degrees"
set title "Hydrodynamic Pressure, psi"
splot 'gridnonuni.dat' nonuniform matrix u 1:2:3 with lines, '' nonuniform matrix u 1:2:3 with labels

0 new messages