Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need to draw the following figure : enter image description here

I have used the following code to get it :

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (2,2) circle (3cm);
\draw (2,2) ellipse (3cm and 1cm);
\end{tikzpicture}
\end{document}    

which produces :

enter image description here

How can I draw my desired figure using tikzpicture ?

Is there any way to draw an arbitrary curve with some portion of it is dotted?

share|improve this question
1  
Would this be helpful? tex.stackexchange.com/q/42812/34618 and related links there. –  Jesse Mar 22 at 7:01

2 Answers 2

up vote 3 down vote accepted

In your case, it is very simple to draw the ellipse twice, and clip the solid part, so only half of it is shown.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (2,2) circle (3cm);
\draw[dashed] (2,2) ellipse (3cm and 1cm);
\clip (-1.1,2) rectangle (5.1 cm,0.9 cm);
\draw (2,2) ellipse (3cm and 1cm);
\end{tikzpicture}
\end{document}

result

share|improve this answer
1  
An other solution(and better) is to draw only the 180 degrees you need - once solid, and once dashed. tex.stackexchange.com/questions/42812/3d-bodies-in-tikz –  Hans-Peter E. Kristiansen Mar 22 at 7:18
    
Thank you @Hans-PeterE.K. Your answer helped me. +1 for you. –  Soumitra Sen Mar 22 at 7:18
    
Can you explain me the function of \clip? –  Soumitra Sen Mar 22 at 7:39
    
It is used for clipping subsequent drawings in the same scope. See TikZ manual page 608. –  Hans-Peter E. Kristiansen Mar 22 at 7:49

I have drawn the curve in another way below :

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) circle (3cm);
\draw (-3,0) arc (180:360:3cm and 1cm);
\draw[dashed] (-3,0) arc (180:0:3cm and 1cm);

\end{tikzpicture}
\end{document}  

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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