Git Product home page Git Product logo

matlab2tikz's Introduction

The updater in matlab2tikz 0.6.0 (and older) no longer works. Please update manually if you are not using matlab2tikz 1.0.0 or newer!

Build Status DOI matlab2tikz

matlab2tikz is a MATLAB(R) script to convert native MATLAB(R) figures to TikZ/Pgfplots figures that integrate seamlessly in LaTeX documents.

To download the official releases and rate matlab2tikz, please visit its page on FileExchange.

matlab2tikz converts most MATLAB(R) figures, including 2D and 3D plots. For plots constructed with third-party packages, however, your mileage may vary.

Installation

Place the matlab2tikz functions (contents of src/ folder) somewhere where MATLAB(R) can find them: either your working directory or add src/ to the path using addpath.

Make sure that your LaTeX installation is up-to-date and includes:

It is recommended to use the latest stable version of these packages. Older versions may work depending on the actual MATLAB(R) figure you are converting.

Usage

Typical usage of matlab2tikz consists of converting your MATLAB plot to a TikZ/LaTeX file and then running a LaTeX compiler to produce your document.

MATLAB

  1. Generate your plot in MATLAB(R).

  2. Run matlab2tikz, e.g. using

matlab2tikz('myfile.tex');

LaTeX

Add the contents of myfile.tex into your LaTeX source code, for example using \input{myfile.tex}. Make sure that the required packages (such as pgfplots) are loaded in the preamble of your document as in the example:

\documentclass{article}

  \usepackage{pgfplots}
  \pgfplotsset{compat=newest}
  %% the following commands are sometimes needed
  \usetikzlibrary{plotmarks}
  \usepackage{grffile}
  \usepackage{amsmath}
  %% you may also want the following commands
  %\pgfplotsset{plot coordinates/math parser=false}
  %\newlength\figureheight
  %\newlength\figurewidth

\begin{document}
  \input{myfile.tex}
\end{document}

Remarks

Most functions accept numerous options; you can check them out by inspecting their help:

help matlab2tikz

Sometimes, MATLAB(R) plots contain some features that impede conversion to LaTeX; e.g. points that are far outside of the actual bounding box. You can invoke the cleanfigure function to remove such unwanted entities before calling matlab2tikz:

cleanfigure;
matlab2tikz('myfile.tex');

More information

  • For more information about matlab2tikz, have a look at our GitHub repository. If you are a good MATLAB(R) programmer or LaTeX writer, you are always welcome to help improving matlab2tikz!
  • Some common problems and pit-falls are documented in our wiki.
  • If you experience (other) bugs or would like to request a feature, please visit our issue tracker.

matlab2tikz's People

Contributors

egeerardyn avatar nschloe avatar peterpablo avatar ljeub avatar broele avatar blubbafett avatar magicmuscleman avatar aikhjarto avatar aliirmak avatar gontadu avatar karih avatar mkiefel avatar mbauman avatar akloeckner avatar josombio avatar theswitch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.