16

Sloped text nodes along paths in a slanted scope seem off. Is there any way to fix this?

\documentclass{standalone}

\usepackage{tikz}
\newcommand{\yslant}{0.5}
\newcommand{\xslant}{-0.6}

\begin{document}
\begin{tikzpicture}[scale=2]
    \begin{scope}[every node/.append style={yslant=\yslant,xslant=\xslant}, yslant=\yslant,xslant=\xslant]
        \draw (-0.5,5) -- (-0.5,2) node [midway, below, sloped] {weaker control flow};
        \draw (-0.5,5) -- (2,5) node [midway, above, sloped] {well-formedness};
        \draw (-0.5,5) -- (-2,2.5) node [midway, above, sloped] {number of exits};
    \end{scope}
\end{tikzpicture}
\end{document}

enter image description here

Edit: I don't just need the axes, here's the whole figure:

enter image description here

5
  • My advice is to use rotate instead of slanting. From what I can tell, the effect of slanting is x'=x(y) + xslanty and y'= y(x) + yslantx, so the results depend on which slant is performed first. Oct 29, 2013 at 14:59
  • 1
    Excuse the pun but y slant?
    – percusse
    Oct 29, 2013 at 15:02
  • I have a complex figure similar to this: tex.stackexchange.com/questions/12689/… Can I do this using rotation?
    – thpani
    Oct 29, 2013 at 20:32
  • The advantage of slant in the mentioned example is that it turns a rectangle into a parallelogram. You could just draw a parallelogram, in which case you wouldn't need either slant or rotate. Oct 30, 2013 at 12:36
  • Then again, if you want 3d text, you need xslant. Nov 2, 2013 at 15:35

2 Answers 2

10

Is this sort of where you are headed?

\documentclass{standalone}
\usepackage{tikz}

\pgfsetxvec{\pgfpoint{.866cm}{.5cm}}
\pgfsetyvec{\pgfpoint{.866cm}{-.5cm}}
\pgfsetzvec{\pgfpoint{0cm}{-1cm}}

\begin{document}

\begin{tikzpicture}
\draw [->] (0,0,0) -- (5,0,0) node[midway,sloped,above,xslant=-0.5] {well-formedness};
\draw [->] (0,0,0) -- (0,5,0) node[midway,sloped,above,xslant=0.5] {weaker control flow};
\draw [<-] (0,0,5) -- (0,0,0) node[midway,sloped,above] {number of exits};
\path (2,1,0) node[rectangle,draw=black,rotate=30,xslant=-0.5] {test};
\end{tikzpicture}

\end{document}

new trial

2
  • I don't just need the axes, the code I posted was just an MWE. I've updated my question.
    – thpani
    Nov 1, 2013 at 16:23
  • I have better luck with xslant than yslant Nov 1, 2013 at 23:41
2

With PSTricks.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\psset{nrot=:U,shortput=nab}
\begin{document}
\begin{pspicture}(6,6)
    \pcline{->}(2,2)(2,6)^{$y$-axis}
    \pcline{<-}(0,0)(2,2)^{$z$-axis}
    \pcline{->}(2,2)(6,2)^{$x$-axis}
\end{pspicture}
\end{document}

enter image description here

3
  • You really like pstricks :D Tell me, are the direction of the axis manually set? I see numbers in your code. :P
    – Alenanno
    Oct 30, 2013 at 21:50
  • @Alenanno: Yes. It was manually set up because I was not using the 3D package. Oct 30, 2013 at 21:53
  • sorry, i'm really looking for a TikZ solution
    – thpani
    Nov 1, 2013 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.