Graphics, Figures & Tablessin(x) xaxis labels with PSTricks

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

sin(x) xaxis labels with PSTricks

Post by coachbennett1981 »

I am trying to show sin(x), but I can not get the xaxis to be labeled in radians (fraction form) on intervals of pi/2, pi, 3pi/2, etc.. Here is the code:

Code: Select all

\documentclass[12pt]{exam}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{subfigure}
\usepackage{epstopdf}
\usepackage{pstricks}
\usepackage{pst-coil}
\usepackage{color}
\usepackage{pst-node}
\usepackage{subfigure}
\usepackage{xkeyval}
\usepackage{pst-poly}
\usepackage{pst-plot}
\usepackage{pst-func}
\usepackage{pst-circ}
\usepackage{pstricks-add}
\usepackage{pst-3d}	
\begin{document}
\psset{xunit=\psPiTwo}
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
	\psaxes[dx=0.75,trigLabelBase=2]{<->}(0,0)(-0.5,-1.25)(6.5,1.25)
	\psplot[xunit=0.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin}
\end{pspicture}
\end{document}

Thank you

Nick

Recommended reading 2024:

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

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

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Re: sin(x) xaxis labels with PSTricks

Post by php1ic »

I don't have experience with pstricks/TikZ but I think you have to set the coordinate and label for each one, eg at (1.570795,0) draw {$\frac{\pi}{2}$}

Like in this example
http://www.texample.net/tikz/examples/phasor-diagram/
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

sin(x) xaxis labels with PSTricks

Post by localghost »

Code: Select all

\documentclass{minimal}
\usepackage{pstricks-add}

\begin{document}
  \begin{pspicture}(-0.5,-2)(6.5,2)
    \psaxes[dx=\psPiH,trigLabelBase=2,trigLabels]{<->}(0,0)(-0.5,-1.25)(6.5,1.25)
    \psplot[xunit=0.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin}
  \end{pspicture}
\end{document}
For more information see the pst-plot manual.


Best regards
Thorsten
Post Reply