user2602640
user2602640

Reputation: 740

plotmath symbol displaying as a white rectangle

I'm running code on a new computer (Windows 10 Enterprise OS) with R 4.2.2. I'm running code I've been using for years, but on the new system, my plot shows little white rectangles instead of plotmath symbols.

I've seen several people running into this, with fixes for Mac (here) and Linux (here). Using the cairo option, as proposed here works ok for the exported plots but is extremely slow-rendering for in-console plotting.

I would like to be able to add the missing fonts in, but I can't seem to figure out how to. Here's what I get when I run demo(plotmath).

enter image description here

I seem to only have "Symbol Regular.ttf" font file in my Fonts folder under C\Windows. That is, I don't have a "Symbol.ttf" file. When I open it, there are no multiplication, less-than-or-equal, not equal, etc symbols in it.

enter image description here

Any help would be appreciated!

EDIT This doesn't seem to be a ttf issue, but rather an R issue. Code that works fine on R 4.2.1 doesn't work on R 4.2.2 on the same computer. Toy example below, and a screenshot of the session info and plots are provided. I highlighted the only 2 differences in package versions that I could see. Any help would be appreciated...

library(ggplot2)

df <- data.frame(x = 1:10, y = 11:20, Eq = "WT == 10%*%10^3%*%x^5")
    
ggplot() +
 geom_point(data = df, aes(x = x, y = y)) +
 geom_text(data = df[1,], 
    aes(x = x, y = 20, label = Eq), size = 2.7, parse = TRUE, hjust = 0, show.legend = FALSE)

enter image description here

Upvotes: 2

Views: 188

Answers (1)

jan-glx
jan-glx

Reputation: 9486

This is an issue with R 4.2.1. It has been fixed in R 4.2.3. You need to update R by installing a new version.

From NEWS:

CHANGES IN R 4.2.3

BUG FIXES:

(Windows) Math symbols in text drawing functions are again rendered correctly (PR#18440). This fixes a regression in R 4.2.1 caused by a fix in PR#18382 which uncovered an issue in GraphApp due to which the symbol charset was not used with TT Symbol font face.

Upvotes: 2

Related Questions