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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please I would like to draw a central composite design using PSTricks, or possibly tikz. This is the cube with the axes showed below. I have tried pst-3d but this is not easy. If you had an example of a similar figure this would be ideal.

central composite

EDIT (later): Ok I am back to home and I have found some time to do the figure with pst3d-plot. This is not the final figure but now it is easy to modify with the help of the pst3d-plot documentation (except that the options are not all documented e.g. for pstThreeDBox - do you know another doc?)




   \begin{pspicture}(-6,-6.5)(6 ,6)
       \pstThreeDCoor[linecolor=black, IIIDticks, IIIDlabels,
      xMin=-7.95,  yMin=-7.95,  zMin=-7.95, 
     xMax=8,  yMax=8,  zMax=8, 
      IIIDxTicksPlane=xz, IIIDxticksep = 0.4, , Dx=1,  deltax=4,
        IIIDyTicksPlane=xz, IIIDyticksep = -0.4, , Dy=1,  deltay=4,
      IIIDzTicksPlane=xz, IIIDzticksep = -0.4, , Dz=1,   deltaz=4]


enter image description here

share|improve this question
Can you also include your basic PSTricks experiment regardless of how basic it is? It would save others to set up an example from scratch. – percusse Oct 2 '12 at 13:26
@percusse Sorry I have just copy-paste the code in pages 9 and 10 of this documentation bakoma-tex.com/doc/generic/pst-3d/pst-3d.pdf Then I have tried to add the red lines but without success. Maybe the pst-3dplot package would be a better solution but I'm at work right now and I have to take my computer at home to install a package. – Stéphane Laurent Oct 2 '12 at 13:31

Perhaps you can use this tikz code as a starting point:



\begin{tikzpicture}[x  = {(-0.5cm,-0.5cm)},
                    y  = {(0.95cm,-0.25cm)},
                    z  = {(0cm,1cm)}]

\begin{scope}[canvas is yz plane at x=-1]
  \draw[blue] (-1,-1) -- (-1,1) -- (1,1) -- (1,-1) -- cycle ;
  \foreach \x in {-1,1}
    \foreach \y in {-1,1}
        \fill[blue] (\x,\y) circle (1pt);
\begin{scope}[canvas is yz plane at x=1]
  \draw[blue] (-1,-1) -- (-1,1) -- (1,1) -- (1,-1) -- cycle;
    \foreach \x in {-1,1}
    \foreach \y in {-1,1}
        \fill[blue] (\x,\y) circle (1pt);
\begin{scope}[canvas is xz plane at y=1]
  \draw[blue] (-1,-1) -- (-1,1) -- (1,1) -- (1,-1) -- cycle;
\begin{scope}[canvas is xz plane at y=-1]
  \draw[blue] (-1,-1) -- (-1,1) -- (1,1) -- (1,-1) -- cycle;
\begin{scope}[canvas is yz plane at x=0]
 \draw[red,dashed] (-1.5,0) -- (0,0) -- (1.5,0);
 \draw[red,dashed] (0,-1.5) -- (0,0) -- (0,1.5);
 \foreach \y in {-1.5,0,1.5} \fill[blue] (\y,0) circle (1pt);
 \foreach \z in {-1.5,1.5} \fill[blue] (0,\z) circle (1pt);
\begin{scope}[canvas is xz plane at y=0]
\draw[red,dashed] (-1.5,0) -- (0,0) -- (1.5,0);
\foreach \x in {-1.5,1.5} \fill[blue] (\x,0) circle (1pt);



There remain many things to improve but it may get you on tracks. Also, there may be an easier solution with pgfplots.

enter image description here

share|improve this answer
Thanks. I would be glad if someone could show how to add the labeled axes. I want to do this picture for tomorrow morning and right now the tikz package is not installed on my computer (I cannot install a package at the office) – Stéphane Laurent Oct 2 '12 at 13:37

Another TikZ version, using the 3D coordinate system:






[   x={(\xangle:1cm)},

\foreach \x in {-1,1} \foreach \y in {-1,1} \foreach \z in {-1,1} \coordinate (c\x\y\z) at (\x,\y,\z);

\draw[fill=black,very thick] (0,1,0) -- (0,\dumbbelllength,0) circle (0.05cm);
\draw[fill=black,very thick] (1,0,0) -- (\dumbbelllength,0,0) circle (0.05cm);
\draw[fill=black,very thick] (0,0,-1) -- (0,0,-\dumbbelllength) circle (0.05cm);

\begin{scope}[fill opacity=0.5,draw=black,draw opacity=1,thick]
    \filldraw[violet,draw=black] (c-1-1-1) -- (c-11-1) -- (c11-1) -- (c1-1-1) -- cycle;
    \filldraw[red,draw=black] (c111) -- (c11-1) -- (c1-1-1) -- (c1-11) -- cycle;
    \filldraw[blue,draw=black] (c111) -- (c11-1) -- (c-11-1) -- (c-111) -- cycle;

    \draw[very thick] (0,0,-1) -- (0,0,1) (0,-1,0) -- (0,1,0) (-1,0,0) -- (1,0,0);

    \filldraw[yellow,draw=black] (c111) -- (c1-11) -- (c-1-11) -- (c-111) -- cycle; 
    \filldraw[green,draw=black] (c-1-1-1) -- (c-1-11) -- (c-111) -- (c-11-1) -- cycle;
    \filldraw[orange,draw=black] (c-1-1-1) -- (c-1-11) -- (c1-11) -- (c1-1-1) -- cycle;

\draw[fill=black,very thick] (0,-1,0) -- (0,-\dumbbelllength,0) circle (0.05cm);
\draw[fill=black,very thick] (-1,0,0) -- (-\dumbbelllength,0,0) circle (0.05cm);
\draw[fill=black,very thick] (0,0,1) -- (0,0,\dumbbelllength) circle (0.05cm);

\draw[thick] (-2,-2,-2) -- node[below right=1cm] {\huge x} (2,-2,-2);
\draw[thick] (-2,-2,-2) -- node[below left=1cm] {\huge y} (-2,2,-2);
\draw[thick] (-2,2,-2) -- node[left=1cm] {\huge z} (-2,2,2);

\foreach \c in {-2,...,2}
{   \draw (-2,2,\c) node[inner sep=0.05cm,fill=black,circle,label=\zangle+90:\c] {};
    \draw (-2,\c,-2) node[inner sep=0.05cm,fill=black,circle,label=\yangle+90:\c] {};
    \draw (\c,-2,-2) node[inner sep=0.05cm,fill=black,circle,label=\xangle-90:\c] {};




enter image description here

share|improve this answer

Your Answer


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.