Draw a ring segment in GNUPlot

I would like to obscure a specific plot in the polar plot using GNUPlot. This area is limited by the limits in R (r1, r2) and Theta (t1, t2), so the final shape is a segment of the ring defined by only 4 points in the polar space.

In Cartesian graphics, it is fairly easy to draw a rectangle, either (set object rect) or a filledcurve with four vertices. However, the filled shape curve defined by four points in the polar graph still leads to quadrangularity (lines with constant R should be circular arcs, not straight).

Is there a simple or simple way to plot this shape in polar coordinates? I tried using two arcs and then filled the space between them, but so far this does not work, and I'm not sure if there is a better way to do this.

+5
source share
1 answer

Unfortunately, this is not so simple. You can set the circle object for which you specify the start and end angles. To cut out the center part, you should draw a second white circle above:

 set xrange [-1:1] set yrange [-1:1] set size ratio -1 r1 = 0.5 r2 = 1 theta1 = -30 theta2 = 60 set angles degrees set style fill solid noborder set object circle at first 0,0 front size r2 arc [theta1:theta2] fillcolor lt 1 set object circle at first 0,0 front size r1 fillcolor rgb 'white' plot -10 notitle 

It is important here that the x and y axes have the same unit ( set size ratio -1 ), since the circle object is defined in units of the first x axis and does not take into account the y axis at all. If you have nothing else to build, you should use the plot command, which displays something outside of certain ranges. Without a graph, objects are not drawn.

Result from 4.6.5:

enter image description here

In the next version 5.0, you can use pseudo-data (with a special file name + ) along with the filledcurves build filledcurves :

 r1 = 0.5 r2 = 1.0 theta1 = 20 theta2 = 135 set polar set angles degrees set size ratio -1 unset raxis unset rtics set trange [theta1:theta2] set style fill solid noborder plot '+' using 1:(r1):(r2) with filledcurves notitle 

enter image description here

+6
source

Source: https://habr.com/ru/post/1200627/


All Articles