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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:56:33+00:00 2026-06-07T23:56:33+00:00

After fiddling with point size options in ggplot2, I noticed examples in which size

  • 0

After fiddling with point size options in ggplot2, I noticed examples in which size was passed both inside and outside the aes() parameter of geom_point(). From the `geom_point() page on Hadley’s site:

p <- ggplot(mtcars, aes(wt, mpg))

# passed inside
p + geom_point(aes(size = qsec)) 
p + geom_point(aes(size = qsec)) + scale_area() 

# passed outside
p + geom_point(colour = "red", size = 3) 
p + geom_point(colour = "grey50", size = 4)

I’ve found these behave differently when it comes to legends. When passing inside aes() I can get a legend to appear, though I need to set breaks even though I only have two differently sized points; otherwise, I get a range of five point sizes even though only 2 are used.

Also, the sizes passed aren’t understandably meaningful; I need to specify the relative size using range=c(min,max) and set breaks to just two sizes instead of the default five.

If I pass size outside of aes(), the sizes seem honored but I can’t get a legend on my plot; I tried scale_size, scale_size_continuous, and scale_size_manual without success.

From the geom_point() page there’s this:

The following aesthetics can be used with geom_point. Aesthetics are
mapped to variables in the data with the aes function: geom_point(aes(x = var))

…

Scales control how the variable is mapped to the aesthetic and are listed after each aesthetic.

[Listing of all the aesthetic options here (shape, colour, size, etc.)]

From that, it’s still not exactly clear how the options (size in this question, but this should be meaningful for other aesthetics) inside and outside of aes() affect the result.

  • 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-06-07T23:56:36+00:00Added an answer on June 7, 2026 at 11:56 pm

    When specified inside aes, an aesthetic is mapped to the value of a variable in the data. Since there is a mapping between the data and the visible aesthetic, there is a legend which shows that mapping. Outside of an aes call, the aesthetic is just set to a specific value. In the examples you show, the size (and colour) are set to the same value for all points. In this case, there is no need for a legend because the size (or colour) does not convey any meaning (with regard to the underlying data).

    The issue you are seeing with the legend is due to the size being mapped to a continuous variable. It happens that there are only two values that this variable takes on in your data, but in principle, a continuous variable could take on any value. If it really is just a choice-of-two variable, make it a factor (either in the original data or in the aesthetic call aes(size=factor(qsec)).

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

Sidebar

Related Questions

After much fiddling, I've managed to install the right ODBC driver and have successfully
After inheriting some Zend Framework code it didn't work, after lots of fiddling I've
Just moved my app to a new CentOS server. After fiddling for a long
Good Sunday morning! After fiddling around with some JavaScript this weekend, I finally wrote
Heya. Finally, after a lot of fiddling, I got a .rc-loaded context menu for
I am learning JS and after fiddling around with adding elements etc I tried
I just can't seem to figure this out even after fiddling with the float
Edit: after much fiddling, it seems urlgrabber succeeds where urllib2 fails, even when telling
After fiddling around with an issue I am having I have come to this
I am new to Ruby on Rails. After fiddling around with it for a

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.