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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:15:00+00:00 2026-05-16T17:15:00+00:00

Assume that the data X has size 1000 *1000. X is displayed using the

  • 0

Assume that the data X has size 1000 *1000. X is displayed using the command:

imagesc(X);

and all the rows are labeld using:

set(gca, 'YTickLabel', somelabels);

Although the data X are properly polotted and the Ytick labels are also shown, the labels are highly overlapped because of the large number of rows. Is there any way to solve the problem? Any help will be highly appreciated.

Edit 1

I realize my question was not stated well to represent my problem. I am going to wrap up my understanding based on the answers and re-ask a question:

  1. To show as many rows/labels in a Figure Window, the following helps:

    set(gca,'FontSize',6), 
    or, alternate the distance (suggested by yuk),
    or, set(gca,'YTick',1:10:1000,'YTickLabel',somelabels(1:10:1000));
    
  2. The code

    set(gca,'Units','pixels','Position',[20 20 10000 10000]);
    

    will display a zoomed-in image by default. But if the zoomed-in image is too large to fit in the Figure Window, only part of the image will be displayed. However, neither zoom out nor the pan tool can reach to the rest part of that image.

  3. The default behavior of the code

    imagesc(X);
    set(gca, 'ytick', 1:1000, 'yticklabe', ylabel);
    

    displays the whole image fitting to the Figure Window with overlapping labels. Nevertheless, it does allow one to zoom into part of the image and to see the un-overlapped labels.

  4. If I save the image into a pdf file:

    imagesc(X);
    set(gca, 'ytick', 1:1000, 'yticklabe', ylabel);
    saveas(gcf, 'fig.pdf');
    

    Then the saved pdf is only the image fit to the Figure Window with overlapping labels. However, unlike zoom in within Matlab figure window, zoom in within a pdf reader won’t change the relative position/distance of labels. As a result, the zoomed-in image in pdf is still label-overlaped.

So my question is:
How to save the image into a pdf file or png such that it has a similar behavior as of point 3 above when opened in Adobe reader, rather than that of point 4?

  • 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-05-16T17:15:01+00:00Added an answer on May 16, 2026 at 5:15 pm

    You can also play with axes label font to make it smaller.

    set(gca,'FontSize',6)
    

    See also other axes properties to change font – FontName, FontWidth, FontUnits, etc.

    Another solution: If your labels are short, you can alternate there distance from the axes, so the labels will not overlap. Check this example:

    lbl = cellstr(reshape(sprintf('%3d',1:100),3,100)');
    lbl(1:2:100) = strcat(lbl(1:2:100),{'     '});
    imagesc(rand(100))
    set(gca,'ytick',1:100)
    set(gca,'yticklabel',lbl)
    

    Part of the resulted image:

    example image

    UPDATE

    To answer your updated question.

    1. PDF document can contain only static images. Once you saved the figure to PDF (or any other graphic file), you cannot zoom in/out as with MATLAB figure tools.
    2. You can zoom first on the MATLAB figure, then save PDF file. In this case the figure will be saved as is. But this way assumes user interactivity with the figure.
    3. If you know your region of interest in advance, you can set axes limits with XLim/YLim properties, then save the figure.

    Example:

    imagesc(X);
    set(gca, 'ytick', 1:1000, 'yticklabe', ylabel);
    set(gca, 'XLim',[1 20], 'YLim', [20 40])
    saveas(gcf, 'fig.pdf');
    

    By the way, you can also save figure to file with PRINT function. More flexible. SAVEAS is just wrapper around it.

    print('-dpdf','fig.pdf')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have the ItemSource bound and i am getting the data. Now
Let's assume that we have a data frame x which contains the columns job
Assume I have a application that stores data,gets data and processes data and stores
Assume that we have two sets: A=(a_1,a_2,...,a_m) and B=(b_1,b_2,...,a_n) (Not necessarily of same size).
Assume that I have a backbone model that has a bunch of boolean attributes:
I have a table, that has many columns with all kinds of datatypes. I
I have an ASP.NET website that I built that has grown considerably in size
I'm looking for a data structure that has the following properties. Stores a list
Let us assume that we have a simple UI that has only one state
Assume that i have created a client TCP Socket in Activity A. I want

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.