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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:54:47+00:00 2026-06-15T08:54:47+00:00

t = 0 : 0.01 : 2 * pi; s = sin(t); c =

  • 0
t = 0 : 0.01 : 2 * pi;
s = sin(t);
c = cos(t);
m = -sin(t);

hold on;
plot(t, s, 'r');
plot(t, c, 'b');
plot(t, m, 'g');
hold off;

legend('', 'cosine', '');

The Plotting

There are several curves in my plotting. I want to display legend for only some of them. How do I do it?

For example, how do I make only the legend for the cosine curve visible in the plotting above? When I call the legend() functions as legend('', 'cosine'); instead of adding the empty third parameter, indeed the third green line is removed from the legend. But that doesn’t solve my problem, because the undesired red line stays visible.

  • 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-15T08:54:48+00:00Added an answer on June 15, 2026 at 8:54 am

    Just store the desired legend handles in a variable and pass the array to legend. In your case, it would only be one value, like so:

    hold on;
    plot(t, s, 'r');
    h2 = plot(t, c, 'b');  % # Storing only the desired handle
    plot(t, m, 'g');
    hold off;
    
    legend(h2, 'cosine');  % # Passing only the desired handle
    

    You should get this plot:

    enter image description here

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

Sidebar

Related Questions

This is my code: %cirkel t=linspace(0,2*pi); r1=2; x1=r1.*cos(t); y1=r1.*sin(t); cirkel=plot(x1,y1); set(cirkel,'color','g') axis equal hold
In the math module, I could only find cos/sin/tan/acos/asin/atan. These take the argument, respectively
I'm getting some strange behavior using COS() and SIN() libraries in Fortran 77. It
As you know TCL has some mathematical functions such as sin , cos ,
Is there any sensible way of transforming this: (for ([cos-t (stream-map cos t-range)] [sin-t
I understand what sin and cos (and some other trigonometric functions) means, but I
I'm writing a program that is using the functions sin() and cos() from the
the question is: suppose I have an input function like sin(2-cos(3*A/B)^2.5)+0.756*(C*D+3-B) specified with a
I want to visualise conversion of filters. I would like to plot a scatter
I have three functions in spherical coordinates that I want to plot. They are

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.