TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 – ritualmagick Apr 4 '13 at 10:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.