1

I have a figure and would like to highlight a particular region of that figure with a circle or an ellipse as shown in figure:

enter image description here

It is important that the line of the circle or ellipse are thick. How do I control the location of the circle, to up, down, right or left?

Thanks a lot!

7

With TikZ:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,shapes}
\begin{document}

\begin{center}
\begin{tikzpicture}
\node(a){\includegraphics{circle.png}};
\node at(a.center)[draw, red,line width=3pt,ellipse, minimum width=118pt, minimum height=50pt,rotate=-28,yshift=-48pt]{};
\end{tikzpicture}   
\end{center}

\end{document} 

enter image description here

I used red so that you can see where my ellipse is with respect to the original ellipse. You can fine-tune the positioning via shifts, rotate, etc.

| improve this answer | |
6

Here is a way by using \tikz for the ellipse, and then \stackinset to overlay it on the image. Arguments #2 and #4 to \stackinset are the offsets from the left, bottom of the image (horizontal offsets can be with respect to l, c, or r and vertical t, c, or b), while the 4 arguments to \solidcirc are the rotation angle, line thickness, and the x and y radii of the ellipse.

\documentclass{article}
\usepackage{stackengine,tikz,graphicx}
\newcommand\solidcirc[4][0]{\rotatebox{#1}{\tikz{\draw[line width=#2] (0,0) 
  arc [x radius=#3,y radius=#4,start angle=0,end angle=360];}}}
\begin{document}
\stackinset{l}{1in}{b}{.8in}{\textcolor{blue}{\solidcirc[-30]{3pt}{2.8}{1.0}}}
  {\includegraphics{example-image}}
\end{document}

enter image description here

| improve this answer | |
  • Is it possible to draw more than one ellipse in the same figure? For example, a blue ellipse and a red ellipse. – Wendell Fialho Mar 20 at 22:57
  • @WendellFialho Yes. You can nest them, wherein the first inset becomes argument #6 of the outer inset. If you do many insets at once, it renders more quickly if you save intermediate results in a box, and use the box as argument #6. The \savestack mechanism utilizes this boxed mechanism. E.g. \savestack\inbox{\stackinset{}{}{}{}{}{}}. Then, \stackinset{}{}{}{}{}{\inbox}. – Steven B. Segletes Mar 21 at 0:14
  • Thank you so much for your answer. But I did not understand the practice of how this command works to insert multiple ellipses. You can kindly demonstrate it through an example image. – Wendell Fialho Mar 21 at 1:27
  • @WendellFialho This, answer, tex.stackexchange.com/questions/171483/…, shows nested \stackinsets... 5 insets over the base image. – Steven B. Segletes Mar 21 at 2:04
  • @WendellFialho \documentclass{article} \usepackage{stackengine,tikz} \newcommand\solidcirc[4][0]{\rotatebox{#1}{\tikz{\draw[line width=#2] (0,0) arc [x radius=#3,y radius=#4,start angle=0,end angle=360];}}} \begin{document} \stackinset{l}{.5in}{b}{.3in}{\textcolor{red}{\solidcirc[30]{3pt}{2.4}{1.0}}}{\stackinset{l}{1in}{b}{.8in}{\textcolor{blue}{\solidcirc[-30]{3pt}{2.8}{1.0}}}{\includegraphics{example-image}}} \end{document} – Steven B. Segletes Mar 21 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.