Search code examples
matlabcolorsplotgnuplotpolar-coordinates

What plotting software to use: 2D polar plot with unique data


I have my (example) data in the following format:

R_min  R_max   θ_min   θ_min   Zones

0   260 0   1.57    114
260 270 0   1.57    106
270 320 0   1.57    107

As you can see, I have "zones" (areas) that are created from R_min to R_max that sweep from theta_min to theta_max. Each row of data represents an area that I want to plot with a corresponding color based on the zone number. In this simple case, the data I show above would look like the following picture:

enter image description here

What plotting software should I use to accomplish this? I have been investigating the following options:

Are there other programs or a better way to compile my data to make my task-at-hand doable?

My real data set has thousands of rows of data and not nearly as simple as a quarter circle rainbow.


Solution

  • Here is one possible solution with gnuplot. That uses the circles plotting style to draw the overlapping wedges at the origin with a specified radius. That requires you to have your data sorted by descending maximum radius, and that you have no gaps.

    Here is a possible script:

    set xrange [0:350]
    set yrange [0:350]
    
    set size ratio -1
    set style fill solid noborder
    set palette defined (106 'blue', 107 'yellow', 114 'magenta')
    set cbrange [106:114]
    unset colorbox
    plot 'test.txt' using (0):(0):2:($3*180/pi):($4*180/pi):5 with circles linecolor palette notitle
    

    with the result (with 4.6.4):

    enter image description here

    Some more remarks:

    • The radius of the circles is given in units of the x-axis, but the y-axis isn't adapted accordingly. That's why you must set both xrange, yrange and even the ratio of the two axes with set size ratio -1.

    • Using the palette for coloring is one option, other options like using linecolor variable or linecolor rgb variable, are explained e.g. in gnuplot candlestick red and green fill.

    • On Unix systems, the sorting could also be done on-the-fly with e.g.

      plot '< sort -r test.txt' ...