Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to export figures with transparent shapes in Matlab to TeX. For the following code, the triangle will appear transparent in Matlab but will be solid blue when I generate the tex file using \input{triangle.pgf}

Matlab Code:

x = [ 1         -0.5         -0.5            1];
y = [0      0.86603     -0.86603 -2.4493e-016];

f = figure;
t = fill(x,y,'b'); 
alpha(t,0.05);

matfig2pgf('fignr',1,'filename','triangle.pgf','figwidth',14);
share|improve this question
    
Can you show us the resulting source-code 'triangle.pgf'. I assume there is just a single parameter missing for transperency called 'opacity=x'. –  xeroc Jan 26 '11 at 11:03

1 Answer 1

Instead of using the old matfig2pgf, try matlab2tikz. It's newer, more supported, and uses pgfplots. Replace your call to matfig2pfg with matlab2tikz('triagle.tikz'), and then use it in your LaTeX document like so:

\documentclass{article}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.4}

\begin{document}
  \input{triangle.tikz}
\end{document}

alt text

share|improve this answer
    
matlab2tikz doesn't work when using geoshow from the mapping toolbox in Matlab however. –  Elpezmuerto Jan 6 '11 at 19:43
    
Ah, I don't have the mapping toolbox, so I'm afraid I cannot help you there. I presume simply exporting to PDF or EPS isn't satisfactory? –  Matt B. Jan 6 '11 at 20:36
    
that would be correct –  Elpezmuerto Jan 6 '11 at 20:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.