因为我想使用 LaTeX 可视化引擎图,所以我遇到了一些问题,无法找到解决方法。公平地说,我不是最有经验的 Tex 用户,所以我希望你们中的一个人能为我找到答案。我将从我的代码开始:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[
title= Title here $\lbrack - \rbrack$, xlabel=x $\lbrack - \rbrack$, ylabel=y $\lbrack - \rbrack$,
width=0.9\textwidth, height=0.9\textwidth,
label style = {font=\small}, tick label style = {font=\scriptsize},
y label style={yshift=-2mm},x label style={yshift=2mm},grid=major,
view={0}{90},
colorbar,
colorbar style={ytick={200,210,...,300,370}},
ymin=0,ymax=20,
xmin=800, xmax=4000,
]
\addplot3 [surf,shader=interp, scatter,mark=o, nodes near coords,every node near coord/.append style={xshift=0pt,yshift=0pt,anchor=north,font=\tiny},]coordinates{
(1000,1,370) (1600,1,355) (2000,1,360) (2600,1,361)
(1000,3,240) (1600,3,245) (2000,3,243) (2600,3,246)
(1000,6,224) (1600,6,216) (2000,6,212) (2600,6,218)
(1000,9,230) (1600,9,211) (2000,9,330) (2600,9,221)
(1000,9,230) (1600,12,221) (2000,12,222) (2600,12,231)
};
\addplot3 [contour gnuplot={number=8}, thick]coordinates
{
(1000,1,370) (1600,1,355) (2000,1,360) (2600,1,361)
(100,3,240) (1600,3,245) (2000,3,243) (2600,3,246)
(1000,6,224) (1600,6,216) (2000,6,212) (2600,6,218)
(1000,9,230) (1600,9,211) (2000,9,330) (2600,9,221)
(1000,9,230) (1600,12,221) (2000,12,222) (2600,12,231)
};
\pgfkeys{
/pgf/number format/set thousands separator = }
\end{axis}
\end{tikzpicture}
\caption{none}
\end{figure}
\end{document}
经过几次尝试,我很高兴它至少可以运行,但有些地方我想改进:
- (如何)我可以修改轮廓图的范围?例如,我想将其分为 200、210、...、300、400 吗?[已回答]
- 有什么方法可以“平滑”轮廓图的轮廓?平滑功能完全改变了整个图。
- 有没有什么办法可以让轮廓图的轮廓变成简单的黑色?
- 是否有机会获得没有白色背景的轮廓图范围?
预先感谢您的帮助!
答案1
回答你的第一个问题:
(如何) 我可以修改轮廓图的范围?例如,我想将其分为 200、210、...、300、400 吗?
可以使用 调整图的 z 范围point meta max=400
。
梅威瑟:
% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[
title= Title here $\lbrack - \rbrack$,
xlabel=x $\lbrack - \rbrack$,
ylabel=y $\lbrack - \rbrack$,
width=0.9\textwidth, height=0.9\textwidth,
label style = {font=\small},
tick label style = {font=\scriptsize},
y label style={yshift=-2mm},
x label style={yshift=2mm},
grid=major,
view={0}{90},
colorbar,
colorbar style={ytick={200,210,...,300,400}},
ymin=0,ymax=20,
xmin=800, xmax=4000,
point meta max=400
]
\addplot3 [surf,shader=interp, scatter,mark=o, nodes near coords,every node near coord/.append style={xshift=0pt,yshift=0pt,anchor=north,font=\tiny},]coordinates{
(1000,1,370) (1600,1,355) (2000,1,360) (2600,1,361)
(1000,3,240) (1600,3,245) (2000,3,243) (2600,3,246)
(1000,6,224) (1600,6,216) (2000,6,212) (2600,6,218)
(1000,9,230) (1600,9,211) (2000,9,330) (2600,9,221)
(1000,9,230) (1600,12,221) (2000,12,222) (2600,12,231)
};
\addplot3 [contour gnuplot={number=8}, thick]coordinates
{
(1000,1,370) (1600,1,355) (2000,1,360) (2600,1,361)
(100,3,240) (1600,3,245) (2000,3,243) (2600,3,246)
(1000,6,224) (1600,6,216) (2000,6,212) (2600,6,218)
(1000,9,230) (1600,9,211) (2000,9,330) (2600,9,221)
(1000,9,230) (1600,12,221) (2000,12,222) (2600,12,231)
};
\pgfkeys{
/pgf/number format/set thousands separator = }
\end{axis}
\end{tikzpicture}
\caption{none}
\end{figure}
\end{document}