surf
我生成了带有单独颜色图的输出matlab2tikz
,这导致每个单独像素的颜色被设置为一个颜色值,并且每个surf
数据点被分配一个单独的值,这些值是从颜色图中读取的。
现在,我的矩阵是 101x101,因此有 10200 个颜色图点。有时,pgfplots 开始抱怨颜色条点不在网格上,这根本不是事实。错误是
! Package pgfplots Error: The provided colormap positions are not multiples of
the prescribed mesh width h=1.0000000000 (found one with H/h = 0.9999/1.0000000
000= 1+-0.0001 which is no integer). The error occured near `rgb(1019pt)=(0.998
332,0.993606,0.989873) (color no 1019) '.
See the pgfplots package documentation for explanation.
Type H <return> for immediate help.
...
l.435 ]
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.
从这里开始,错误随机出现在其他几种颜色中,直到pdflatex
得出(That makes 100 errors; please try again.)
。我没有得到 MWE,因为错误不会发生在小矩阵上。错误点周围的颜色图看起来像
colormap={patchmap}{
[1pt] rgb(0pt)=(0.683515,0.87866,0.82487);
% snip
rgb(918pt)=(0.378751,0.761814,0.656226);
rgb(919pt)=(0.962889,0.857741,0.774684);
rgb(920pt)=(1,1,1);
rgb(1018pt)=(1,1,1);
rgb(1019pt)=(0.998332,0.993606,0.989873);
rgb(1020pt)=(0.562949,0.832435,0.758153);
% snip
},
并且数据矩阵中没有虚假浮点数。
答案1
虽然问题尚未解决,但至少对我来说有一个可行的解决方法。我只是使用imagesc
并将颜色条拆分为我需要数据点具有的两种颜色(参见问题)。然后,我将所有点缩放为x in [0,.5[
,不同颜色的点得到 .5 偏移量x in [.5,1]
。结果令我满意,并使用我喜欢的 tex 变体进行编译。