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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:00:17+00:00 2026-06-15T09:00:17+00:00

I’ve looked around a fair bit but I am stumped on this one. I

  • 0

I’ve looked around a fair bit but I am stumped on this one. I cannot find a way to plot a line that is unassociated with a scatterplot. Here is some of my data and code to clarify the problem. I have data of the following form

> head(allData)
  AnnounceDate MarketProbability DealStatus binary BrierScore
1   2000-04-10         0.3333333   Complete      1  0.2340565
2   2000-06-14         0.2142857   Complete      1  0.3618200
3   2000-06-26         0.6846154   Complete      1  0.3690167
4   2000-06-16         0.1875000   Complete      1  0.4364041
5   2000-10-05         0.9555556   Complete      1  0.3078432
6   2000-10-19         0.8500000   Complete      1  0.2670799

I would like to create a scatter plot of the MarketProbabilities vs. the AnnounceDate, and identify whether a DealStatus is Completed or Terminated using colour.

(ggplot(data=allData, aes(x=AnnounceDate, y=MarketProbability, colour=DealStatus))
 + geom_point() + scale_colour_hue(h = c(180,0)))

enter image description here

I would also like to overlay a rolling Brier score, I have tried

(ggplot(data=allData, aes(x=AnnounceDate, y=MarketProbability, colour=DealStatus))
 + geom_point() + scale_colour_hue(h=c(180,0))
 + geom_line(aes(x=AnnounceDate, y=BrierScore)))

enter image description here

I am confused why two coloured lines are plotted? How do I dissociate the line with the previous plotted data?

  • 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-15T09:00:18+00:00Added an answer on June 15, 2026 at 9:00 am

    As @MattBagg has pointed out, this issue is fixed by moving the aes() for colour out of the main ggplot() call and into the geom_point() call.

    library(ggplot2)
    
    allData = read.table(header=TRUE,
    colClasses=c("Date", "numeric", "character", "numeric", "numeric"),
    text="AnnounceDate MarketProbability DealStatus binary BrierScore
    2000-04-10         0.3333333   Complete      1  0.2340565
    2000-06-14         0.2142857   Complete      1  0.3618200
    2000-06-26         0.6846154   Complete      1  0.3690167
    2000-06-16         0.1875000   Complete      1  0.4364041
    2000-10-05         0.9555556   Complete      1  0.3078432
    2000-10-19         0.8500000   Complete      1  0.2670799")
    
    p1 = ggplot(data=allData, aes(x=AnnounceDate)) +
         geom_point(aes(y=MarketProbability, colour=DealStatus)) + 
         scale_colour_hue(h = c(180,0)) + 
         geom_line(aes(y=BrierScore))
    
    ggsave(filename="plot_1.png", plot=p1, height=2.5, width=5)
    

    enter image description here

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

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.