[pstricks] smoothing 3d plot (pst-3dplot with fileplotThreeD)

Toche, Patrick ptoche at cityu.edu.hk
Tue Nov 22 11:13:08 CET 2011


while much has become clearer since my first post, and a huge thanks to Herbert, I must confess that a few things remain fuzzy. 

My main problems are: 

1. how to set the dimension of the axes,
2. how to get tickmarks and labels on the axes,
3. how to get all three arrows point away from (0,0,0)

Any suggestions welcome!

I DO know the data range (see below).

I have already selected all the data I need: I do NOT need to chop off any data (a simplification from my very first post).

To stay focused, let me plot a single trajectory with Maple and again with PSTricks, using the same data. I attach the result of both efforts. 

Here is the PSTricks code I have used:


\documentclass{article}%
\usepackage{pst-3dplot}%
\pagestyle{empty}%

% manually input data range, could be automated I suppose
% incorrectly set earlier, but seems to have no effect anyway
\def\xmin{-0.100}%
\def\xmax{+0.000}%
\def\ymin{+0.056}%
\def\ymax{+0.067}%
\def\zmin{+0.067}%
\def\zmax{+0.075}%

% manually select scaling parameters
\def\xScale{10\space}%
\def\yScale{10\space}%
\def\zScale{10\space}%

% manually select corresponding axes units
\def\xlabelFactor{$\cdot10^{-1}$}%
\def\ylabelFactor{$\cdot10^{-1}$}%
\def\zlabelFactor{$\cdot10^{-1}$}%

% adjust data range and plot figure
% manually select minimum value of x
\def\xMinVal{-0.01\space}% I don't need this actually.
\iffalse%
       xMin = \xmin
     , xMax = \xmax
     , yMin = \ymin
     , yMax = \ymax
     , zMin = \zmin
     , zMax = \zmax
\fi%
\makeatletter%
\pst at def{ScalePointsThreeD}<%
    counttomark dup dup cvi eq not { exch pop } if
    /m exch def /n m 3 div cvi def
    n { %% checkdata
      3 -1 roll %% y z x
      dup \xMinVal lt { pop pop pop /m m 3 sub def }{ 3 1 roll m 3 roll 
} ifelse
    } repeat %% checkdata
    /n m 3 div cvi def
       n {
      tx at 3DPlotDict begin
      \xScale mul           %% scale by \xScale
      3 1 roll \yScale mul  %% scale by \yScale
      3 1 roll \zScale mul  %% scale by \zScale
      3 1 roll
      saveCoor
      ConvertTo2D
      x2D \pst at number\psxunit mul y2D \pst at number\psyunit mul
      end
      m 1 sub 1 roll m 1 sub 1 roll /m m 3 sub def
     } repeat
 >
\makeatother%

\pagestyle{empty}%

\begin{document}%

% restrict range to [-1,0] by [0,1] by [0,1] box
\def\xMin{-1}%
\def\xMax{0}%
\def\yMin{0}%
\def\yMax{1}%
\def\zMin{0}%
\def\zMax{1}%
   
\def\N{1}%Number of Lines % Only one line today

% color scheme
\definecolorseries{lineColors}{hsb}{last}{red}{blue}%
\resetcolorseries[\N]{lineColors}%

\begin{pspicture}(-5,-5)(5,5)%

\psset{unit = 5}%

\pstThreeDCoor[%
  xMin = \xMin
  , xMax = \xMax
  , yMin = \yMin
  , yMax = \yMax
  , zMin = \zMin
  , zMax = \zMax
  , xlabelFactor = \xlabelFactor
  , ylabelFactor = \ylabelFactor
  , zlabelFactor = \zlabelFactor
  , IIIDticks = true
  , IIIDlabels = true
  , IIIDticksize = 0.05
  , linecolor = red
  , linewidth = 2\pslinewidth
  , nameX = $\mathbf{x}$
  , nameY = $\mathbf{y}$
  , nameZ = $\mathbf{z}$
]%

\multido{\n=1+1}{\N}{%
   \readdata{\data}{data/xyz\n.txt}%
   \listplotThreeD[%
     plotstyle = line
     , linecolor = {lineColors!![\n}% syntax !![\n
   ]{\data}%
}%


\end{pspicture}%

\end{document}%

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xyzplot.pdf
Type: application/pdf
Size: 7704 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20111122/ca34dbdd/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xyzmaple.jpg
Type: image/jpeg
Size: 16686 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20111122/ca34dbdd/attachment-0001.jpg>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xyz1.txt
URL: <http://tug.org/pipermail/pstricks/attachments/20111122/ca34dbdd/attachment-0001.txt>


More information about the PSTricks mailing list