FYI: Major/minor polar grid lines script (was: Minor angular grid lines in polar grid?)

FYI: Major/minor polar grid lines script (was: Minor angular grid lines in polar grid?)

Post by Ingo Thie » Tue, 27 Apr 2010 17:25:04



Fortunately, it is easy to create polar grid lines by arrows. For those
who are interested in such thing, here is a sample script for 30 degree
"major" angular tics (other angular steps are made analogously). This
script may also illustrate the issue and may be helpful for a decision
for or against a built-in feature in some futurte gnuplot version.

Here is the script (don't forget to define the line style and set the
variable lspolar to the according line style index):

#### Polar Angles Definitions

### 30 degree steps
phi000=0.
phi030=pi/6.
phi060=pi/3.
phi090=pi/2.
phi120=pi*2./3.
phi150=pi*5./6.

#### Destination Definitions

### 30 degree steps
xto000=r*cos(phi000); yto000=r*sin(phi000)
xto030=r*cos(phi030); yto030=r*sin(phi030)
xto060=r*cos(phi060); yto060=r*sin(phi060)
xto090=r*cos(phi090); yto090=r*sin(phi090)
xto120=r*cos(phi120); yto120=r*sin(phi120)
xto150=r*cos(phi150); yto150=r*sin(phi150)

#### Arrows Definitions (mirrored)
#*** IMPORTANT: Define lspolar in calling script! ***

### 30 degree steps
set arrow 1 from -xto000,-yto000 to xto000,yto000 ls lspolar nohead
set arrow 2 from -xto030,-yto030 to xto030,yto030 ls lspolar nohead
set arrow 3 from -xto060,-yto060 to xto060,yto060 ls lspolar nohead
set arrow 4 from -xto090,-yto090 to xto090,yto090 ls lspolar nohead
set arrow 5 from -xto120,-yto120 to xto120,yto120 ls lspolar nohead
set arrow 6 from -xto150,-yto150 to xto150,yto150 ls lspolar nohead
####

The minor grid lines are simply added by the built-in grid command, e.g.

set grid polar pi/18 <linestyle>

with a thinner or/and brighter linestyle to get 10 degree "minor" tics.

Ingo