Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When we draw \psaxes they initially have ticks and there's an option which lets us to omit them. I'm trying to put some ticks on my \pscurve, I was wondering is there a way to divide a line or a curve into n (e.g., 12) equal pieces and put a tick for them? As we do for the axes.

\documentclass{article}

‎\usepackage{pstricks‎ , ‎pst-plot}‎
‎\usepackage{pst-bezier}‎ 
‎\usepackage{pst-math}‎

\begin{document}

‎\psset{xunit=0.5cm,yunit=0.5cm}‎‎‎
‎\centering‎
‎\begin{pspicture}(8,8)‎
‎\psaxes[labels=none,ticks=none]{->}(0,0)(8,8)[$x$,0][$y$,0]‎‎
‎\pscurve{-}(1,1)(3,4)(6,6)(8,4)‎‎% want to devide this curve into 6 equal pieces and putting a tick on each
‎\end{pspicture}‎‎

\end{document}

this is what I get

enter image description here

While I want to have something like this :

enter image description here

share|improve this question
1  
Sample code please! Give the wizards something to work with. –  qubyte Feb 9 '12 at 10:09
1  
I added to code –  Negin Feb 9 '12 at 10:17
2  
calculating distance along a parametric curve requires calculus, so the answer to your question is going to be dependent on the curve and whether you can differentiate the expressions symbolically or numerically (and is likely to be hard either way:-). –  David Carlisle Feb 9 '12 at 10:28
2  
@DavidCarlisle: we have PostScript and the flattenpath function. The reason why we do not need something to calculate –  Herbert Feb 9 '12 at 11:15
add comment

1 Answer

up vote 7 down vote accepted

With the current versions of pstricks.tex and pstricks.pro you can do something like:

\documentclass{article}
\usepackage{pst-plot}

\begin{document}

\psset{unit=0.5cm}
\begin{pspicture}(9,8)
\psaxes[labels=none,ticks=none]{->}(0,0)(8,8)[$x$,0][$y$,0]
\pscurve(1,1)(3,4)(6,6)(8,4)
\pscurve[linestyle=symbol,symbolStep=11.6pt,% must be positive 
  curveticks,startAngle=60](1,1)(3,4)(6,6)(8,4)
\end{pspicture}
\begin{pspicture}(8,8)
\psaxes[labels=none,ticks=none]{->}(0,0)(8,8)[$x$,0][$y$,0]
\pscurve[linestyle=symbol,symbolStep=-12,% must be negative !
  curveticks,startAngle=60](1,1)(3,4)(6,6)(8,4)
\end{pspicture}

\end{document}

enter image description here

The left image has the ticks placed with a fixed width and the right one with a calculated width given by the number of ticks. The first tick is placed by the value of startAngle because we cannot calculate the slope for the first point.

For more informations read the file pst-news12.pdf all available in the next few days with the TeXLive update manager or already at http://texnik.dante.de

Instead of plotting a curve by coordinates one can also plot a function:

\documentclass{article}
\usepackage{pst-plot}
\begin{document}

\psset{unit=0.5cm}
\begin{pspicture}(0,-4)(15,5)
\psaxes[labels=none,ticks=none]{->}(0,0)(0,-4)(14.5,4.5)[$x$,0][$y$,0]
\psplot[algebraic,plotstyle=curve,linestyle=symbol,
  curveticks,symbolStep=8pt]{0}{14}{ 1.75*(sin(x)+2*cos(x)^2) }
\end{pspicture}

\end{document}

enter image description here

share|improve this answer
    
Are those shapes (dot,triangle,etc) all we can have as symbols or is there a way to change the dots ticks ? –  Negin Feb 9 '12 at 10:54
    
as I wrote, read the doc: run texdoc pst-news10 –  Herbert Feb 9 '12 at 11:13
1  
I'll upload a solution with tick marks on the curve at afternoon –  Herbert Feb 9 '12 at 11:23
1  
@Negin: I updated my answer. –  Herbert Feb 9 '12 at 15:34
    
I am interested to know whether it is very hard in TikZ. –  I am who I say I am Feb 9 '12 at 15:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.