Graphics, Figures & Tablesplot curve

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: plot curve

Post by localghost »

Sorry, but I can't follow you. I'm outty.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: plot curve

Post by ditka »

It is possible to draw that picutre with latex:

(considering that this is slightly diffrent then what I want at the beginning, should I open new topic?)
Attachments
flkskfsfs.JPG
flkskfsfs.JPG (17 KiB) Viewed 9233 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

plot curve

Post by localghost »

This is the very last thing I can offer.

Code: Select all

\documentclass[11pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}[>=stealth]
    \fill[blue!25] plot[parametric,samples=50,domain=1.5708:3.1416] function {0.5*t*sin(t+0.5*pi),-0.5*t*cos(t+0.5*pi)} -- (0,0) -- cycle;
    \draw[blue] plot[parametric,samples=100,domain=0:6.2832] function {0.5*t*sin(t+0.5*pi),-0.5*t*cos(t+0.5*pi)};
    \draw[->] (-4,0) -- (4,0) node[right] {$x$};
    \draw[->] (0,-4) -- (0,4) node[above] {$y$};
  \end{tikzpicture}
\end{document}
And you should really, really read the pgf/tikZ manual.
Attachments
The resulting output.
The resulting output.
tikZ-parametric-plot.png (5.09 KiB) Viewed 9229 times
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

plot curve

Post by cgnieder »

Reading manuals is really helpful! I didn't know how to do this 10 minutes ago (and will have forgotten it again in two days):

Code: Select all

\documentclass{scrartcl}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
 \begin{axis}[
   ticks=none,
   axis y line=center,
   axis x line=middle,
   axis on top,
   domain=0:2*pi]
  \addplot[fill,mark=none,red!10,samples=100,domain=.5*pi:pi]
    ({.5*x*sin(deg(x)+90))},{-.5*x*cos(deg(x)+90))}) \closedcycle;
  \addplot[mark=none,red,samples=50]
    ({.5*x*sin(deg(x)+90))},{-.5*x*cos(deg(x)+90))}) ;
 \end{axis}
\end{tikzpicture}

\end{document}
pgfplots.png
pgfplots.png (4.47 KiB) Viewed 9227 times
Regards
site moderator & package author
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

plot curve

Post by ditka »

localghost wrote:This is the very last thing I can offer.

Code: Select all

\documentclass[11pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}[>=stealth]
    \fill[blue!25] plot[parametric,samples=50,domain=1.5708:3.1416] function {0.5*t*sin(t+0.5*pi),-0.5*t*cos(t+0.5*pi)} -- (0,0) -- cycle;
    \draw[blue] plot[parametric,samples=100,domain=0:6.2832] function {0.5*t*sin(t+0.5*pi),-0.5*t*cos(t+0.5*pi)};
    \draw[->] (-4,0) -- (4,0) node[right] {$x$};
    \draw[->] (0,-4) -- (0,4) node[above] {$y$};
  \end{tikzpicture}
\end{document}
And you should really, really read the pgf/tikZ manual.
From this I only get the cooridnate axis, no graph.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

plot curve

Post by localghost »

ditka wrote:From this I only get the cooridnate axis, no graph.
It will require Gnuplot. So your old problem reappears. Too bad.
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: plot curve

Post by ditka »

Ok. How did you know which function to use?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

plot curve

Post by localghost »

ditka wrote:[…] How did you know which function to use?
By reading a mathematics textbook or in this case the corresponding Wikipedia article [1]*. That's a common practice. Your version needed slight adaptations to the printed function.

[1] Archimedean spiral – Wikipedia, the free encyclopedia

* The German version of this article is more comprehensive. Perhaps in other languages, too.
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

plot curve

Post by ditka »

What if I want to use other polar plots, for which I do not know parametric equation(or it maybe do not even exist?)(for example polar rose).

And is it possible to fill the place with dots or lines insted of a color?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

plot curve

Post by localghost »

ditka wrote:What if I want to use other polar plots, for which I do not know parametric equation(or it maybe do not even exist?)(for example polar rose). […]
The site you linked clearly shows that the function for this rose is r=cos(kθ). So you just have to translate that.

Code: Select all

\documentclass[11pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\usetikzlibrary{patterns}

\begin{document}
  \begin{tikzpicture}
    \begin{polaraxis}[hide axis]
      \addplot+[pattern=dots,pattern color=blue,mark=none,domain=0:360,samples=300]{cos(4*x)};
    \end{polaraxis}
  \end{tikzpicture}
\end{document}
Perhaps some reading in mathematics would be good if you need such elements.
ditka wrote:[…] And is it possible to fill the place with dots or lines insted of a color?
You really need to learn how to read manuals. All of these questions can be answered with RTFM. Search the pgf/tikZ manual for pattern (see code above).
Attachments
The resulting output.
The resulting output.
polar-rose.png (26.08 KiB) Viewed 9206 times
Post Reply