I've been trying to make plots of some data for a text I'm writing with TeX. I'm using this piece of code for changing and printing the plots:
set(0,'defaulttextinterpreter','latex');set(0,'DefaultTextFontname', 'CMU Serif')set(0,'DefaultAxesFontName', 'CMU Serif')set(gcf,'PaperPositionMode','auto'); set(gcf,'PaperOrientation','landscape');% I've tried this before, doesn't change the outcome
% set(gca,'FontName','CMU Sans Serif');
print('-dpdf','-bestfit','filename.pdf');
This works perfectly for some mesh plots im using:
mesh(data);
but for a histogram:
histogram(different_data,'EdgeColor','none','BinWidth',1,'Normalization','probability');
I get a nice figure:
but a bad pdf file:
Does anyone know a way I can fix this within matlab?
Best Answer