6

How to draw different parts of a line in different colours. In the following code can each part of the line be drawn in different colour

    \documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
{
\begin{tikzpicture}
\draw [thick, green] (2.3,1.4) +(-27:2.2cm)-- +(153:2.2cm) +(42:1.88cm) -- +(-138:1.88cm);
\end{tikzpicture}
}
\end{frame}
\end{document}
Hany
  • 4,709

1 Answers1

5

Using edge could perhaps be an option.

enter image description here

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{pgfplots}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
{
\begin{tikzpicture}
\draw [thick, green] (2.3,1.4) +(-27:2.2cm) edge +(153:2.2cm) +(42:1.88cm) edge[blue] +(-138:1.88cm);
\end{tikzpicture}
}
\end{frame}
\end{document}
Torbjørn T.
  • 206,688
  • 2
    See also https://tex.stackexchange.com/questions/32294/ and the linked questions, and https://tex.stackexchange.com/questions/270001/ for a different situation and approach. – Torbjørn T. Jun 25 '18 at 17:14