rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
Functions
plot_as_tikzfile.m File Reference

postprocesses a figure and write out an image and a text file that can be included in TeX documents. More...

Go to the source code of this file.

Functions

function clim = plot_as_tikzfile (model, params)
 postprocesses a figure and write out an image and a text file that can be included in TeX documents. More...
 

Detailed Description

postprocesses a figure and write out an image and a text file that can be included in TeX documents.

Definition in file plot_as_tikzfile.m.

Function Documentation

function clim = plot_as_tikzfile (   model,
  params 
)

postprocesses a figure and write out an image and a text file that can be included in TeX documents.

This method creates three files from a MATLAB figure specified by

params.figure_handle
  • A png coded image file containing a snapshot of the figure box
  • A text file ending .tikz that can be included in a LaTeX document adding axes and meta information around the png file.
  • A text file ending _test.tex that can be compiled with pdflatex and outputs a pdf file with the figure output.
Why this is better than including the png file directly
When scaling images for MATLAB figures, often the text for the ticks, legends and axes description is scaled to an unreadable size. Furthermore, text sizes can differ between a LaTeX document and the MATLAB Monospace font type does not look nice in the PDF output. The solution here, circumvents all these problems, because all text used inside the figures will be generated during pdflatex compilation phase.
Parameters
modelmodel
paramsOptions controlling the output
Return values
climclim
Required fields of params:
  • figure_handle —  handle to the figure that shall be postprocessed
  • filename —  base of filename for the three generated files filename.png, filename.tikz and filename_test.tex
  • filepath —  path where the output files shall be stored
  • width —  width of output picture in pixels.
  • scaleaxis —  scaleaxis
Optional fields of params:
  • height —  height of output picture in pixels. If this parameter does not exist or is set to zero, the height is calculated from the width and the pictures ratio.
  • save_colorbar —  boolean specifying wether separate files for the colorbar is generated.
  • print_axes —  boolean specifying wether the tikz file shall include drawing commands for axes around the picture. (Default=true)
  • print_axes_label —  boolean specifying wether the tikz file shall include drawing commands for labels at the axes. This field is ignored if print_axes is set to false. (Default=true)
  • ticks —  integer specifying how many ticks should be added to the axes drawn around the figure. This field is ignored if print_axes or print_axes_label is set to false. (Default=5)

Definition at line 17 of file plot_as_tikzfile.m.

Here is the caller graph for this function: