1

I am trying to plot a 3d axis with a rectangle perpendicular to the x-plane using the following code:

\documentclass[tikz]{standalone}
\usepackage{pgfplots,pgfplotstable}
\usetikzlibrary{calc}
\usepackage{tikz-3dplot}         
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
           view = {-40}{20},
            zmin=10^5,
            ymax=305,
            area plot/.style={
                fill opacity=0.75,
                draw=black!50!black,
                fill=blue!50,
                mark=none,
            },
            xlabel={x},
            ylabel={t },
            zlabel={y}
        ]       
        \draw [red, thick,rounded corners] (axis cs:6.3,1,10^5) rectangle (axis cs:6.3,100,1.2*10^5);
    \end{axis}
\end{tikzpicture}


\end{document}

output

All I get is a 2d axis! I am plotting other data as well; everything is working just fine, except the 3D rectangle. So I posted the code without the other plots. I am not getting any errors. It is true that the coordinates are a bit large, but he then can scale the axis simply.

1
  • 1
    I got the error: You have an axis with empty range (in direction y). Replacing it with a default range and clearing all plots. may be help you.
    – user31034
    Mar 9, 2014 at 12:30

1 Answer 1

1

Following what @ferahfeza mentioned, I just changed your source. Is this what you want?

\documentclass[tikz]{standalone}
\usepackage{pgfplots,pgfplotstable}
\usetikzlibrary{calc}
\usepackage{tikz-3dplot}         
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
           view = {-40}{20},
           xmin=0,xmax=10,
           ymin=1,ymax=100,
           zmin=9e5,zmax=13e5,
           xlabel={x},
           ylabel={t },
           zlabel={y}
        ]       
        \filldraw [red, thick,rounded corners] (axis cs:6.3,1,10e5) rectangle (axis cs:6.3,100,12e5);
    \end{axis}
\end{tikzpicture}

\end{document}

Edited picture

1
  • yes, but how come you are supplying the same x-coordinates (6.3) and the rectangle is not aligned on the yz plane? Mar 10, 2014 at 17:44

You must log in to answer this question.

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