Search code examples
gnuplot

rotate the gnuplot raxis label to 45 degrees without rtics


I have a polar plot in Gnuplot given by

set polar
set angles degrees
unset xtics
unset ytics
unset raxis
set ttics 0,30
set grid polar linestyle 1 dashtype 2 linecolor rgb 'grey'
set samples 200, 200
unset border

set xrange [-0.51:0.51]
set yrange [-0.51:0.51]
set size square
unset key

plot sin(2*t)*cos(2*t)

Which gives the following output:

Polar plot

However,

  1. I want the rlabels (0, 0.1, 0.2, etc) at an angle of 45 degrees instead of them being placed on the x-axis, and
  2. There should be no rtics

Any help will be appreciated.


Solution

  • In order to remove the rtics do set rtics scale 0.

    You can set the starting angle for polar graph (check help theta), however, only to {right|top|left|bottom} and not to 45°, but this still wouldn't help you here. So, probably you have to set the labels "manually". Maybe there is an automatic way which I am not aware of. Check the following example.

    Code:

    ### set rtics on 45° "axis"
    reset session
    
    set polar
    set angles degrees
    unset xtics
    unset ytics
    unset raxis
    set ttics 0,30
    set grid polar linestyle 1 dashtype 2 linecolor rgb 'grey'
    set samples 200, 200
    unset border
    
    set xrange [-0.51:0.51]
    set yrange [-0.51:0.51]
    set size square
    unset key
    set rtics scale 0
    set format r ""
    
    myRTics = "0.1 0.2 0.3 0.4 0.5"
    do for [i=1:words(myRTics)] {
        r = word(myRTics,i)
        set label i sprintf("%s",r) at r*cos(45),r*sin(45) center
    }
    plot sin(2*t)*cos(2*t)
    ### end of code
    

    Result:

    enter image description here