Data Science, Data Visualization, R.
* -90 # Or even more compact, but less readable if(perc < 0.5) # 1st half [90, -90] angle = (180 - (perc/0.5) * 180) - 90 else # 2nd half [90, -90] angle = (90 - ((perc - 0.5)/0.5) * 180) return(angle) } Here perc is a variable ranging from 0 to 1 representing the position of the “text label” in a