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

  • Home
  • SEARCH
  • 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 8890793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:35:00+00:00 2026-06-14T22:35:00+00:00

In both plots the points look different, but why? mya <- data.frame(a=1:100) ggplot() +

  • 0

In both plots the points look different, but why?

mya <- data.frame(a=1:100)

ggplot() +
  geom_path(data=mya, aes(x=a, y=a, colour=2, size=seq(0.1,10,0.1))) +
  geom_point(data=mya, aes(x=a, y=a, colour=1, size=1)) +
  theme_bw() +
  theme(text=element_text(size=11))

ggplot() +
  geom_path(data=mya, aes(x=a, y=a, colour=2, size=1)) +
  geom_point(data=mya, aes(x=a, y=a, colour=1, size=1)) +
  theme_bw() +
  theme(text=element_text(size=11))

?aes_linetype_size_shape explains …

 # Size examples
 # Should be specified with a numerical value (in millimetres),
 # or from a variable source

But in my code it looks different.

  • 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-14T22:35:01+00:00Added an answer on June 14, 2026 at 10:35 pm

    There are a couple of confusing things happening in your code. You seem to be using the aes function in a way that is not intended. As well as the size issue, you are getting multiple legends, and I think ggplot is confused about the colours.

    The aes function is used to map aesthetics to variables in the data, but you are using it to set aesthetics to a constant. In addition, you are using the aes function to set two separate aesthetics. Even though you set size to a constant, ggplot2 does not like two separate (paths and points) size mappings. Further, you do the same with a colour mapping.

    size and colour are set to constant values so move them outside the aes function. Also, with respect to size of the path in the first plot, it is probably safer to add a size variable to the data frame. (I’ve modified your data a little so that both points and paths are visible.) And as expected, one legend in the first plot is drawn.

        library(ggplot2)
    mya <- data.frame(a=1:10, size = seq(10, 1, -1))
    
    ggplot() +
      geom_path(data=mya, aes(x=a, y=a, size=size), colour = 2) +
      geom_point(data=mya, aes(x=a, y=a), colour = 1, size = 3) +
      theme_bw() +
      theme(text=element_text(size=11))
    
    ggplot() +
      geom_path(data=mya, aes(x=a, y=a), colour = 2, size = 1) +
      geom_point(data=mya, aes(x=a, y=a), colour = 1, size = 3) +
      theme_bw() +
      theme(text=element_text(size=11))
    

    enter image description here

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

Sidebar

Related Questions

I'm generating binhex plots of data points faceted by different groups. Each group potentially
I want to plot data from different data frames with ggplot. However, I'm having
I have two sets of data points that both relate to the same primary
Both of these frameworks are great, but I've noticed that Knockout likes to point
Both Network.Socket.ByteString and Network.Socket.ByteString.Lazy have a send function. Network.Socket.ByteString has a sendTo function, but
Both methods MyBehavior::CreateSerializer() are not called of some reason, but ReplaceBehavior() method is working.
I have a scenario where, the data (both x and y coordinates) comes dynamically.
Let's say I have the following dataset bodysize=rnorm(20,30,2) bodysize=sort(bodysize) survive=c(0,0,0,0,0,1,0,1,0,0,1,1,0,1,1,1,0,1,1,1) dat=as.data.frame(cbind(bodysize,survive)) I'm aware that
I'm trying to plot two data sets with gnuplot. They are both (x, y,
The following code plots to two PostScript (.ps) files, but the second one contains

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.