matlab2tikz/matlab2tikz

version 1.0.0.0 (205 KB) by Nico Schlömer
A script to convert MATLAB/Octave into TikZ figures for easy and consistent inclusion into LaTeX.

112.5K Downloads

Updated22 Aug 2022

From GitHub

View License on GitHub

Editor's Note:Popular File201320152016201820192020

This is matlab2tikz, a MATLAB(R) script for converting MATLAB figures into native TikZ/Pgfplots figures.
matlab2tikz supports the conversion of most MATLAB figures, including 2D and 3D plots. For plots constructed with third- party packages, your mileage may vary.
The workflow is as follows.

a. Place the matlab2tikz scripts (contents of src/ folder) in a directory where MATLAB can find it (the current directory, for example). b. Make sure that your LaTeX installation includes the packages

TikZ (aka PGF, >=2.00) and
Pgfplots (>=1.3).
Generate your plot in MATLAB.

Invoke matlab2tikz by
```
>> matlab2tikz();
```
or
```
>> matlab2tikz('myfile.tex');
```
脚本接受许多选项;检查你t by invoking the help,
```
>> help matlab2tikz
```
Sometimes, MATLAB makes it hard to create matching LaTeX plots by keeping invisible objects around or stretches the plots too far beyond the bounding box. Use
```
>> cleanfigure;
>> matlab2tikz('myfile.tex');
```
to first clean the figure of unwanted entities, and then convert it to TeX.

Add the contents of `myfile.tex` into your LaTeX source code; a convenient way of doing so is to use `\input{/path/to/myfile.tex}`. Also make sure that at the header of your document the Pgfplots package is included:
```
\documentclass{article}
\usepackage{pgfplots}
% and optionally (as of Pgfplots 1.3):
\pgfplotsset{compat=newest}
\pgfplotsset{plot coordinates/math parser=false}
\newlength\figureheight
\newlength\figurewidth
\begin{document}
\input{myfile.tex}
\end{document}
```
There are reported incompatibilities with the following LaTeX packages:

signalflowdiagramhttp://www.texample.net/tikz/examples/signal-flow-building-blocks/(查看http://sourceforge.net/tracker/?func=detail&aid=3312653&group_id=224188&atid=1060656.)
If you experience bugs, have nice examples of what matlab2tikz can do, or if you are just looking for more information, please visit the web page of matlab2tikzhttps://github.com/matlab2tikz/matlab2tikz.

Cite As

Nico Schlömer (2022).matlab2tikz/matlab2tikz(https://github.com/matlab2tikz/matlab2tikz), GitHub. Retrieved.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit theGitHub Repository.
To view or report issues in this GitHub add-on, visit theGitHub Repository.