I want to draw a circle at the end of a semi-cylinder.
However I was not able to change the orientation (plane) for this circle. I found this post that suggests to use [x={(0,0, 1)}] but it does not seem to work inside of pgfplots axis environment. I tried to refer to the correct coordinate system axis cs: for the transformation but that also did not help.
MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\newcommand{\ycenter}{1}
\newcommand{\zcenter}{1}
\newcommand{\myradius}{1}
\newcommand{\myxmax}{5}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmax=\myxmax]
\addplot3[
domain y = \ycenter-\myradius:\ycenter+\myradius,
surf,
]
{-sqrt(\myradius^2 - (y-\ycenter)^2) + \zcenter};
% center of the circle at the right end of semicylinder
\node at (\myxmax, \ycenter, \zcenter) {O};
% this circle is not oriented correctly
\draw[red] (\myxmax, \ycenter, \zcenter) circle (1);
% sadly this does not help
\draw[green] (\myxmax, \ycenter, \zcenter) [x={(0,0,1)}] circle (1);
% neither does this
\draw[black] (1, 0, 0) [x={(axis cs: 0,0,1)}] circle (1);
\end{axis}
% this does not refer to the correct coordinate system
\draw[blue] (\myxmax, \ycenter, \zcenter) circle (1);
\draw[blue] (\myxmax, \ycenter, \zcenter) [x={(0,0,1)}] circle (1);
\end{tikzpicture}
\end{document}
yields:
Ty for any help,
Franz


axis cs:does nothing, as it is default coordinate system. The red circle is correct, but oriented in the xy plane. I will happily explain further - let me know what/which you do not understand. – hpekristiansen Oct 09 '22 at 14:20