我想显示一个表面,上面有 3 个点。我尝试合并两个帖子,部分成功。如果我改变视点,我会得到上面的图。在这种情况下,对数缩放消失了,但它接近我想要的(网格点中的球除外)。如果我不改变视点,我会得到下面的图,其中对数缩放是完美的,但有趣的表面部分和点不可见。我怎样才能改变视点,同时保持对数缩放?
顺便问一下:强调这些点的 3D 位置如何相互关联的最佳方法是什么?也许是表面上的一些额外网格线?还是一些投影到相应坐标的线?
\documentclass[border= 5mm]{standalone}
\usepackage{pgfplots}
%https://tex.stackexchange.com/questions/232070/3d-surface-plot-with-logarithmic-x-and-y-axis
%http://pgfplots.net/tikz/examples/mesh-plot/
\begin{document}
\begin{tikzpicture}
\begin{axis}
[view={105}{18}] %% Comment this out
[
scale = 1,
ymin = 1e5, xmax = 1.1e7,
ymin = 1e-8, ymax = 1e-5,
zmin = 0, zmax = 1,
ztick={.2,.5,.8,1.0},
ytick={1e-7,1e-6,1e-5},
colormap/jet,
xmode=log, ymode=log
]
\addplot3+[
mesh,%scatter,%,samples=10
% surf,
samples=10,
domain=5:7.1,
domain y=-8:-5,
]
(10^x, 10^y, { 1/(10^x*10^y+(1-10^y))});
\addlegendentry{Surface}
\addplot3+[only marks] coordinates {
(2397824, 1.665e-7, 0.715) };
\addlegendentry{A}
\addplot3+[only marks] coordinates {
(1572480, 2.09e-7, 0.753) };
\addlegendentry{B}
\addplot3+[only marks] coordinates {
(10649600,33e-9,.742) };
\addlegendentry{C}
\end{axis}
\end{tikzpicture}
\end{document}
答案1
我很乐意删除它。您已关闭]
轴选项,这就是为什么所有对数内容都被忽略了。只需][
用逗号替换即可
\documentclass[border= 5mm]{standalone}
\usepackage{pgfplots}
%https://tex.stackexchange.com/questions/232070/3d-surface-plot-with-logarithmic-x-and-y-axis
%http://pgfplots.net/tikz/examples/mesh-plot/
\begin{document}
\begin{tikzpicture}
\begin{axis}
[view={105}{18}, %% Comment this out
scale = 1,
ymin = 1e5, xmax = 1.1e7,
ymin = 1e-8, ymax = 1e-5,
zmin = 0, zmax = 1,
ztick={.2,.5,.8,1.0},
ytick={1e-7,1e-6,1e-5},
colormap/jet,
xmode=log, ymode=log
]
\addplot3+[
mesh,%scatter,%,samples=10
% surf,
samples=10,
domain=5:7.1,
domain y=-8:-5,
]
(10^x, 10^y, { 1/(10^x*10^y+(1-10^y))});
\addlegendentry{Surface}
\addplot3+[only marks] coordinates {
(2397824, 1.665e-7, 0.715) };
\addlegendentry{A}
\addplot3+[only marks] coordinates {
(1572480, 2.09e-7, 0.753) };
\addlegendentry{B}
\addplot3+[only marks] coordinates {
(10649600,33e-9,.742) };
\addlegendentry{C}
\end{axis}
\end{tikzpicture}
\end{document}
至于指示位置的最佳方式是什么,我不知道,但我觉得添加连接线条和底部的细线并最后绘制表面可能会有所帮助。
\documentclass[border= 5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
%https://tex.stackexchange.com/questions/232070/3d-surface-plot-with-logarithmic-x-and-y-axis
%http://pgfplots.net/tikz/examples/mesh-plot/
\begin{document}
\begin{tikzpicture}
\begin{axis}
[view={105}{18}, %% Comment this out
scale = 1,
ymin = 1e5, xmax = 1.1e7,
ymin = 1e-8, ymax = 1e-5,
zmin = 0, zmax = 1,
ztick={.2,.5,.8,1.0},
ytick={1e-7,1e-6,1e-5},
colormap/jet,
xmode=log, ymode=log
]
\addplot3+[only marks] coordinates {
(2397824, 1.665e-7, 0.715) };
\draw[thin,gray] (2397824, 1.665e-7, 0.715) -- (2397824, 1.665e-7, 0);
\addlegendentry{A}
\addplot3+[only marks] coordinates {
(1572480, 2.09e-7, 0.753) };
\draw[thin,gray] (1572480, 2.09e-7, 0.753) -- (1572480, 2.09e-7, 0) ;
\addlegendentry{B}
\addplot3+[only marks] coordinates {
(10649600,33e-9,.742) };
\draw[thin,gray] (10649600,33e-9,.742) -- (10649600,33e-9,0);
\addlegendentry{C}
\addplot3+[
mesh,%scatter,%,samples=10
% surf,
samples=10,
domain=5:7.1,
domain y=-8:-5,
]
(10^x, 10^y, { 1/(10^x*10^y+(1-10^y))});
\addlegendentry{Surface}
\end{axis}
\end{tikzpicture}
\end{document}