1

i would like to set points into a 3D coordinate system but I have a problem with the axis. Now I must use (-1.1,2.0,1.1) but the data points are in (-110,200,110) format. How can I change the axis, that I can set the points without divide/100 (about 200 points)?

The range of the coordinates is: x = 0 ... 250, y = -110 ... 110, z = 0 ... 250

In this MWE, there are only eight points:

\documentclass[ngerman]{standalone}   
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}[scale=2,x={(0.7cm,0.7cm)},y={(3cm,0cm)}, z={(0cm,1cm)}]
        \draw[->, >=latex] (-1.10,0,0) -- (1.10,0,0) node[above]{$y$};
        \draw[->, >=latex] (0,0,0) -- (0,2.00,0) node[below]{$x$};
        \draw[->, >=latex] (0,0,0) -- (0,0,2.50) node[left]{$z$};
        \shadedraw  plot [only marks, mark=*, mark size=1.5pt, mark options={fill=gray}] coordinates{
            (-1.10,2.00,1.10)
            (-1.10,2.00,1.30)
            (-1.10,2.00,1.50)
            (-1.10,2.00,1.70)
            (-1.10,2.00,1.90)
            (-1.10,2.00,2.10)
            (-1.10,2.00,2.30)
            (-1.10,2.00,2.50)
        };  
    \end{tikzpicture}
\end{document}

enter image description here

1 Answer 1

2

First of all, I do not see a reason why not to use pgfplots here, for which this problem is basically nonexistent. But let's assume that there is such a reason. In that case, you easily introduce dimension too large errors. This is one way to avoid them in the current setting, but I do not think that this will work generally (which it would in pgfplots.) You can introduce scaled basis vectors.

\documentclass[ngerman]{standalone}   
\usepackage{tikz}
\tikzset{scaled unit vectors/.code={
\path (#1,0,0) coordinate (ex) (0,#1,0) coordinate (ey) 
            (0,0,#1) coordinate (ez);},scaled cs/.style={x={(ex)},y={(ey)},z={(ez)}}}
\begin{document}
    \begin{tikzpicture}[scale=2,x={(0.7cm,0.7cm)},y={(3cm,0cm)}, z={(0cm,1cm)}]
        \draw[->, >=latex] (-1.10,0,0) -- (1.10,0,0) node[above]{$y$};
        \draw[->, >=latex] (0,0,0) -- (0,2.00,0) node[below]{$x$};
        \draw[->, >=latex] (0,0,0) -- (0,0,2.50) node[left]{$z$};
        \tikzset{scaled unit vectors=0.01}
        \shadedraw[scaled cs] 
             plot [only marks, mark=*, mark size=1.5pt, mark options={fill=gray}] coordinates{
            (-110,200,110)
            (-110,200,130)
            (-110,200,150)
            (-110,200,170)
            (-110,200,190)
            (-110,200,210)
            (-110,200,230)
            (-110,200,250)
        };  
    \end{tikzpicture}
\end{document}

enter image description here

5
  • Thank you for this good solution! How can I draw a dotted line there? I try '\draw [dotted] plot[] coordinates{(-110,0,110)(-110,200,110)};' but i doesn't work. Commented May 6, 2021 at 18:52
  • Another question: How can I set the x ticks (or z), e.g. 0 ... 0.5 ... 1.0 .... 1.5 .... 2.0? Commented May 6, 2021 at 19:07
  • Mmm... it seems that you really need to dig into pgfplots, now ;)
    – SebGlav
    Commented May 6, 2021 at 19:14
  • @SebGlav Yes i think it, too. But now I don't have the time to do it.. just a few weeks finishing bachelor thesis Commented May 6, 2021 at 19:25
  • 1
    @nico.wagner \draw [scaled cs,dotted] plot[] coordinates{(-110,0,110)(-110,200,110)}; works for me. You can also use \begin{scope}[scaled cs] ... \end{scope}, where ... are the plots.
    – user241266
    Commented May 6, 2021 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .