Skip to content

mykappa/m2tp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

m2tp View m2tp - matlab2tikz Standalone PDF Preview on File Exchange

matlab2tikz standalone PDF preview

m2tp icon

Purpose

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.

Getting Started

Prerequisites

Installation

  1. Extract ZIP file or clone repository to a convenient location
  2. Add directory to MATLAB® path (optional)

Usage

  1. Create plot in MATLAB®
  2. Generate TikZ file with matlab2tikz
  3. Preview TikZ file as PDF document with m2tp

Example

% 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])

Remarks

Please note how matlab2tikz handles the dimensions of the output PDF file — see e.g. matlab2tikz issue #1090.

License

This project is licensed under the MIT License — see the LICENSE for details.