visualisation/cube.tex

Tue, 01 Apr 2025 21:45:15 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 01 Apr 2025 21:45:15 -0500
changeset 65
d5d746465b6e
parent 42
271fba635bce
permissions
-rw-r--r--

Another README typofix

\documentclass[tikz]{standalone}

\input{plotsetup}

\def\datapath{../res/cube}

\begin{document}

\begin{tikzpicture}
    \pgfplotsset{
        onlyfront/.code = \pgfplotsset{x filter/.expression={%
            or(\thisrow{face} == 2, or(\thisrow{face} == 4, \thisrow{face} == 6)) ? x : nan%
        },},
        onlyback/.code = \pgfplotsset{x filter/.expression={%
            or(\thisrow{face} == 1, or(\thisrow{face} == 3, \thisrow{face} == 5)) ? x : nan%
        },},
    }
    
    \begin{axis}[illustr3d]
        % Hidden edges
        \addplot3[edge] coordinates {(0, 0, 0) (0, 1, 0) (0, 1, 1) };
        \addplot3[edge] coordinates {(0, 1, 0) (1, 1, 0) };

        % Data on hidden faces
        \addplot3[backdata] table[x=x,y=y,z=z] {\datapath/data.csv};

        % Iterates on hidden faces
        \addplot3[backiter1] table[x=x,y=y,z=z] {\datapath/x1_log.csv};
        \addplot3[backiter2] table[x=x,y=y,z=z] {\datapath/x2_log.csv};
        \addplot3[backiter3] table[x=x,y=y,z=z] {\datapath/x3_log.csv};

        % Surface
        \addplot3[
            surf,
            mesh/ordering=x varies, % the second input coordinate stays fixed while first varies
            mesh/cols=32, % number of first input coordinate points untils second changes
            surfstyle,
        ] table [
            x = u,
            z = v,
            y expr = 0.0,
            point meta = \thisrow{value},
         ] {\datapath/F4.csv};
        \addplot3[
            surf,
            mesh/ordering=x varies, % the second input coordinate stays fixed while first varies
            mesh/cols=32, % number of first input coordinate points untils second changes
            surfstyle,
        ] table [
            x expr = 1.0,
            y = u,
            z = v,
            point meta = \thisrow{value},
         ] {\datapath/F2.csv};
        \addplot3[
            surf,
            mesh/ordering=x varies, % the second input coordinate stays fixed while first varies
            mesh/cols=32, % number of first input coordinate points untils second changes
            surfstyle,
        ] table [
            x = u,
            y = v,
            z expr = 1.0,
            point meta = \thisrow{value},
        ] {\datapath/F6.csv};
    
        % Edges
        \addplot3[edge] coordinates {(0, 0, 0) (1, 0, 0) (1, 0, 1) (0, 0, 1) (0, 0, 0)};
        \addplot3[edge] coordinates {(0, 0, 1) (0, 1, 1) (1, 1, 1) (1, 0, 1)};
        \addplot3[edge] coordinates {(1, 0, 0) (1, 1, 0) (1, 1, 1)};

        % Data
        \addplot3[data,onlyfront] table[x=x,y=y,z=z] {\datapath/data.csv};
        \addlegendentry{Data}

        % Iterates
        \addplot3[iter1,onlyfront] table[x=x,y=y,z=z] {\datapath/x1_log.csv};
        \addlegendentry{Iterates 1}
        \addplot3[iter2,onlyfront] table[x=x,y=y,z=z] {\datapath/x2_log.csv};
        \addlegendentry{Iterates 2}
        \addplot3[iter3,onlyfront] table[x=x,y=y,z=z] {\datapath/x3_log.csv};
        \addlegendentry{Iterates 3}

        % Origin
        \addplot3[origin,onlyfront] table[x=x,y=y,z=z] {\datapath/origin.csv};
        \addlegendentry{Origin}
    \end{axis}
\end{tikzpicture}

\end{document}

mercurial