0

enter image description here

I have the Gnuplot script below. All looks good except that in the right pie-chart the area that is highlighted with black diagonal lines should have a green background. Update: Thank you. I have now corrected the script. It should work now. Please try and run it again.

##################################################################

reset 
set terminal pngcairo size 1000,500 enhanced font 'Arial,14'
set output 'ATU20250410_Piechart_Q5.png'

set multiplot layout 1,2 title "Q5: Hvordan maales den samlede masse af en galaksehob?"

unset key 
unset border 
unset tics 
set size square 
set xrange [-1:1] 
set yrange [-1:1]
set angle degrees

#Pie Chart 1: BEFORE

set title "Before Lecture" 
unset object
unset label
#Q5F_b: 7 \u2192 (7/9)*360 = 280°
#Q5C_b: 2 \u2192 (2/9)*360 = 80°

set object 1 circle at 0,0 size 1 arc [0:280] fillstyle solid 1.0 fillcolor rgb "orange"

# Q5F_b 
set object 2 circle at 0,0 size 1 arc [280:360] fillstyle solid 1.0 fillcolor rgb "green" 
# Q5C_b

set label 1 "Q5F: 7" at -0.5, 0.8
set label 2 "Q5C (correct answer): 2" at 0.4, -0.6

plot [-1:1][-1:1] 1/0 notitle
#-------------------
#Pie Chart 2: AFTER

set title "After Lecture"
unset object
unset label

#Totals (based on selections across students):
#Q5B_a: 6 \u2192 154°
#Q5C_a: 6 \u2192 154°
#Q5F_a: 1 \u2192 26°
#Q5A_a: 1 \u2192 26°
#Total "slices" = 14 (sum of all mentions)
#Assign angles:

angle_b = 0 
angle_c = angle_b + 154
angle_f = angle_c + 154
angle_a = angle_f + 26
#Q5B_a: solid green

set object 3 circle at 0,0 size 1 arc [angle_b:angle_c] fillstyle solid 1.0 fillcolor rgb "green"
#Q5C_a: base green (slightly smaller radius so it shows under pattern)

set object 4 circle at 0,0 size 0.999 arc [angle_c:angle_f] fillstyle solid 1.0 fillcolor rgb "green"
#Q5C_a: pattern overlay (full radius, transparent with black lines)

set object 7 circle at 0,0 size 1 arc [angle_c:angle_f] fillstyle pattern 6
#Q5F_a: orange

set object 5 circle at 0,0 size 1 arc [angle_f:angle_a] fillstyle solid 1.0 fillcolor rgb "orange"
#Q5A_a: purple

set object 6 circle at 0,0 size 1 arc [angle_a:360] fillstyle solid 1.0 fillcolor rgb "purple"
#Labels

set label 3 "Q5B (correct answer): 6" at -0.8, -0.5 
set label 4 "Q5C (correct answer): 6" at -0.8, 0.6
set label 5 "Q5F: 1" at 0.35, -0.4
set label 6 "Q5A: 1" at 0.35, -0.1

plot [-1:1][-1:1] 1/0 notitle

unset multiplot

enter image description here

3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Apr 16 at 13:06
  • 1
    This seems to be programming problem more than a UNIX/Linux problem -> Stackoverflow. Commented Apr 16 at 14:02
  • 1
    Does the shown script actually create the shown graph? I doubt it, since I get errors. % is not a comment character in gnuplot, Which gnuplot version and/or interface are you using? To me, giving the actual angles to draw the pie chart seems cumbersome and unflexible in case of changing data. Does this maybe answer your question? Commented Apr 19 at 19:53

2 Answers 2

0

Transparency in this case is an attribute of the pattern fill. The command

set object 7 circle at 0,0 size 1 arc[angle_c:angle_f] fillstyle pattern 6

must instead read

set object 7 circle at 0,0 size 1 arc[angle_c:angle_f] fillstyle transparent pattern 6

Sign up to request clarification or add additional context in comments.

Comments

0

If you want the "fillstyle pattern" to be transparent, just use 'fillstyle transparent pattern N'. Therefore, you should rewrite the “#Q5C_a” part of your script as follows.

#Q5C_a: pattern overlay (full radius, transparent with black lines)

set object 7 circle at 0,0 size 1 arc [angle_c:angle_f] fillstyle transparent pattern 6

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.