Is there any software, which provides Latex code, where can I make this graph?
Or could you help me do this using Tikz?
Is there any software, which provides Latex code, where can I make this graph?
Or could you help me do this using Tikz?
I am answering this mainly to prevent you from adding an ellipse that is rotated by hand. Most of the following is taken from this answer. The most prominent addendum is an ellipse drawn in the xy plane using the 3d library, which requires the fix provided by this answer.
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
\makeatletter
\tikzoption{canvas is xy plane at z}[]{%
\def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%
\def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%
\def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%
\tikz@canvas@is@plane}
\makeatother
\begin{document}
\tdplotsetmaincoords{60}{130}
%
\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{30}
\pgfmathsetmacro{\phivec}{60}
%
\begin{tikzpicture}[scale=5,tdplot_main_coords,>=latex]
\coordinate (O) at (0,0,0);
\begin{scope}[canvas is xy plane at z=0]
\fill[gray,opacity=0.3] circle (0.3cm and 1cm);
\end{scope}
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->,densely dashed] (0,0,0) -- ({sin(-20)},{cos(-20)},0)
node[anchor=north west]{$y'$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}
\draw[-stealth,color=red] (O) -- (P) node[above right] {$B$};
\draw[dotted,thick] (O) -- (Pxy) -- (P) -- (Pz);
\tdplotdrawarc{(O)}{0.2}{0}{\phivec}{anchor=north}{$\varphi$}
\tdplotdrawarc{(O)}{0.2}{90}{110}{anchor=165}{$\alpha$}
\tdplotsetthetaplanecoords{\phivec}
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.5}{0}%
{\thetavec}{anchor=south west}{$\theta$}
\end{tikzpicture}
\end{document}
But gives error.
– user1256 Oct 08 '18 at 23:16node[above right] {$B$} by node[above right,black] {$B$}.
–
Oct 09 '18 at 00:39
\draw [black,fill=gray!20,rotate=30] (0,0) ellipse (2cm and 1cm);– Bobyandbob Oct 08 '18 at 11:58