Wednesday, June 10, 2009

Matlab Vector Graphics

Matlab v7.5 still has trouble with vector graphics. When trying to create a vector image it, instead, generates a bitmap image if you use rgb colors (for example in scatter) instead of colormap indices.

Here's an example:

But there is a workaround. Instead of doing this:

Do it like this to be able to export in vector format (like eps):

Now each point, instead of being colored by the rgb data, it is indexed to the custom colormap, which is exactly made up of the rgb data we want. Now it is possible to export to vector.

(Sorry, blogger doesn't like svg.)