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.

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.

share|improve this question
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. –  ferahfeza Mar 9 at 12:30

1 Answer 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

share|improve this answer
    
yes, but how come you are supplying the same x-coordinates (6.3) and the rectangle is not aligned on the yz plane? –  user2536125 Mar 10 at 17:44

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.