Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8407033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:16:27+00:00 2026-06-09T23:16:27+00:00

matlab2tikz is a great package for converting matlab / octave figures to tikz code.

  • 0

matlab2tikz is a great package for converting matlab/octave figures to tikz code.

However if the figure contains a lot of points the resulted tikz code is very heavy for latex to typeset. Some times compilation even fails with the message that: TeX capacity exceeded, sorry.

Is there a way to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:16:28+00:00Added an answer on June 9, 2026 at 11:16 pm

    matlab2tikz has a very clever option of downsampling the figures during the conversion to tikz-pgf. It is called minimumPointsDistance. This does remedy the situation in most of the times.

    However, sometimes it can distort certain “stiff” areas of the curve when the actual number of points kept drops very low. This is illustrated in the following picture

    enter image description here

    The blue curve (1184 points) is the original while the red one (117 points) is the reduced. The distortion is obvious.

    To deal with this and at the same time keep the number of points low I wrote a new point reduction algorithm which is much more effective (but can be slower sometimes). The results (red curve is 116 points)

    enter image description here

    It is clear that the distortion is gone.

    But there still is

    one more disadvantage

    that exists in both algorithms. When one converts a batch of figures to tikz, they usually want uniform quality for all reduced diagrams. But sometimes this is not possible (at least without extra effort) because typically minimumPointsDistance must be set differently for each one of the figures and the results actually depend on the size of the intervals [min_y, max_y] and [min_x, max_x] as well as the number of points in the figure.

    So in order to overcome this problem and make minimumPointsDistance able to be set at a specific value uniformly for all figures, producing reduced versions of uniform quality, normalisation is used, and now minimumPointsDistance “internally” refers to the actual size of the printed-on-paper figure.

    You can download the modified matlab2tikz.m file from here along with instructions.

    NOTE that exhaustive tests were NOT made so be careful!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.