Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: The ticklabel anchor cannot be determined, the normal vector and the unit y vector are almost parallel #468

Open
maxchendt opened this issue Nov 20, 2023 · 1 comment
Labels
axis bug Something isn't working

Comments

@maxchendt
Copy link

maxchendt commented Nov 20, 2023

If I comment out any one of the tikzpicture, there is no warning. This Warning has been seen in https://tex.stackexchange.com/q/410445

\documentclass[tikz,margin=5pt]{standalone}
\usepackage{tikz,xcolor, pgfplots}
%\usepackage{amsmath,amsfonts,amssymb,amsthm}
\pgfplotsset{compat=1.18}

% for testing 
\begin{document}


%https://tex.stackexchange.com/q/139686	Controlling Orientation in 3D PGF Plots
\begin{tikzpicture}
\begin{axis}[
    xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
    x={(-0.3cm,-0.3cm)}, y={(.5cm,0.0cm)}, z={(0cm,.1cm)},
    axis lines=middle, axis on top,
    xtick={-2,2}, ytick={-2,2},ztick={16,32},
    enlargelimits=true
    ]
\addplot3[surf, thick, color=green, domain=-4:4] {x^2+y^2};

\end{axis}
\end{tikzpicture}



\begin{tikzpicture}
\begin{axis}[
    xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
    x={(1cm,0cm)}, y={(0.317cm,0.217cm)},  z={(0cm,0.17cm)},
    axis lines=middle, axis on top,
    %https://tex.stackexchange.com/q/410445	Warning: The ticklabel anchor cannot be determined, the normal vector and the unit x vector are almost parallel
    xtick={-2,2}, ytick={-2,2},ztick={16,32},
    enlargelimits=true
    ]
\addplot3[surf, thick, color=green, domain=-4:4] {x^2+y^2};

\end{axis}
\end{tikzpicture}



\end{document}

compiling outputs

Package pgfplots notification 'compat/show suggested version=true': document ha
s been generated with the most recent feature set (\pgfplotsset{compat=1.18}).

[1]

Package pgfplots Warning: the ticklabel anchor cannot be determined, the normal
 vector -(0.38263pt,0.92383pt) and the unit y vector (0.82535pt,0.56494pt) are 
almost parallel (abs(cos(angle)) = 0.83769pt)! on input line 37.


Package pgfplots Warning: the ticklabel anchor cannot be determined, the normal
 vector -(0.38263pt,0.92383pt) and the unit y vector (0.82535pt,0.56494pt) are 
almost parallel (abs(cos(angle)) = 0.83769pt)! on input line 37.


Package pgfplots Warning: the ticklabel anchor cannot be determined, the normal
 vector -(0.38263pt,0.92383pt) and the unit y vector (0.82535pt,0.56494pt) are 
almost parallel (abs(cos(angle)) = 0.83769pt)! on input line 37.


Package pgfplots Warning: the ticklabel anchor cannot be determined, the normal
 vector -(0.38263pt,0.92383pt) and the unit y vector (0.82535pt,0.56494pt) are 
almost parallel (abs(cos(angle)) = 0.83769pt)! on input line 37.


Package pgfplots Warning: the ticklabel anchor cannot be determined, the normal
 vector -(-0.38263pt,-0.92383pt) and the unit y vector (0.82535pt,0.56494pt) ar
e almost parallel (abs(cos(angle)) = 0.83769pt)! on input line 37.


Package pgfplots Warning: the ticklabel anchor cannot be determined, the normal
 vector -(-0.38263pt,-0.92383pt) and the unit y vector (0.82535pt,0.56494pt) ar
e almost parallel (abs(cos(angle)) = 0.83769pt)! on input line 37.
@muzimuzhi
Copy link
Member

muzimuzhi commented Nov 22, 2023

Some caches set globally are not reset. Try this patch to \pgfplotspoint@initialisation

\documentclass[tikz,margin=5pt]{standalone}
\usepackage{tikz,xcolor, pgfplots}
\pgfplotsset{compat=1.18}

\usepackage{xpatch}
\makeatletter
% cache@2v2 and friends are not initialized in \pgfplotspoint@initialisation
\xapptocmd\pgfplotspoint@initialisation{%
  % other z-axis variables are initialised unconditionally too
  % \ifpgfplots@threedim
    \pgfplotspoint@initialise@axis@cache02%
    \pgfplotspoint@initialise@axis@cache12%
    \pgfplotspoint@initialise@axis@cache22%
    \pgfplotspoint@initialise@axis@cache20%
    \pgfplotspoint@initialise@axis@cache21%
  % \fi
}{}{\PatchFailed}

\def\pgfplotspoint@initialise@axis@cache#1#2{%
  \global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@v#1#2\endcsname\relax
  \global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@#1v#2\endcsname\relax
  \global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@#1#2v\endcsname\relax
}
\makeatother

\begin{document}
%https://tex.stackexchange.com/q/139686	Controlling Orientation in 3D PGF Plots
\begin{tikzpicture}
\begin{axis}[
    xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
    x={(-0.3cm,-0.3cm)}, y={(.5cm,0.0cm)}, z={(0cm,.1cm)},
    axis lines=middle, axis on top,
    xtick={-2,2}, ytick={-2,2},ztick={16,32},
    enlargelimits=true
    ]
\addplot3[surf, thick, color=green, domain=-4:4] {x^2+y^2};

\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[
    xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
    x={(1cm,0cm)}, y={(0.317cm,0.217cm)},  z={(0cm,0.17cm)},
    axis lines=middle, axis on top,
    %https://tex.stackexchange.com/q/410445	Warning: The ticklabel anchor cannot be determined, the normal vector and the unit x vector are almost parallel
    xtick={-2,2}, ytick={-2,2},ztick={16,32},
    enlargelimits=true
    ]
\addplot3[surf, thick, color=green, domain=-4:4] {x^2+y^2};

\end{axis}
\end{tikzpicture}

\end{document}

@muzimuzhi muzimuzhi added bug Something isn't working axis labels Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
axis bug Something isn't working
Development

No branches or pull requests

2 participants