2

I am using Matlab 2016b on a Linux 64 bit machine.

I have the following figure in Matlab:

matlab figure

Using a script, I make some changes to the figure text and then call matlab2tikz function. This script is given below.

%% Script to modify text properties and call matlab2tikz
openfig('example.fig')
hfig = gcf;
haxis = gca;

haxis.XLabel.String = 'XLABEL (x 1000)'; 
haxis.XLabel.FontName = 'Lucida Sans Typewriter';
haxis.YLabel.String = 'YLABEL (30 runs)'; 
haxis.YLabel.FontName = 'Lucida Sans Typewriter';

% change tick label fonts
haxis.FontName = 'Lucida Sans Typewriter';
haxis.Legend.FontName = 'Lucida Sans Typewriter';
haxis.XTickLabel = {'2','4','6','8'};
matlab2tikz('example.tex','width','\figurewidth');
close all

When I include the ex.tex in the Latex file, the pgfplot produced has

  1. wrong fonts

  2. wrong x-tick labels,

as shown in the screenshot:

pgflot figure

Can someone tell me what am I doing wrong here ?

closed as unclear what you're asking by Torbjørn T., Stefan Pinnow, Mensch, ebosi, Zarko Jun 21 '17 at 19:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Please, give us a full description here. Have a complete and working MWE, that resembles your problem. (That is from \documentclass to \end{document}.) Instead of linking to external site, please include the images into your question directly. That would help us, to help you. – Jan Jan 20 '17 at 8:11
  • The font problem is probably due to "Lucida Sans Typewriter" not being a valid latex font. Do you compile with xelatex or lualatex? Those can access to OS fonts, but standard pdflatex cannot. Inspect the log file produced by latex looking for "missing font" warnings. – JLDiaz Jan 20 '17 at 8:33
  • That ticklabels are wrong might be due to a "translation" error by matlab2tikz, but without seeing the actual text file, I cannot say for sure. – Torbjørn T. Mar 5 '17 at 10:14