我不知道如何手动设置 xticks、yticks 以及颜色条的刻度立刻。它只适用于这三个中的一个,但如果我尝试更改第二个 tick 属性,编译将永远不会结束。以下是代码:
\documentclass{scrartcl}
% TikZ Packages
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest,xlabel near ticks,ylabel near ticks,}
\tikzset{font=\footnotesize}
\usepackage{fp}
\usepgfplotslibrary{patchplots,colormaps}
\usepackage[tightpage,active,pdftex,floats,graphics]{preview}
\PreviewEnvironment{tikzpicture}
\makeatletter
\def\customrevertcolormap#1{%
\pgfplotsarraycopy{pgfpl@cm@#1}\to{custom@COPY}%
\c@pgf@counta=0
\c@pgf@countb=\pgfplotsarraysizeof{custom@COPY}\relax
\c@pgf@countd=\c@pgf@countb
\advance\c@pgf@countd by-1 %
\pgfutil@loop
\ifnum\c@pgf@counta<\c@pgf@countb
\pgfplotsarrayselect{\c@pgf@counta}\of{custom@COPY}\to\pgfplots@loc@TMPa
\pgfplotsarrayletentry\c@pgf@countd\of{pgfpl@cm@#1}=\pgfplots@loc@TMPa
\advance\c@pgf@counta by1 %
\advance\c@pgf@countd by-1 %
\pgfutil@repeat
%\pgfplots@colormap@showdebuginfofor{#1}%
}%
\makeatother
\begin{document}
\pgfplotsset{
colormap/jet,
}
\pagestyle{empty}
\begin{tikzpicture}[scale=1.0]
\customrevertcolormap{jet}
\begin{axis}[view={0}{90},%
% colorbar,%
% colorbar style={ %[colorbar sampled,colorbar style={samples=8}]
% %ytick={0,20,...,100},
% ytick={0,20,40,60,80,100},
% yticklabels={
% \textsf{0},
% \textsf{20},
% \textsf{40},
% \textsf{60},
% \textsf{80},
% \textsf{100}
% }
% }
xtick={1,2,3,4,5,6},
xticklabels={
\textsf{0.1},
\textsf{0.2},
\textsf{0.3},
\textsf{0.4},
\textsf{0.5},
\textsf{0.6}
}
% ytick={5,10,15},
% yticklabels={
% \textsf{0.2},
% \textsf{0.5},
% \textsf{1.0}
% }
]
\addplot3
[surf,
shader=flat corner,
mesh/rows=15,
point meta=z,%
]
coordinates {
(1,1,97.80) (2,1,99.40) (3,1,100.00) (4,1,99.70) (5,1,100.00) (6,1,100.00)
(1,2,93.50) (2,2,98.10) (3,2,99.00) (4,2,99.60) (5,2,99.90) (6,2,100.00)
(1,3,81.80) (2,3,94.40) (3,3,96.90) (4,3,98.50) (5,3,99.80) (6,3,100.00)
(1,4,46.80) (2,4,75.30) (3,4,90.00) (4,4,95.30) (5,4,99.40) (6,4,100.00)
(1,5,20.00) (2,5,47.90) (3,5,74.00) (4,5,88.60) (5,5,97.70) (6,5,100.00)
(1,6,5.70) (2,6,19.40) (3,6,46.80) (4,6,77.90) (5,6,93.20) (6,6,100.00)
(1,7,0.50) (2,7,5.10) (3,7,26.00) (4,7,58.90) (5,7,83.10) (6,7,100.00)
(1,8,0.10) (2,8,0.50) (3,8,8.60) (4,8,37.00) (5,8,74.20) (6,8,100.00)
(1,9,0.00) (2,9,0.10) (3,9,1.50) (4,9,17.10) (5,9,56.50) (6,9,100.00)
(1,10,0.00) (2,10,0.00) (3,10,0.10) (4,10,7.00) (5,10,38.80) (6,10,100.00)
(1,11,0.00) (2,11,0.00) (3,11,0.00) (4,11,1.40) (5,11,22.00) (6,11,100.00)
(1,12,0.00) (2,12,0.00) (3,12,0.00) (4,12,0.00) (5,12,10.40) (6,12,100.00)
(1,13,0.00) (2,13,0.00) (3,13,0.00) (4,13,0.00) (5,13,1.70) (6,13,100.00)
(1,14,0.00) (2,14,0.00) (3,14,0.00) (4,14,0.00) (5,14,0.50) (6,14,100.00)
(1,15,0.00) (2,15,0.00) (3,15,0.00) (4,15,0.00) (5,15,0.00) (6,15,100.00)
};
\end{axis}
\end{tikzpicture}
\end{document}