I didn't upload an image of the figure since I can't upload eps files, but here's a screenshot of my figure so you have an idea of what I mean:
Fix Extra Space in Figure using xlabel
8 views (last 30 days)
Show older comments
I am currently trying to prepare some figures for a final draft of my paper. I have generated some data and plotted a histogram using histfit. I then attempt to label the data using xlabel. I then set the size of the histogram to save it.
All well and good. However, when I save the figure using saveas, I have a big space between the m and the 2. As expected, Matlab is interpreting this as LaTeX code and it's appearing as a superscript. However, I'd like to get rid of the space between the m and the 2.
What's strange is that if I save as an eps, I have this problem, but if I save as a pdf I don't. Here's my minimal working example:
hSize=[6.5,2.5];
A=50*rand(200,1);
histfit(A,20,'gamma')
xlabel('Measured Area (m^2)')
ylabel('Frequency')
set(gcf,'Color',[1 1 1],'PaperUnits','inches','PaperSize',hSize,...
'PaperPosition',[0 0 hSize]);
saveas(gcf, [mypath, '/example.eps'],'epsc') %replace mypath with your own path
Accepted Answer
Star Strider
on 12 Feb 2015
6 Comments
Star Strider
on 12 Feb 2015
My pleasure!
I’ve had LaTeX work when other options didn’t. You can also specify the font in xlabel, but I’m not sure if all fonts work and play well with LaTeX.
More Answers (0)
See Also
Categories
Find more on Printing and Saving 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!