Home > MATLAB, Technology, Tips > MATLAB to PSTricks

MATLAB to PSTricks

So, I’ve been trying to include more good looking figures into \LaTeX. I came across an script to convert from MATLAB to pstricks. However, it looks like it is not maintained anymore.

However, I made some little changes and fix a bug that I found. So, I want to put it here for anyone who is interested in use it.

The changes from the original:

  • The standalone file generation uses the standalone package, so (in theory) can compile faster. Because, for some strange reason, when I include these files into any document it takes forever to compile.
  • Now, the script can set any option from the options data structure (see the file to understand what I’m saying) individually, instead of passing the whole thing.
  • I fix a bug for data points outside of the axes not appearing.

The script is really good, although it has some limitations. Still, I will try to keep this entry up to date if I made some changes to the file.

So the script is here: fig2texps. To use the script easily call

h = figure; % a handle for the figure
plot(...);  % your figure here
fig2texps(h,'file.tex'); % basic invocation

To check all the options you can set see the globals struct in line 187.

Hope that helps… :mrgreen:


(07.11.11) I found one bug, if the legend is outside of the figure the labels were place improperly. I hope it is fixed now.

(16.11.11) Fix bug when lines are out of the axis box. If two points were above or below the axis a line was drawn. Now, it is not.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: