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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:44:00+00:00 2026-06-10T20:44:00+00:00

I am getting some funny behaviour for colors in a legend I am adding

  • 0

I am getting some funny behaviour for colors in a legend I am adding to a plot. The plot is fairly hard to reproduce, but the behaviour can be reproduced from the example below:

mod3.cor.spo = 10
mod2.cor.spo = 10
mod1.cor.spo = 10
mod1.MBE.spo = 10
mod2.MBE.spo = 10
mod3.MBE.spo = 10
plot(1:10)
legend("bottomleft", 
       c(paste("r = ", sprintf("%1.3g", mod1.cor.spo)," MBE = ", sprintf("%1.3g", mod1.MBE.spo), "%", sep=""), 
                       paste("r = ",sprintf("%1.3g", mod2.cor.spo)," MBE = ", sprintf("%1.3g", mod2.MBE.spo), "%", sep=""), 
                       paste("r = ",sprintf("%1.3g", mod3.cor.spo)," MBE = ", sprintf("%1.3g", mod3.MBE.spo), "%", sep="")), 
       cex=0.6, col=c("red","blue","orange"), bty="n" )

Hopefully if you try this you should see that the text in the legend is all printed out black. What I expected (and wanted) to happen was that the legend (which prints out in three rows) would have the first row of text colored red, second row blue and the bottom row orange.

Is there something I am doing wrong here? Is it down to the use of combining lots of character strings?

  • 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-10T20:44:01+00:00Added an answer on June 10, 2026 at 8:44 pm

    You have to write text.col=c("red","blue","orange") instead of col=c("red","blue","orange") see ?legend

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

Sidebar

Related Questions

Getting some odd behavior from google custom search that I can't seem to suss
I'm getting some inexplicable behavior from easymock and a JUnit test case. I'm receiving
I'm getting some very strange behaviour using the following switch statement: string recognise_mti(int mti_code)
I've been getting some extremely bizarre behaviour where NHibernate queries start to hang. I've
We're getting some funny behavior in the Visual Studio debugger with the following. I'm
Getting some zlib error in the middle of cloning big (4 GB) repo from
I am getting some API information from Weather Underground and was wondering if it
Im getting some images from a webpage at a specified url, i want to
I'm getting some strange behaviour with my form (using Zend Form). I have a
Getting some funny bugs here. Is there anything that stands out? Specifically relating to

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.