Stanley F.
Stanley F.

Reputation: 1974

How to properly reverse rrange in gnuplot?

I try to reverse the rrange of a polar gnuplot plot. According to the documentation (p. 173f) this can be achieved by swapping min and max values of the range definition or by using the reverse keyword in autoscale mode. Neither one nor the other variant gives the results that I want.

The code:

set polar
set grid polar 30
set angle degrees
set size square

# case 1
set rrange [0:90]
# case 2
set rrange [90:0]
# case 3
set rrange [*:*] reverse

plot "-" u 1:2 w p pt 7 ps 3
0 30
30 60
60 45
e

The results:

The first picture shows a range of [0:90], the second one the range of [90:0] where no point is visible at all. Plot three shows the output of the reverse setting.

<code>rrange[0:90]</code> <code>rrange[90:0]</code> <code>rrange[0:90] reverse</code>

As the documentation for rrange states

[...] no point with radius greater than < rmax > will be plotted.

the behavior of case 2 is totally comprehensible. On the other hand, case 3 should give the same result according to the following:

The reverse option reverses the direction of an autoscaled axis. For example, if the data values range from 10 to 100, it will autoscale to the equivalent of set xrange [100:10].

There seems to be some inconsistency between the documentation and the actual behavior of gnuplot.

This leads me to my question: How can I plot a diagram with the radius axis ranging from 90 in the middle to 0 at the outer circle?

EDIT

A small explanation of the application background: What I want to visualize is a 2D top view of a sphere with equally spaced latitudes (Azimuthal equidistant projection). There, the center represents a pole with 90 degrees of latitude which decreases along the radius.

Upvotes: 1

Views: 6803

Answers (1)

ferdymercury
ferdymercury

Reputation: 818

As a side comment, note also that the behaviour of the reverse keyword has been changed in Gnuplot 5 vs Gnuplot 4: http://gnuplot.info/ReleaseNotes_5_0.html

"set xrange [0:1] reverse" does not work any more, you have to write instead "set xrange [1:0]".

Upvotes: 3

Related Questions