Take the 2-minute tour ×

I am ploting from Matlab with matfig2pgf. I plot two lines put only part of them show up in the .pdf, once it's compiled:

dat1= [-500:1000, rand(1501,1}]
dat2= [-500:1000, cos(rand(1501,1})]

XLimm=[100 300];
plot(dat1(:,1),dat1(:,2),'Color',[0 1 0],'Linestyle','-','Linewidth',1.5)
plot(dat2(:,1),dat2(:,2),'Color',[1 0 0],'Linestyle',':','Linewidth',1.5)
matfig2pgf('filename', 'TeXfig/figure.pgf', 'fignr', 4345,'converttexttolatex',0);

The plot in the .pdf does not show all the lines (once compiled), actually, they are missing in the .pgf already!

What's the reason for that?

Cheers, Jonas

share|improve this question

1 Answer 1

Try not to plot much more points than what is saved to .pgf afterwards if using matfig2pgf.

For instance, index the point you are going to plot:

i_plot= logical((dat1(:,1)>=XLimm(1)).*(dat1(:,1)<=XLimm(2)))
plot(dat1(i_plot,1),dat1(plot,2),'Color',[0 1 0],'Linestyle','-','Linewidth',1.5)

Cheers, Jonas

share|improve this answer
Not an answer to your question, but I'd recommend you to use matlab2tikz instead of matfig2pgf (which matlab2tikz is based on). See github.com/nschloe/matlab2tikz, or mathworks.com/matlabcentral/fileexchange/22022 –  militiaOfDeath Apr 4 '13 at 10:26

Your Answer


