I have looked on the forum and haven't been able to find a solution to my problem.

I have a .tikz file made in MATLAB and exported using matlab2tikz, with two plots containing a very large number of points. I am using the external package to make typesetting quicker, and I am trying to use this figure in a poster for an upcoming presentation. To make it better for the presentation, I have added the option very thick to the start of each plot, e.g.

   scale only axis,
   scaled y ticks=false
\addplot [color=mycolor1,solid,forget plot,very thick]
   table[row sep=crcr]{%
   0    1\\
   0.991020408163266    2\\
   0.993015873015873    3\\
   9.99995464852608 4989\\

\addplot [color=mycolor2,solid,forget plot,very thick]
   table[row sep=crcr]{%
   0    1\\
   0.001950113378685    2\\
   0.00394557823129205  3\\
   9.99795918367347 4989\\


However, I have a problem in that points at the end of the plot are not made very thick, as in the image below.

Lines not all thick

This happens when the option is thick too, and also occurs at any zoom level. Any ideas on how to fix this?

  • 1
    While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. Mar 3, 2016 at 2:29

2 Answers 2


Indeed matlab2tikz splits big sequences of data into smaller plots (the maximum number of points by default is 4000). The reason is explained in the documentation of the function that you can find here:

    % Maximum chunk length.
      % TeX parses files line by line with a buffer of size buf_size. If the
      % plot has too many data points, pdfTeX's buffer size may be exceeded.
      % As a work-around, the plot is split into several smaller plots, and this
      % function does the job.

If you want to increase the threshold you can do that in Matlab passing the option maxChunkLength:

matlab2tikz('maxChunkLength',<integer number>)

If you exceed the buffer size one solution could be to compile the plot using LuaTeX, or (even better) reduce the number of points using the function decimate on Matlab (type doc decimate on the command prompt in Matlab for further info). Apart from rare cases, no one can spot the difference between a graph with 10000 points and its "decimated" version with 4000 points.


After a lot of searching, I found that matlab2tikz(); had split the plots into different parts. Presumably due to a max length requirement.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .