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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:41:09+00:00 2026-06-19T03:41:09+00:00

I have some code that basically does this: for i = 1:length(ReliabilityStruct) if (FailureFlags(i)

  • 0

I have some code that basically does this:

for i = 1:length(ReliabilityStruct)
    if (FailureFlags(i) == 0) 
        plot(X(i), Y(i), '.b');
    elseif (FailureFlags(i) == 1)
        plot(X(i), Y(i), 'or');
    elseif (FailureFlags(i) == 2)
        plot(X(i), Y(i), 'og');
    elseif (FailureFlags(i) == 3)
        plot(X(i), Y(i), 'ok');
    else
        fprintf('\nUnknown Flag, check Data\n')
        return
    end
end
drawnow;
legend('Recovery', '1', '2', '3');

So my aim is to make a graph that has different symbols for different flags. See below:

enter image description here

As you can see, the Legend doesn’t exactly fit the data. How can you change each of the legend entries to fix this up? Alternatively, is there a better way to approach this?

  • 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-19T03:41:10+00:00Added an answer on June 19, 2026 at 3:41 am

    I think you can use something like this (added bonus is that you avoid loops!):

    ind = FailureFlags==0;
    plot(X(ind), Y(ind), '.b');
    
    ind = FailureFlags==1;
    plot(X(ind), Y(ind), 'or');
    
    ind = FailureFlags==2;
    plot(X(ind), Y(ind), 'og');
    
    ind = FailureFlags==3;
    plot(X(ind), Y(ind), 'ok');
    
    legend('Recovery', '1', '2', '3');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that does custom drawing. Basically it is form fill program
I am working on some code, basically I have a form. On that form
I have some code that looks like this: foreach(var obj in collection) { try
I have some code that essentially does what I want but I always like
I have some code that looks like this: int i = 0; foreach (var
I have a button in a window that basically does a rerun through some
I have some code that approximates a solution recusively, what it actually does is
I have some code that uses a native mozilla browser and it does a
I have some code that looks like this (I left out the parts that
I have some code that will change the background color of a specific label

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.