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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:10:45+00:00 2026-06-08T03:10:45+00:00

I am using plot(X) where X is an n-by-k matrix, which produces k plots

  • 0

I am using plot(X) whereX is an n-by-k matrix, which produces k plots with n points.

How do I show the legend for this plot? More importantly, is there an easy way to show checkboxes to show or not show certain plots?

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

    I think you can find this section of Documentation useful.
    GUI that Displays and Graphs Tabular Data
    http://www.mathworks.com/help/techdoc/creating_guis/bropmbk-1.html

    Please use this body for plot_callback function in tableplot.m file to get a dirty implementation of the flexible legend.

    function plot_callback(hObject, eventdata, column)
    % hObject     Handle to Plot menu
    % eventdata   Not used
    % column      Number of column to plot or clear
    
    colors = {'b','m','r'}; % Use consistent color for lines
    colnames = get(htable, 'ColumnName');
    colname = colnames{column};
    lgidx = get(haxes, 'UserData');
    if isempty(lgidx)
       lgidx = false(size(colnames));
    end
    
    if get(hObject, 'Value')
        % Turn off the advisory text; it never comes back
        set(hprompt, 'Visible', 'off')
        % Obtain the data for that column
        ydata = get(htable, 'Data');
        set(haxes, 'NextPlot', 'Add')
        % Draw the line plot for column
        hplot = plot(haxes, ydata(:,column),...
                 'DisplayName', colname,...
                 'Color', colors{column});
        lgidx(column) = true;
    else % Adding a line to the plot
        % Find the lineseries object and delete it
      hplot = findobj(haxes, 'DisplayName', colname);
      lgidx(column) = false;
      delete(hplot);
    end
    if any(lgidx)
      legend(haxes, colnames{lgidx} );
    else
      legend(haxes, 'off')
    end
      set(haxes, 'UserData', lgidx);
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 50x50 matrix which I am using to plot imagesc plot. I
Is it possible to plot a matrix of scatter plots with ggplot2 , using
Hi have followed this tutorial using Core plot framework http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application My project compiles, but
I am trying to follow this tutorial ( Using-core-plot-in-an-iphone-application ). When I try to
I am using pcolor with a custom color map to plot a matrix of
All the three variables I am using to plot are matrix of size 1x1x100
I want to plot a confusion matrix using Pylab. The class labels along the
Is there a way using Core Plot to have periodic labels assigned to data
I'm trying to show a contour plot using matplotlib from a complex array. The
How can I improve the legend of spatial raster map plot using ggplot when

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.