Graphics, Figures & Tablesplot curve

Information and discussion about graphics, figures & tables in LaTeX documents.
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

plot curve

Post by ditka »

Which option is the best for ploring curves(normal,polar, parametric,...), so that the you get just curve(nor coordinate system)?

Recommended reading 2024:

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

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

User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

plot curve

Post by cgnieder »

If I recall this correctly you have been pointed to the mighty pgfplots more than one time. I suggest you study its documentation: pgfplots.

Code: Select all

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
 \begin{axis}[hide axis]
  \addplot[mark=none] {x^2} ;
 \end{axis}
\end{tikzpicture}

\begin{tikzpicture}
 \begin{axis}[view={60}{30},hide axis]
  \addplot3[mesh,z buffer=sort,samples=20,domain=-1:0,y domain=0:2*pi]
  ({sqrt(1-x^2) * cos(deg(y))},{sqrt( 1-x^2 ) * sin(deg(y))},x);
 \end{axis}
\end{tikzpicture}

\end{document}
pgfplots.png
pgfplots.png (17.75 KiB) Viewed 9632 times
Regards
site moderator & package author
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

plot curve

Post by localghost »

You should learn to read manuals and also things that people write as answers to your questions. You have been already referred to respective packages and their manuals in other threads.

Code: Select all

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

\begin{document}
  \begin{tikzpicture}[domain=0:6.28]
    \draw[color=blue,samples=50] plot[id=sin] (\x,sin(\x r);
  \end{tikzpicture}
\end{document}
For details refer to the pgf/tikZ manual. For more sophisticated plotting take a look at pgfplots.


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

plot curve

Post by ditka »

cgnieder wrote:If I recall this correctly you have been pointed to the mighty pgfplots more than one time. I suggest you study its documentation: pgfplots.

Code: Select all

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
 \begin{axis}[hide axis]
  \addplot[mark=none] {x^2} ;
 \end{axis}
\end{tikzpicture}

\begin{tikzpicture}
 \begin{axis}[view={60}{30},hide axis]
  \addplot3[mesh,z buffer=sort,samples=20,domain=-1:0,y domain=0:2*pi]
  ({sqrt(1-x^2) * cos(deg(y))},{sqrt( 1-x^2 ) * sin(deg(y))},x);
 \end{axis}
\end{tikzpicture}

\end{document}
pgfplots.png
Regards
With that, if I draw coordinate system(manually) curves does not go to the right place.
localghost wrote:You should learn to read manuals and also things that people write as answers to your questions. You have been already referred to respective packages and their manuals in other threads.

Code: Select all

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

\begin{document}
  \begin{tikzpicture}[domain=0:6.28]
    \draw[color=blue,samples=50] plot[id=sin] (\x,sin(\x r);
  \end{tikzpicture}
\end{document}
For details refer to the pgf/tikZ manual. For more sophisticated plotting take a look at pgfplots.


Thorsten

This works, is it possible to use polar, pamatric plot and filling option with this?
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

plot curve

Post by cgnieder »

ditka wrote:With that, if I draw coordinate system(manually) curves does not go to the right place.
Since you're not showing any code I can only guess but I would bet you're somehow doing it wrong. The pgfplots package is extremely powerful and has loads and loads of options for customization. Look at Jake's article here for example or skim through these questions to see what is possible.

Regards
site moderator & package author
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

plot curve

Post by localghost »

ditka wrote: This works, is it possible to use polar, pamatric plot and filling option with this?
See Section 19 of the pgf/tikZ manual. But I think that you are better with pgfplots. And so the circle is complete.
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: plot curve

Post by ditka »

Okay,is it possible than to do that with pgf plots? The picture shoud look someething like this:

(the polar plot of curve r=theta/2)
Attachments
ldfsalflfal.JPG
ldfsalflfal.JPG (9.79 KiB) Viewed 9619 times
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

plot curve

Post by ditka »

cgnieder wrote:
ditka wrote:With that, if I draw coordinate system(manually) curves does not go to the right place.
Since you're not showing any code I can only guess but I would bet you're somehow doing it wrong. The pgfplots package is extremely powerful and has loads and loads of options for customization. Look at Jake's article here for example or skim through these questions to see what is possible.

Regards
I use this code:

Code: Select all

    \documentclass{article}
    \usepackage{pgfplots}
    \begin{document}

    \begin{tikzpicture}
  
    \draw[->] (-4,0) -- (4.2,0) node[right] {y};
    \draw[->] (0,-4) -- (0,4.2) node[above] {x};
     \begin{axis}[hide axis]
      \addplot[mark=none] {x^2} ;
     \end{axis}
    \end{tikzpicture}
    \end{document}
I get this picture:
Attachments
dsdfsfafads.JPG
dsdfsfafads.JPG (7.41 KiB) Viewed 9621 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

plot curve

Post by localghost »

Correct me when I'm wrong, but in your initial post you explicitly asked for curves without a coordinate system.
ditka wrote:Which option is the best for ploring curves(normal,polar, parametric,...), so that the you get just curve(nor coordinate system)?
And now you present this sketch with a curve and an obvious coordinate system? And it's neither polar nor parametric, just Cartesian. Did I miss something? m(

Addendum:
Your example can't work the way you want. You are drawing the axis in the tikzpicture environment with intersection at (0,0), thus this is its origin. But you plot the curve inside the axis environment, which has its lower left corner (not its origin) at (0,0). So it's not a surprise that the curve is not at the expected place.

By the way, I don't understand why you want to draw the axis by hand and don't let pgfplots do the job. The axis environment is customizable in many ways. Perhaps you can clarify that.
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

plot curve

Post by ditka »

localghost wrote:Correct me when I'm wrong, but in your initial post you explicitly asked for curves without a coordinate system.
ditka wrote:Which option is the best for ploring curves(normal,polar, parametric,...), so that the you get just curve(nor coordinate system)?
And now you present this sketch with a curve and an obvious coordinate system? And it's neither polar nor parametric, just Cartesian. Did I miss something? m(

Addendum:
Your example can't work the way you want. You are drawing the axis in the tikzpicture environment with intersection at (0,0), thus this is its origin. But you plot the curve inside the axis environment, which has its lower left corner (not its origin) at (0,0). So it's not a surprise that the curve is not at the expected place.

By the way, I don't understand why you want to draw the axis by hand and don't let pgfplots do the job. The axis environment is customizable in many ways. Perhaps you can clarify that.

I want to plot coordinate axis manually, but both gnuplot and pgfplots do their coordinate system automatically. That is what I write that cooridnate axis shoud not be ploted. Anf it that option woud work for polar and parametric equations:

Code: Select all

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

    \begin{document}
      \begin{tikzpicture}[domain=0:6.28]
        \draw[color=blue,samples=50] plot[id=sin] (\x,sin(\x r);
      \end{tikzpicture}
    \end{document}
it would be fine, but since it does not I post that image,
since I somehow conclue that I can not get polar and parametric plot like that and they can be ploted only with coordinate axis and so I plot the exaple, to se it that can be done?

coordinate system? And it's neither polar nor parametric, just Cartesian. Did I miss something? m(


The coodrinate system is cartesian, but the plot is not.
That is also one of the reasons, why I want to plot coordinate axis mannualy, so that I can make it in any way,regardless of plot on it.


So is it possible to draw the picture from example(using whatever)?
Post Reply