nschloe/matlab2tikz — pull request #358 by okomarov (2014-10-14 17:28:13+00:00)
Title: [Fixes #294,#333] patch: index unique cdata into colormap and retrieve color

I am picking the RGB color from the colormap if the `cData` for the patch doesn't change. This solves through the fill option the problem with triangular patches.

**Note**: creating the colormap and leaving `'point meta=\thisrow{c}'` in the table doesn't index correctly into the colormap because we need to convert `cdata2colorindex` (and extract the colours?). I just decided to go with the `fill=...` option using the existing API.

I test with if it has unique `cData` with:

~all(cData == cData(1)) && length(cData) == length(xData)

where the initial logical operation is equal to `numel(unique(cData)) ~= 1` but I am avoiding `unique()` for performance considerations.

Later, I am converting the `faceColor = 'interp'` (when CData is not empty) to an RGB color.

Potential issues:

* Haven't checked the ACID tests, but shouldn't break anything
* Using the fill option avoids creating triangular patches but doesn't close the borders as in

patch([2 2 5 5],[1 2 2 1],'red')
axis([0,6,0,6])
matlab2tikz('patchNonClosedBorder.tex','standalone',true)

the proper (?) way to go would be to create a `patch type=rectangle`?