Graphics, Figures & TablesIncorrect graphs of Sine and Cosine and Axes problems

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Incorrect graphs of Sine and Cosine and Axes problems

Post by coachbennett1981 »

I posted a graph earlier, but I am having more difficulty. I am reading the PsTricks-Add documentation, but can't see to figure this out. Below are two graphs, both sin(x). The first graph is correct with correct labels, but the second graph is not. Notice the y value of pi. How can I have different labeled axis to match my function?

Code: Select all


\documentclass[12pt]{article}
\usepackage{pstricks-add}
\begin{document}

 \begin{pspicture}(-6.5,-7)(6.5,7.5) 
 \psaxes[trigLabelBase=3,dx=\psPiH, xunit=\psPi,trigLabels]{->}(0,0)(0,-4)(\psPiTwo,5)[$x$,0][$y$,90] 
 \psset{algebraic} 
  \psplot[yMaxValue=6,linewidth=1.6pt,plotpoints=2000, linecolor=red,arrows=<->]{0}{\psPiTwo}{sin(x)} 
  \end{pspicture}

 \begin{pspicture}(-6.5,-7)(6.5,7.5) 
 \psaxes[trigLabelBase=2,dx=\psPiH, xunit=\psPi,trigLabels]{->}(0,0)(0,-4)(\psPiTwo,5)[$x$,0][$y$,90] 
 \psset{algebraic} 
  \psplot[yMaxValue=6,linewidth=1.6pt,plotpoints=2000, linecolor=red,arrows=<->]{0}{\psPiTwo}{sin(x)} 
  \end{pspicture}
\end{document}

Last edited by coachbennett1981 on Wed May 26, 2010 12:28 pm, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Incorrect graphs of Sine and Cosine and Axes problems

Post by CrazyHorse »

coachbennett1981 wrote:I posted a graph earlier, but I am having more difficulty. I am reading the PsTricks-Add documentation, but can't see to figure this out. Below are two graphs, both sin(x). The first graph is correct with correct labels, but the second graph is not. Notice the y value of pi. How can I have different labeled axis to match my function?

Code: Select all

\documentclass[12pt]{article}
\usepackage{pstricks-add}
\begin{document}

\begin{pspicture}(-0.5,-1.5)(6.5,2)
\psaxes[trigLabelBase=3,xunit=\pstRadUnit,
  trigLabels]{->}(0,0)(0,-1)(\psPiTwo,2)[$x$,0][$y$,90]
\psset{algebraic}
  \psplot[linewidth=1.6pt,
  plotpoints=2000, linecolor=red,arrows=<->]{0}{\psPiTwo}{sin(x)}
\end{pspicture}

\begin{pspicture}(-0.5,-7)(6.5,7.5)
\psaxes[trigLabelBase=2,dx=\psPiH, xunit=\psPi,trigLabels]{->}(0,0)(0,-1.5)(2.2,2)[$x$,0][$y$,90]
\psset{algebraic}
\psplot[linewidth=1.6pt,plotpoints=2000, 
    linecolor=red,arrows=<->]{0}{\psPiTwo}{sin(x)}
\end{pspicture}

\end{document}
Herbert
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Incorrect graphs of Sine and Cosine and Axes problems

Post by coachbennett1981 »

Again, I appreciate you taking the time to help. I know I ask alot of graphing questions that you respond to. I like to keep you guys on your toes :D
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Incorrect graphs of Sine and Cosine and Axes problems

Post by coachbennett1981 »

Herbert,

The graphs look great, but notice in the first set of code:

Code: Select all

\begin{pspicture}(-0.5,-1.5)(6.5,2)
\psaxes[trigLabelBase=3,xunit=\pstRadUnit,
  trigLabels]{->}(0,0)(0,-1)(\psPiTwo,2)[$x$,0][$y$,90]
\psset{algebraic}
  \psplot[linewidth=1.6pt,
  plotpoints=2000, linecolor=red,arrows=<->]{0}{\psPiTwo}{sin(x)}
\end{pspicture}
sin(pi)=0, however, the graph is slightly off the appropriate y value, is there anyway to fix this?

Nick
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Incorrect graphs of Sine and Cosine and Axes problems

Post by CrazyHorse »

coachbennett1981 wrote: The graphs look great, but notice in the first set of code:

Code: Select all

\begin{pspicture}(-0.5,-1.5)(6.5,2)
\psaxes[trigLabelBase=3,xunit=\pstRadUnit,
  trigLabels]{->}(0,0)(0,-1)(\psPiTwo,2)[$x$,0][$y$,90]
\psset{algebraic}
  \psplot[linewidth=1.6pt,
  plotpoints=2000, linecolor=red,arrows=<->]{0}{\psPiTwo}{sin(x)}
\end{pspicture}
sin(pi)=0, however, the graph is slightly off the appropriate y value, is there anyway to fix this?
I cannot see any problem ...
Attachments
x.png
x.png (8.23 KiB) Viewed 3458 times
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Incorrect graphs of Sine and Cosine and Axes problems

Post by coachbennett1981 »

You are right, I opened a new file and got the same graph. I am sorry to have troubled you again.. Thank you for you time.

Best,

Nick
Post Reply