matlab2tikz standalone PDF preview
m2tp
lets you generate a PDF preview of a TikZ image created by matlab2tikz directly from MATLAB®.
The basic idea is to be able to view and adjust graphics as you create them without having to switch back and forth between MATLAB® and your LaTeX editor. The potentially time-consuming iterative adjustment process of the TikZ graphic in the main LaTeX document can thus be avoided.
- matlab2tikz
- nextname by Stephen Cobeldick
- Working and up-to-date LaTeX environment with the following packages:
- TikZ/PGF version 3.0 or higher
- pgfplots version 1.13 or higher
- amsmath version 2.14 or higher
- standalone
- hyperref
- Extract ZIP file or clone repository to a convenient location
- Add directory to MATLAB® path (optional)
- Create plot in MATLAB®
- Generate TikZ file with
matlab2tikz
- Preview TikZ file as PDF document with
m2tp
% Plot data (simple sine wave)
x = 0 : 0.01 : 2*pi;
y = sin(x);
figure
plot(x, y)
% Create TikZ image
matlab2tikz('my_tikz_image.tikz')
% Preview Tikz image
fig_width = 10; % pdf image width in cm
fig_height = 3; % pdf image height in cm
m2tp('my_tikz_image.tikz', [fig_width, fig_height])
Please note how matlab2tikz handles the dimensions of the output PDF file — see e.g. matlab2tikz issue #1090.
This project is licensed under the MIT License — see the LICENSE for details.