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

The Archive Base Latest Questions

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

I want to plot a path and show where the datapoints are. Combine Points

  • 0

I want to plot a path and show where the datapoints are.

Combine Points with lines with ggplot2
uses geom_point() + geom_line() but I do not like that the dots are much thicker and the lines have a discontinuous look - x - x ----- x --- thus I decidet to

create my own dotted line:

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

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))

example of a nice line

I like that the dots and the line have the same size. I did not use the alpha channel because I fear trouble with the alpha channel when I include the files in other programs.

open problems:

  • R should not create those legends
  • can R calculate the “darker colour” itself? darker(FF0000) = AA0000
  • how can I manipulate the linethickness? The size= parameter did not work as expected in R 2.15
  • 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:34:09+00:00Added an answer on June 14, 2026 at 10:34 pm

    Aesthetics can be set or mapped within a ggplot call.

    • An aesthetic defined within aes(…) is mapped from the data, and a legend created.
    • An aesthetic may also be set to a single value, by defining it outside aes().

    In your case it appears you want to set the size to a single value. You can also use scale_..._manual(values = ..., guide = 'none') to suppress the creation of a legend.
    This appears to be what you want with colour.

    You can then use named colours such as lightblue and darkblue (see ?colors for more details)

    ggplot() +
     geom_line(data=mya, aes(x=a, y=a, colour='light'), size = 2) +
     geom_point(data=mya, aes(x=a, y=a, colour='dark'), size = 2) + 
     scale_colour_manual(values = setNames(c('darkblue','lightblue'), 
                                           c('dark','light')), guide = 'none') +
     theme_bw()
    

    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 want to plot different points and show the data in a chart in
I have the following plot but do not want the legend for point size
I want to plot several lists of points, each list has distance (decimal) and
I want to plot 3D points in Matlab in different colors depending on a
I want to plot some data. The first column contains the x-data. But matplotlib
I want to plot some confidence interval graphs in MATLAB but I don't have
I want to plot multiple lines on the sample plot using qplot in the
I want to plot the data points that are in a 1-D array just
I want to draw path from one location to other location. How to plot
I want to plot a barplot of some data with some x-axis labels but

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.