Jasmine
Jasmine

Reputation: 123

Plotted text appears bold despite using regular font

I'm trying to build a somewhat complex plot, and I have encountered a weird error. Text on the right hand side of the plots appear bold(er), and normal on the left hand side, although I use the same specifications for the two sides. I tried running the code on two different computers-> same results.

See code here for a subgraph:

len=1 # length of feather section to plot
height <- 1-0.04 # height of feather section to plot
x0 <- 0 # VERTIVAL LINE POSITIOM  -  RACHIS
x1j <- 1; x1b <- -1 # right and left limit to barb lengths
plot(c(-len,len), c(-len,len), type='n',xlab='', ylab='', axes=F,
  xlim=c(-len/2,len/2), ylim=c(0.04,height))
  abline(v=x0, lwd=2)
abline(h=1)
abline(h=0)
a0 <- 0.03595088; a <- 0:60*a0
b <- tan( (90-35.86629)*pi/180)
for(j in 1:60){
    ax <- a[j] # intercept
    y0 <- b*x0 + ax
    y1 <- b*x1j + ax
    segments(x0,y0=y0, x1 =x1j, y1=y1)
    b1 <- round(35.86629, 0)
    b2 <- round(27.81573,0)
    text(x=len/3, y=len/15, substitute(paste(b1, degree)), cex=2, font=3)
    text(x=len/3, y=len/5.45,  substitute(paste(b2, "/cm")), col='seagreen', cex=2, font=3)
}
a0 <- 1/19.96685; a <- 0:60*a0
b <- tan( (90-26.49382)*pi/180)
for(j in 1:80){
    ax <- a[j] # intercept
    y0 <- b*x0 + ax
    y1 <- -b*(x1b) + ax
    segments(x0,y0=y0, x1 =x1b, y1=y1)
}
b1 <- round(26.49382, 0)
b2 <- round(19.96685,0)
text(x=-len/3, y=len/15, substitute(paste(b1, degree)), cex=2, font=3)
text(x=-len/3, y=len/5.45, substitute(paste(b2, "/cm")), col='seagreen',
     cex=2, font=3)
box()

Any idea why this happens and how to solve it?

enter image description here

Upvotes: 1

Views: 82

Answers (1)

hplieninger
hplieninger

Reputation: 3504

The text on the right appears bolder on screen, because you actually print it 60 times inside the for loop; you should move that two text() calls outside the loop.

Upvotes: 2

Related Questions