Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6881421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:06:19+00:00 2026-05-27T05:06:19+00:00

Changing font faces and sizes works well without expression in the labels. Here is

  • 0

Changing font faces and sizes works well without expression in the labels. Here is the code where I’ve problem to change the font faces in label expression.

p <- ggplot(data = mtcars, aes(x=wt, y=mpg)) + 
    geom_point() + 
    labs(x="Weight", y=expression(paste("mpg (  ", m^{-2}, ")"))) + 
    theme(axis.title.x = element_text(family="serif", face="bold", 
        size=12, angle=00, hjust=0.54, vjust=0)) + 
    theme(axis.title.y = element_text(family="serif", face="bold", 
        size=12, angle=90, vjust=0.25))

p

Output

Any help would be highly appreciated. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:06:20+00:00Added an answer on May 27, 2026 at 5:06 am

    I do not think it is the presence of expression, although you don’t say exactly what it is that you are seeing so it’s difficult to be sure. On a Mac you get the xlab in bold-serif font, but the ylab is not bold (although it is in serif). If I use the plotmath bold it succeeds from inside the expression function:

    p <- ggplot(data = mtcars, aes(x=wt, y=mpg)) + 
    geom_point() + 
        labs(x = "Weight", y = expression(bold(mpg (m^-2) ))) +
        theme(axis.title.y = element_text(family="serif", 
            size = 12, angle = 90, vjust = 0.25)) +
        theme(axis.title.x = element_text(family="serif",
            size = 12, angle = 0, hjust = 0.54, vjust = 0))
    p
    

    As always, graphical devices are often OS-variable and you have not offered any hint about yours, so further commentary is inhibited.

    (EDIT: If you quote the exponent -2 you can get it bold()-ed as well.)

    expression( bold(mpg (m^bold("-2")) ) ) )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that I want to change the UILabels sizes without changing
i've the following code in aspx page <asp:Label ID=CittaLabel runat=server Text='<%# Eval(Citta) %>' Font-Size='<%#
i have the strangest problem. I can't seem to change the font in a
I'm having trouble changing the font size of my TextInput tooltip. The text input
Removing -Dorg.eclipse.swt.internal.carbon.smallFonts from eclipse.ini and changing the font to menlo seems to improve the
Changing the scale to (2, .5) on a textfield's transform.matrix just makes the font
I have done many approach on changing font colors from a tableView cell. apparently
I am trying to change the default font in a DevExpress utility within a
Is there a way to change the font of the whole android application ?
I have seen posts on changing console true type font and console colors (rgb)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.