Heatmap font size too small in latex
22 views (last 30 days)
Show older comments
I have created a heatmap for my project and saved it as an eps file. In the figure window, the map looks fine and legible. But when I export the eps to a Latex file, the font size is too small to read. Is there any way to fix it?
Here is the image of the issue:
The code for my heatmaps are as follows:
% Heatmap for estimated ent rate from model
figure('Color',[1 1 1]);
ent_tercile = heatmap(PE_dist_ter,'Colormap',parula, 'ColorLimits',[0 100]);
ent_tercile.YDisplayLabels= {'All','Top','Middle','Bottom'};
ent_tercile.XDisplayLabels = {'Bottom','Middle','Top','All'};
ent_tercile.XLabel = 'Wealth Terciles';
ent_tercile.YLabel = 'Schooling Terciles';
ent_tercile.Title = 'Estimated entrepreneurship rate (Model)';
saveas(ent_tercile,'figures/ent_m_tercile','epsc');
% Heatmap for ent rate from data
figure('Color',[1 1 1]);
ent_tercile_d = heatmap(PE_dist_ter_d,'Colormap',parula, 'ColorLimits',[0 100]);
ent_tercile_d.YDisplayLabels= {'All','Top','Middle','Bottom'};
ent_tercile_d.XDisplayLabels = {'Bottom','Middle','Top','All'};
ent_tercile_d.XLabel = 'Wealth Terciles';
ent_tercile_d.YLabel = 'Schooling Terciles';
ent_tercile_d.Title = 'Entrepreneurship rate (Data)';
saveas(ent_tercile_d,'figures/ent_d_tercile','epsc');
6 Comments
dpb
on 27 Jul 2021
"when I export the eps file to a latex file, the font size still is small."
How do you do that operation -- do you know that the font size is "still small" in the .eps file or only in the end result? It may well be in that step, not the first in which case it may not be MATLAB's fault.
Answers (1)
Dave B
on 26 Jul 2021
Girija -
These solutions will increase the size of all of your text, but I think that's what you're looking for. Resizing a subset of the text would be somewhat trickier.
You could try adjusting the PaperPosition property of the figure. Making smaller 'paper' might help in making the relative size of the text bigger. You can do this with set(gcf,'PaperPosition, ...) (looking at the 3rd and 4th elements to adjust width and height). Or you can play with it interactively in the Print Preview dialog box from the File menu. Note that the changes you make there should influence the export.
An alternate option, which you'll also find in the print preview dialog - there's a tab that reads "Lines/Text" which contains an option for scaling the Font Size. I'm not sure of a way to do that programatically though...
8 Comments
dpb
on 2 Aug 2021
" just want [you] to know that this is a pain that we see (and feel), and that I hope we can do better to reduce it." @Dave B
Thanks again for feedback -- it at least makes users feel much more like there is some concern even if changes are yet a long ways off -- and that perhaps can influence future to having fewer of these kinds of items being released as more consideration is given to being more open/flexible as opposed to opaque.
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!