Sizing legend in a png file

5 views (last 30 days)
Dan Mirea
Dan Mirea on 31 Mar 2019
Commented: Dan Mirea on 31 Mar 2019
I am trying to resize the legend to cover only the bottom right corner of my figure. It looks good when I am running the code but it appears too large in the png file. What do you guys suggest in this situation? many thanks for your help.
  4 Comments
Walter Roberson
Walter Roberson on 31 Mar 2019
Your legend is being generated with a fixed font size and line width. Those do not refer to sizes relative to resolution: those refer to fixed sizes. Fontsize 11 is 11 points is 11/72 of an inch.
You are rendering the legend into an image with a somewhat small physical area. The legend has been defined to take up a large size relative to that small area.
With you using -r300 chances are good that you could have generated a perfectly readable legend with a smaller font size. Your current fontsize of 11 is 11/72*300 ~= 45 pixels, and your current linewidth of 1.5 is 1.5/72*300 ~= 6 pixels.
Dan Mirea
Dan Mirea on 31 Mar 2019
I did change the fontsize but the figure looks exactly the same including the legend. What approach would you recommend sir?

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!