在 pgfplots 中使用對數刻度時如何改變視角?

在 pgfplots 中使用對數刻度時如何改變視角?

我想顯示一個表面,上面有 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}

在此輸入影像描述

相關內容