How to change all text, including point labels to Arial?
Entering edit mode
junli1988 • 0
Last seen 2 days ago
United States

Hello, I'm trying to wrangle a Volcano plot made with the EnhancedVolcano package to have all text in Arial font style. I tried to do so with this code:

a= EnhancedVolcano(data.matrix,
                lab = rownames(data.matrix),
                x = 'Log2.fold.change',
                y = 'P.value',
                xlim = c(-2,2),
                ylim = c(0,6),
                xlab = bquote(~Log[2] ~ "fold change"),
                ylab = bquote(~-Log[10] ~ italic(P)),
                axisLabSize = 12,
                title = paste("NanoString -",,
                subtitle = '',
                labFace = "bold",
                pointSize = 2,
                labSize = 5,
                pCutoff = 10e-2,
                FCcutoff = 0.4,
                gridlines.major = FALSE,
                gridlines.minor = FALSE,
                drawConnectors = TRUE,
                widthConnectors = 0.2,
                colConnectors = 'black',
                legendPosition = 'none')

EV_merge <- a + theme(text=element_text(size=8,  family="sans"))

The problem I'm having is the element_text command, which I thought would work since the plot is an object in ggplot2, seems to only work for the axis and title text, but the font of the labels for the specific genes seems to remain the same. What function should I be using in this case?

EnhancedVolcano • 99 views
Entering edit mode

Hi, your post is a mess. Please format it better and remove placeholder text.

Entering edit mode

Placeholder text?

Entering edit mode

I already fixed it for you. When you first make a post there is some text that says something like 'put your code here' which is a placeholder for where your code is meant to go. You put your code somewhere else and left that placeholder text.

Do note that there is a box below where you type that shows what the post will look like. If it looks bad (like your original post did), then it's a good idea to fix it before posting. There is a FAQ

Entering edit mode
Last seen 2 days ago
United States

Your question is confusing. The default is for all sans serif fonts, of which Arial is one example. Are you saying that you want a specific font (Arial), or no serifs? Try changing labFace to 'EUC' to see what a serif font looks like.

Entering edit mode

I am confused, I want a specific font on the whole plot, i.e. Arial. I'm just learning as I go along and I found that line of code for element_text in stack overflow. I don't know why it doesn't change the font style for the whole plot as seen in examples presented for ggplot2

Entering edit mode

The element_text function won't affect the text that is put in the plot by ggrepel. The only way you can affect that text is via the 'labFace' argument, which has the (undocumented, so far as I can tell) choices of 'plain', 'italics', 'bold', and 'EUC'. The only one of which that has a serif is 'EUC'. You could hypothetically use ggrepel directly instead of having EnhancedVolcano handle it for you, if you so desire.

Anyway, you cannot get ggplot2 to produce Arial fonts. You can get sans serif fonts, which are Helvetica, but not Arial. The default font face for ggplot2 and hence EnhancedVolcano is Helvetica, which to my eye is pretty much the same as Arial.

Login before adding your answer.

Traffic: 454 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6