3

I know this is a VERY BASIC question but I can't finish the other part of this ellipse using dashed points:

Ellipse

MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tasks}

\usepackage{pgfplots}
\usetikzlibrary{arrows.meta, patterns}
\pgfplotsset{compat=1.8}
\pgfplotsset{soldot/.style={color=black,only marks,mark=*}}
\pgfplotsset{holdot/.style={color=red,fill=white,very thick,only marks,mark=*}}
\usepackage{amsmath}

\usepackage{mathtools}

\setpapersize{A4}
\setmargins{2.2cm}
{0.5cm}
{16.5cm}
{23.42cm}
{30pt}
{1cm}
{0pt}
{2cm}
\pagestyle{fancy}
\fancyhf{}
\cfoot{\large \thepage}
\renewcommand{\headrulewidth}{0pt}

\begin{document}

\begin{center}
\begin{tikzpicture}[scale=1.5]
        \begin{axis}[
            legend pos=outer north east,
            axis lines = center,
            label style={font=\tiny},
            legend style={font=\tiny},
            xticklabel style = {font=\tiny},
            yticklabel style = {font=\tiny},
            xmin=-2.5,
            ymin=-1.5,
            xmax=2.5,
            ymax=1.5,
            xlabel = $x$,
            ylabel = $y$,
            clip=false,
            legend style={cells={align=left}}
        ]
            \addplot[domain=-pi/3:pi/3, samples=80,red,thick] ({2*cos((x) r)}, {sin((x) r)});           
            \addplot[soldot] coordinates {(1,0.866)} node[above] {\tiny $\left(1,\frac{\sqrt 3}2\right)$};
            \addplot[soldot] coordinates {(1,-0.866)} node[below] {\tiny $\left(1,-\frac{\sqrt 3}2\right)$};
    \end{axis}
\end{tikzpicture}
\end{center}

\end{document}

The equation is x^2/4 + y^2 = 1.

Thank you!

  • What is the question? – Dr. Manuel Kuehner Jul 18 '18 at 22:24
  • @Dr.ManuelKuehner how to complete the left side of the ellipse (using red dashed points). – manooooh Jul 18 '18 at 22:31
  • Do you have the equation for the line? – Dr. Manuel Kuehner Jul 18 '18 at 22:31
3

Why not continuing what you have already?

\documentclass[]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[scale=1.5]
        \begin{axis}[
            legend pos=outer north east,
            axis lines = center,
            label style={font=\tiny},
            legend style={font=\tiny},
            xticklabel style = {font=\tiny},
            yticklabel style = {font=\tiny},
            xmin=-2.5,
            ymin=-1.5,
            xmax=2.5,
            ymax=1.5,
            xlabel = $x$,
            ylabel = $y$,
            clip=false,
            legend style={cells={align=left}}
        ]
            \addplot[domain=-pi/3:pi/3, samples=10,red,thick] ({2*cos((x) r)}, {sin((x) r)})
 node[pos=1,circle,fill=black,inner sep=1pt,label={[text=black,font=\tiny]90:{$\left(1,\frac{\sqrt 3}2\right)$}}] {}
 node[pos=0,circle,fill=black,inner sep=1pt,label={[text=black,font=\tiny]-90:{$\left(1,-\frac{\sqrt 3}2\right)$}}] {};
            \addplot[dashed,domain=pi/3:5*pi/3, samples=10,red,thick] ({2*cos((x) r)}, {sin((x) r)});
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

I've decreased the sample number. Try to place embellishments using TikZ machinery instead of extra plots.

  • Well, perfect. :) You also got rid of the strange "annotation" approach. – Dr. Manuel Kuehner Jul 18 '18 at 22:32
  • Perfect! This is what I want. I did not realized that how to continue. – manooooh Jul 18 '18 at 22:35
  • @Dr.ManuelKuehner what do you mean with "strange "annotation" approach"? – manooooh Jul 18 '18 at 22:36
  • 1
    @manooooh: \addplot[soldot] coordinates {(1,0.866)} node[above] {\tiny $\left(1,\frac{\sqrt 3}2\right)$}; --> empty addplot but that's just a side note. – Dr. Manuel Kuehner Jul 18 '18 at 22:38
  • 1
    Very nice! +1. Could you perhaps consider adding smooth to the plots? – marmot Jul 19 '18 at 5:05

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.