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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:49:55+00:00 2026-06-06T04:49:55+00:00

I want to add legends in a subplot, bu only for certain plots. Here

  • 0

I want to add legends in a subplot, bu only for certain plots.
Here is my code :

for j = 1:length(FL)
  for i = 1:length(index_list)
    pos=pos+1;
    subplot(size(FL,1),length(index_list), pos)
    legend(num2str(ms_list(i)), 'Location', 'NorthOutside');
    imagesc(imread(FL{j,:},index_list(i)))
    if i==1
        legend(FL(j),'Location', 'WestOutside')

  end 
end

The subplot contains frames extracted from multiframes .tif files. Indexes of the wanted frames are in index_list (the columns). Path to the files wanted are in FL (the rows). What I want to add on the figure is the name of the file at the left of each row and the frame index for each image plotted. ms_list contains the equivalent in milliseconds of the indexes, thats actually what I want to show.
Doing like that returns “Plot empty” at each passage in the loop.

Any idea ?

Thanks

JC

  • 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-06T04:49:57+00:00Added an answer on June 6, 2026 at 4:49 am

    From your description and code, it seems that legend isn’t what you want; rather, you want a title (above the plot) and ylabel (left of certain plots). legend is to give labels to particular objects inside the plot, such as a line series for example.

    for j = 1:length(FL)
      for i = 1:length(index_list)
        pos=pos+1;
        subplot(size(FL,1),length(index_list), pos)
        title(num2str(ms_list(i))); %#<---title here
        imagesc(imread(FL{j,:},index_list(i)))
        if i==1
            ylabel(FL(j)) %#<---ylabel here    
        end 
      end
    end
    

    The reason you were getting an error is that you were applying legend to an empty set of axes. legend labels the children of axes; no children, nothing to label, hence the error.

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

Sidebar

Related Questions

I want add a UIToolbar to the keyboard for my UITextField . Here is
I want add user in ActiveDirectory. I use this code private SPUser CreateUser(string strLoginName,
I have the below graph and I want to add space between legend items.
In Latex, I want to add a reference in the legend of a figure,
Context and Question: I want to add a legend to a lattice plot in
I Want Add Office 2003 Primary Interop Assemblies to Visual Studio. so i following
I want add some methods. And this directive can't help me. var viewModel =
I want add 12 UITextFields in a UITableViewCell (one text field in each row),
I want add my custom sidebar next right column all page. Please check this
I write a module,and want add it to kernel.It will print a world 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.