#
# demo for the use of "set object circle" and "plot ... with circles"
#
# Ethan A Merritt, Ralf Juengling - 2007,2008

if ((GPVAL_VERSION == 4.3 || GPVAL_VERSION == 4.2) \
&&  (!strstrt(GPVAL_COMPILE_OPTIONS,"+OBJECTS"))) \
    print ">>> Skipping demo <<<\n" ; \
    print "This copy of gnuplot was built without support for circles\n" ; \
    exit ;

set size ratio -1
set style fill solid 1.0 border -1

set obj 10 circle   arc [  0 :  20] fc rgb "red" 
set obj 11 circle   arc [ 20 :  50] fc rgb "orange" 
set obj 12 circle   arc [ 50 :  90] fc rgb "yellow" 
set obj 13 circle   arc [ 90 : 120] fc rgb "forest-green" 
set obj 14 circle   arc [120 : 190] fc rgb "dark-turquoise" 
set obj 15 circle   arc [190 : 360] fc rgb "dark-magenta" 

set obj 10 circle at screen .18,.32   size screen .10  front
set obj 11 circle at screen .18,.32   size screen .10  front
set obj 12 circle at screen .18,.32   size screen .10  front
set obj 13 circle at screen .1767,.342   size screen .10  front
set obj 14 circle at screen .18,.32   size screen .10  front
set obj 15 circle at screen .18,.32   size screen .10  front

set obj 20 rect from graph 0,0 to graph 1,1 behind fc rgb "cyan" fs solid 0.2

# plot world map and correspondent locations as a circle
set title ""
set xlabel "Note that overlapping transparent circles produce a darker area"
unset key
unset xtics
unset ytics
set border

set yrange [-70:*]

plot 'world.dat' with filledcurves lc rgb "light-green" , \
     'world.cor' using 1:2:(7.*rand(0)) with circles lt 3 \
                 fs transparent solid 0.5 noborder

pause -1 "Hit return to continue"

# by Peter Juhasz - 2010

reset

set style fill solid 1.0 border -1
set size ratio -1

# Plot pie charts on top of the map of the world.
# The pie segments are read from a data file.
# Each segment has to be specified with a start and end angle.

set title "Sources of energy production, plotted for each continent"

unset key
unset xtics
unset ytics
set border

set yrange [-70:*]
set palette model HSV func gray*0.75, 0.5, 0.99
unset colorbox
r = 0.01
types = 6
keyx = -137.
keyy = -15.
keyr = 25.

set obj 20 rect from graph 0,0 to graph 1,1 behind fc rgb "cyan" fs solid 0.2
set angle degree

plot 'world.dat' with filledcurves lc rgb "light-green" notit, \
     'energy_circles.dat' using 2:1:(sqrt($9)*r):6:($6+$7):5 \
            with circles lc pal fs solid 1.0 border rgb "gray",\
     for [i=0:types-1] '' using (keyx):(keyy):(keyr-5):(-(i+1)*360./types):(-(i)*360./types):5 \
            every ::i::i with circles lc pal fs solid 1.0 border rgb "gray",\
     for [i=0:types-1] '' using \
            (keyx+keyr*cos(-(i+0.5)*360./types)):(keyy+keyr*sin(-(i+0.5)*360./types)):4 \
            every ::i::i with labels
            


pause -1 "Hit return to continue"


# by Ralf Juengling - 2008

reset
set title "Trace of unconstrained optimization with trust-region method"
unset key
set size ratio -1
set xrange [-2.5:1.5]
set yrange [-1:2.5]
plot 'optimize.dat' with circles lc rgb "blue" fs transparent solid 0.15 noborder,\
     'optimize.dat' u 1:2 with linespoints lw 2 lc rgb "black"

pause -1 "Hit return to continue"


reset
set size ratio -1
set title "Lena's key points"
unset xtics
unset ytics
unset key
unset border
set yrange [] reverse

plot 'lena.rgb' binary array=(128,128) dx=4 dy=4 format='%uchar' with rgbimage, \
     'lena-keypoints.bin' binary format='%double' with circles lc rgb "yellow"

pause -1 "Hit return to continue"


reset
set size ratio -1
set title "Delaunay triangulation of Hemisphere points, some empty circles in red"
unset key

plot 'empty-circles.dat' with circles lw 2 lc rgb "red", \
     'delaunay-edges.dat' with lines lc rgb "forest-green", \
     'hemisphr.dat' u (100*$1):(100*$2) with points pt 7 lc rgb "black"

pause -1 "Hit return to continue"
