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 7632563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:39:30+00:00 2026-05-31T06:39:30+00:00

I am adjusting the font size of ggplot2 labels to make them more readable

  • 0

I am adjusting the font size of ggplot2 labels to make them more readable in large format. This works very well except for the legend title. This is illustrated by the following code:

library(ggplot2)
p <- ggplot(diamonds, aes(carat, price, colour=cut)) + geom_point() +
  xlab("Carat") +
  ylab("Price") +
  opts(legend.position=c(0.85, 0.3)) +
  opts(axis.title.x=theme_text(size=16)) +
  opts(axis.title.y=theme_text(size=16, angle=90)) + 
  opts(plot.title=theme_text(size=20)) +
  opts(legend.text=theme_text(size=14)) +
  opts(legend.title=theme_text(size=14)) +
  opts(title="Diamond Prices")
p

The re-sized legend title is no longer properly aligned in the legend box, but is protruding out to the left. The effect is even worse for longer titles. I have tried defining custom values for the vjust and hjust parameters, but there is no apparent response.

Is there a way to adjust the alignment of a re-sized legend title?

  • 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-31T06:39:31+00:00Added an answer on May 31, 2026 at 6:39 am

    Yes, using a feature of the new 0.9.0 version, guides:

    p + guides(colour = guide_legend(title.hjust = 0.5))
    

    You can read about guides here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this js that is adjusting the size of the first letter of
I want to do so the size of the bubble, is auto-adjusting after the
Please take a look at this . I've tried adjusting the overflow properties and
I'm very new to python and matplotlib and having trouble with adjusting the height
I have a text area that I want to change the font size of
I'm fairly new to android and am slowly adjusting to how android works. I
I am having a problem adjusting this part of my SQL statement: HAVING dbo.BOOKINGS.BOOKED
We are looking at adjusting our web pages so we split our calls for
is anyone aware of a way of adjusting the height of the tab bar
How would I go about dynamically adjusting the height of a UIScrollView ? Basically

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.