Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent LATEX-labels in MATLAB GUI to become blurry?

Within my current MATLAB GUI project, i have two axes objects. The first is used by the workaround "uibutton" (I don't use GUIDE) in order to display a LaTeX-formula (as far as I know, only axes labels are capable to use LaTeX whereas normal static text fields aren't...). The other axes object is used to actually plot a 3D-function.

The program has the following steps:

  1. the first axes creats the LATEX-formula (e.g. f(x)=).
  2. User enters a function in the edit field after the LaTeX-formula (e.g. f(x)=a+b).
  3. User presses a "plot"-button.
  4. 3D-function is plotted in the second axes object.

Problem:

As soon as the 3D-function is plotted, the nicely rendered LaTeX-formular becomes crisp. Is there any way to prevent this from happening?

Problem Demonstration

http://i42.tinypic.com/348pq2u.png (See picture for problem demonstration)

like image 540
dieterw Avatar asked Feb 28 '12 20:02

dieterw


1 Answers

Check your figure properties before and after you draw the 3D plot

get(gcf, 'renderer')

My guess is that plotting the 3D function changes the renderer from the default ("painters") to another (likely OpenGL). Matlab's Latex rendering does not seem to play well with zbuffer or OpenGL (these produce bitmaps rather than line art).

You may be stuck if painters can't render your 3D graphics properly, but you can try to force it by setting the renderer manually back to painters

set(gcf, 'renderer', 'painters')
like image 142
Marc Avatar answered Sep 27 '22 02:09

Marc