File: circles.dem

package info (click to toggle)
gnuplot 6.0.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,940 kB
  • sloc: ansic: 95,319; cpp: 7,590; makefile: 2,470; javascript: 2,328; sh: 1,531; lisp: 664; perl: 304; pascal: 191; tcl: 88; python: 46
file content (66 lines) | stat: -rw-r--r-- 2,277 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# demo for the use of "set object circle" and "plot ... with circles"
#
# Dynamically calculated pie charts
# Reworked earlier demo to use data from a file with a more realistic format,
# a table with regions in the rows and energy numbers in the columns.
# Radius and wedges for each pie chart are generated directly from the data.
# Tilman <theozh@gmx.net>
# November 2017
#
set obj 1 rect from graph 0,0 to graph 1,1 behind fc rgb "cyan" fs solid 0.2
set angle degree
set datafile separator whitespace
set xrange [-180:180]
set yrange [-70:90]
set palette model HSV func gray*0.75, 0.75, 0.99
set style fill solid 1.0 border lt -1
set style textbox opaque fc "white" margin 0,0
unset colorbox

set xlabel "Dynamically generated pie charts"
set title  "Sources of energy production, plotted for each continent"

keyx = -145.
keyy = -30.
keyr = 20.
Scale = 3000.

EnergyTypes = 6
Regions = 8
array EnergySum[Regions]
do for [i=1:Regions] { EnergySum[i] = 0 }

plot 'world.dat' using 1:2 with filledcurves lc rgb "bisque" notit, \
   for [i=1:EnergyTypes] for [j=1:Regions] 'WorldEnergy.dat' using 2:1:\
     (Total = (sum [col=4:9] column(col)), sqrt(Total/Scale)):(EnergySum[j]*360./Total):\
     (EnergySum[j]=EnergySum[j]+column(i+3), EnergySum[j]*360./Total):(i-1) \
     every ::j:0:j:0 with circles lc pal fs transparent solid 0.8 border lc "black" not,\
   '' using 2:($1-10):3:0 with labels not,\
   for [i=1:EnergyTypes] '' using (keyx):(keyy):(keyr):\
     ((i-1)*360./EnergyTypes):(i*360./EnergyTypes):(i-1) \
     every ::0:0:0:0 with circles lc pal fs solid 1.0 border lc "black" not,\
   for [i=1:EnergyTypes] '' using (keyx+keyr*cos((i-0.5)*360./EnergyTypes)):\
     (keyy+keyr*sin((i-0.5)*360./EnergyTypes)):(stringcolumn(i+3)) \
	 every ::0:0:0:0 with labels center not

pause -1 "Hit return to continue"
reset


# by Ralf Juengling - 2008

reset
set title "Trace of unconstrained optimization with trust-region method"
set xlabel "Note that overlapping transparent circles produce a darker area"

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