I want to draw a simple figure of a boat in LaTex, does anyone know a good way to do that? Is TikZ the best package to use for this? I want it to look similar to the boat in the picture below, which I think seem to have been made using TikZ. Any ideas on how to accomplish this?
[Tex/LaTex] Drawing figure of a boat with the Tikz-package
tikz-arrowstikz-externaltikz-pgftikz-styles
Related Solutions
Actually this is rather simple. There are several ways to do it.
One way would be to place the first node using \node (NAME) at (POSITION) {TEXT};
and then further nodes using \node (NAME) [below left=Y and X of NODE] {TEXT};
etc.. Arrows can be drawn using \draw [->] (NODE1) -- (NODE2);
. Add a trailing node [OPTIONS] {TEXT}
before the ;
to add labels to the arrows.
\documentclass{standalone}% For the example only, any class will do
\usepackage{tikz}
\usetikzlibrary{positioning}% To get more advances positioning options
\usetikzlibrary{arrows}% To get more arrow heads
\begin{document}
\begin{tikzpicture}[>=triangle 45,font=\sffamily]
\node (X) at (0,0) {x};
\node (Y) [below left=2cm and 1cm of X] {y};% 2cm below, 1cm to the left (optional)
\node (Z) [below right=2cm and 1cm of X] {z};
\node (U) [below left=2cm and 1cm of Z] {u};
\draw [semithick,->] (X) -- (Y);
\draw [semithick,->] (X) -- (Z);
\draw [semithick,->] (Y) -- (U) node [midway,below,sloped] {*};
\draw [semithick,->] (Z) -- (U) node [midway,below,sloped] {*};
\end{tikzpicture}
\end{document}
First you have some code with TikZ arc on a 3d-sphere-in-tikz
Then you can use Google Earth to create a picture of the earth with png or pdf. (I don't know if I can place this kind of picture here. I can remove it If this is not allowed.)
In the next example, I haven't turned the earth to have the correct position. It's only to make an attempt. Then you place this picture in the background. I take your code, remove the earth and place this code :
\begin{pgfonlayer}{background}
\node {\includegraphics[scale=.655]{earth.pdf}};
\end{pgfonlayer}
With the next code you get :
The complete code is :
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,fadings,decorations.pathreplacing,backgrounds}
\usepackage{verbatim}
%% helper macros
\newcommand\pgfmathsinandcos[3]{%
\pgfmathsetmacro#1{sin(#3)}%
\pgfmathsetmacro#2{cos(#3)}%
}
\newcommand\LongitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % azimuth
\tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % latitude
\pgfmathsetmacro\yshift{\cosEl*\sint}
\tikzset{#1/.estyle={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
}
\newcommand\DrawLongitudeCircle[2][4]{
\LongitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
% angle of "visibility"
\pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
\draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
\draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}
\newcommand\DrawLatitudeCircle[2][5]{
\LatitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
\pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
% angle of "visibility"
\pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
\draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
\draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
}
%% document-wide tikz options and styles
\tikzset{%
>=latex, % option for nice arrows
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=4pt,
fill=black,circle}%
}
\begin{document}
\begin{tikzpicture}[rotate=-23.5] % "THE GLOBE" showcase
\def\R{2} % sphere radius
\def\angEl{5} % elevation angle
\def\angAz{105} % azimuth angle
\def\angPhi{-40} % longitude of point P
\def\angBeta{19} % latitude of point P
\pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
\tikzset{xyplane/.estyle={cm={cos(\angAz),sin(\angAz)*sin(\angEl),-sin(\angAz),
cos(\angAz)*sin(\angEl),(0,-\H)}}}
\LongitudePlane[xzplane]{\angEl}{\angAz}
\LatitudePlane[equator]{\angEl}{0}
% \filldraw[ball color=green, fill opacity=1] (0,0) circle (\R);
% \draw (0,0) circle (\R);
\coordinate (O) at (0,0);
\coordinate[mark coordinate] (N) at (0,\H);
\coordinate[mark coordinate] (S) at (0,-\H);
\draw[<->] (0,-\H-5) -- (0,\R+5) node[above] {}; %axis of rotation
\draw[<->,rotate=23.5] (0,-\H-5) -- (0,\R+5) node[above] {}; %axis of rotation
\path[xzplane] (\R,0) coordinate (XE);
\DrawLatitudeCircle[\R,color=red]{0} % equator
% \node[above=10pt, right=6pt] at (N) {\bf{North}};
% \node[above=2pt, right=9pt] at (N) {\bf{Pole}};
%
% \node[below=3pt, left=6pt] at (S) {\bf{South}};
% \node[below=12pt, left=9pt] at (S) {\bf{Pole}};
\def\R{6} % sphere radius
\def\angEl{5} % elevation angle
\def\angAz{105} % azimuth angle
\def\angPhi{-40} % longitude of point P
\def\angBeta{19} % latitude of point P
\pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
\tikzset{xyplane/.estyle={cm={cos(\angAz),sin(\angAz)*sin(\angEl),-sin(\angAz),
cos(\angAz)*sin(\angEl),(0,-\H)}}}
\LongitudePlane[xzplane]{\angEl}{\angAz}
\LatitudePlane[equator]{\angEl}{0}
\filldraw[ball color=blue, fill opacity=0.3] (0,0) circle (\R);
\draw (0,0) circle (\R);
\coordinate (O) at (0,0);
\coordinate[mark coordinate] (N) at (0,\H);
\coordinate[mark coordinate] (S) at (0,-\H);
\path[xzplane] (\R,0) coordinate (XE);
\DrawLatitudeCircle[\R,fill=red,fill opacity =0.1,color=red]{0} % equator
\DrawLatitudeCircle[\R,rotate=23.5, color=yellow]{0} % ecliptic
\DrawLongitudeCircle[\R]{\angAz+15} % xzplane
\node[above=10pt, right=5pt] at (N) {\bf{North Celestial Pole}};
\node[below=10pt, left=5pt] at (S) {\bf{South Celestial Pole}};
\begin{pgfonlayer}{background}
\node {\includegraphics[scale=.655]{earth.pdf}};
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
Best Answer
A boat! Couldn't resist.
This should get you started.