eng3
eng3

Reputation: 452

Polar plot with custom trange and 2d intensity plot

I have data in two columns (from a sql db). First column is azimuth, second is intensity. The first column range is around 1000 vs 360.

Data example (azimuth#|intensity):

1|3.5
2|6.3
3|-3.4
4|3.6
5|2.3

I tried the following:

set polar
set trange [0:1000]
plot "dat" w l

It doesnt seem to plot right. the trange doesnt seem to work. it seems to be at some number less like 360 and the plot seems to circle several times around the origin.

I also have a set of data in 3 columns, X, Y, intensity. I'd like to produce a 2d "colormap" where it plots a point (X,Y) and then the intensity is a color. Not every point in the X,Y space will be filled.

Data example (x|y|intensity):

1|4|3.5
1|5|.3
1|6|-3.4
2|2|3.6
2|3|2.3

From reading online, it seems I should use pm3d, but I am confused as how to use it. I've tried:

set pm3d map
plot "dat" using 1:2:3 with points linetype palette

However I get "Warning: No usable data in this plot to auto-scale axis range" and "All points x value undefined"

Upvotes: 1

Views: 275

Answers (1)

Schorsch
Schorsch

Reputation: 7905

1st answer

In order to stop your azimuth values from going beyond the full circle, you can scale them when you plot the file. If you know that 1000 corresponds to 360 degrees you can scale your input to the appropriate range in radians (360 = 2*pi) use this command:

plot "dat" u ($1/1000*2*pi):2 w l

This will divide the value of the first column by 1000 and then multiply by 2*pi - resulting in the desired polar plot.

2nd answer

Your separator is not recognized by default. Include this command:

set datafile separator "|"

If you then use the following commands:

set pm3d map
set xrange [0:3]
set yrange [1:7]

plot "test.dat" using 1:2:3 with points linetype palette

you'll get this plot:

enter image description here

Upvotes: 1

Related Questions