March 15th, 2011 | No Comments
As you all know Gnuplot is able to add arrows or labels to your plot. But it can even add more complicated objects, by using the
object command. You can choose if you want to add a rectangle, ellipse, circle, or polygon. Here we want to add a loudspeaker to our plot, hence we choose the polygon.
For a polygon you have to specify the points the polygon should combine. The following points will result in a shape of the desired loudspeaker.
a = 1.0/3 set object 1 polygon from \ -1, 1 to \ 0, 1 to \ 0, a to \ 1, 1 to \ 1,-1 to \ 0,-a to \ 0,-1 to \ -1,-1 to \ -1, 1
After this we do some fine tuning on the appearance of the object and remove all borders and tics from the plot.
unset border unset tics set object 1 fc rgb '#000000' fillstyle solid lw 0
In order to draw the loudspeaker we need a plot command. For this we use the parametric mode to draw parts of circles with different radii. Here I will only present the used functions, for an explanation of the parametric mode have a look at the Understand parametric mode entry.
set trange [-pi/6:pi/6] fx(t,r) = r*cos(t) fy(t,r) = r*sin(t)