The usual cartesian coordinate system obviously has the number system ordered on the axis.
What I want is a general coordinate system where I can have objects in place of the numbers on the axis.
Before everyone ask what I need it for and steer the question into oblivion. This is to plot abstract Group Theory results which are ordered and bound objects with defined fixed abstract intervals.
So to make a really stupid example, I need to plot a coordinate system with instead of {0,1,2,3,4,5,6} etc on the xaxis, must have {nada,apple,orange,DarthVader, Melon,Papaya,Yoda.....etc} on the axis.
I cannot figure out with what I know about pgplots and tikz how to NOT plot even space numbers, but to plot even spaced objects.
What I ask simply is to have {nada,apple,orange,DarthVader, Melon,Papaya,Yoda.....etc} plotted on the x,y or zaxis evenly spaced and not {0,1,2,3,4,5,6}. That's all.
I attach two cartesian coordinate system LaTeX code examples I found online. Use any of the two to suggest how I can achieve the above.
Thanks
LaTeX forum ⇒ Graphics, Figures & Tables ⇒ 3dim coordinate system plot with objects as elements.
3dim coordinate system plot with objects as elements.
 Attachments

 3dimensionalcartesianaxissystem1.tex
 (1.6 KiB) Downloaded 16 times

 3dimensionalcartesianaxissystem.tex
 (1.23 KiB) Downloaded 21 times
 Stefan Kottwitz
 Site Admin
 Posts: 9243
 Joined: Mon Mar 10, 2008 9:44 pm
You can use symbolic coordinates:
Stefan
\documentclass[border=2mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=center, xlabel={$x$axis},ylabel={$y$axis},zlabel={$z$axis}, symbolic y coords={nada,apple,orange,DarthVader,Melon,Papaya,Yoda}, ytick = data, ] \addplot3 [only marks] coordinates { (2,DarthVader,2) (3,Yoda,5) (1,Papaya,2) (5,Melon,1)}; \end{axis} \end{tikzpicture} \end{document}
Stefan
Site admin
Stefan,
Thank you very much !
That works for me.
Dont know why I couldnt manage to figure it out from the manual.
Thank you very much !
That works for me.
Dont know why I couldnt manage to figure it out from the manual.
So now to the second part of the question.
Stefan solved the problem using the pgfplots package using the second example file I posted. (3dimensionalcartesianaxissystem.tex)
The remainder of the question is how do you do this WITHOUT using the pgfplots package.
That will mean you have to take the second file I attached in my original post which doesnt use pgfplots but tikz exclusively, namely (3dimensionalcartesianaxissystem1.tex)
The question now continues using only the packages used in the headers of "3dimensionalcartesianaxissystem1.tex"
In particular, using that file which creates a coordinate system without using pgfplots how do I
1) Replace the numbers on the tickmarks with arbitrary words like ( papaya, DarthVader, Melon, or Yoda ) or whatever.
2) I can then use a label \node at (1,1) {Melon}; as an example, to replace the tickmarks. So basically all I need is how to remove the numbers on the axis but keep everything else asis in "3dimensionalcartesianaxissystem1.tex" as attached in original post.
I used LaTeX graphplotting for years but got stumped lately once I do not use number systems on the axis.
I want to eventually move over to tikz exclusively for all graphics. The manual is amazingly nice and a work of art!
Stefan solved the problem using the pgfplots package using the second example file I posted. (3dimensionalcartesianaxissystem.tex)
The remainder of the question is how do you do this WITHOUT using the pgfplots package.
That will mean you have to take the second file I attached in my original post which doesnt use pgfplots but tikz exclusively, namely (3dimensionalcartesianaxissystem1.tex)
The question now continues using only the packages used in the headers of "3dimensionalcartesianaxissystem1.tex"
In particular, using that file which creates a coordinate system without using pgfplots how do I
1) Replace the numbers on the tickmarks with arbitrary words like ( papaya, DarthVader, Melon, or Yoda ) or whatever.
2) I can then use a label \node at (1,1) {Melon}; as an example, to replace the tickmarks. So basically all I need is how to remove the numbers on the axis but keep everything else asis in "3dimensionalcartesianaxissystem1.tex" as attached in original post.
I used LaTeX graphplotting for years but got stumped lately once I do not use number systems on the axis.
I want to eventually move over to tikz exclusively for all graphics. The manual is amazingly nice and a work of art!
I solved it on my own. Couldnt find it explicitly in the manual, but fiddled around with the code intuitively (which is the wrong way! as you learn nothing.)
The solution is to change the original section of code below;
\foreach \x in {1,...,4}
{
\draw [tickstyle] (0,0,\x)  (0,ticklen,\x) node[below] {$\x$};
\draw [tickstyle] (\x,0,0)  (\x,ticklen,0) node[below] {$\x$};
\draw [tickstyle] (0,\x,0)  (ticklen,\x,0) node[left] {$\x$};
}
to this;
\foreach \x in {1,...,4}
{
\draw [tickstyle] (0,0,\x)  (0,ticklen,\x) node[below] {$$};
\draw [tickstyle] (\x,0,0)  (\x,ticklen,0) node[below] {$$};
\draw [tickstyle] (0,\x,0)  (ticklen,\x,0) node[left] {$$};
}
the $\x$ tells the compiler to omit the numbering but keep the coordinates.
So all is solved unless someone has an example that removes the need to add the names by means of labels and that they are printed from a list in the code as stefan did in the other example.
Thanks to all who looked and helped.
The solution is to change the original section of code below;
\foreach \x in {1,...,4}
{
\draw [tickstyle] (0,0,\x)  (0,ticklen,\x) node[below] {$\x$};
\draw [tickstyle] (\x,0,0)  (\x,ticklen,0) node[below] {$\x$};
\draw [tickstyle] (0,\x,0)  (ticklen,\x,0) node[left] {$\x$};
}
to this;
\foreach \x in {1,...,4}
{
\draw [tickstyle] (0,0,\x)  (0,ticklen,\x) node[below] {$$};
\draw [tickstyle] (\x,0,0)  (\x,ticklen,0) node[below] {$$};
\draw [tickstyle] (0,\x,0)  (ticklen,\x,0) node[left] {$$};
}
the $\x$ tells the compiler to omit the numbering but keep the coordinates.
So all is solved unless someone has an example that removes the need to add the names by means of labels and that they are printed from a list in the code as stefan did in the other example.
Thanks to all who looked and helped.
 Stefan Kottwitz
 Site Admin
 Posts: 9243
 Joined: Mon Mar 10, 2008 9:44 pm
Great to see that it's solved! Feel free to post the complete code of the plot once you polished it. I like good diagrams and plots (such as on http://pgfplots.net/).
Stefan
Stefan
Site admin
Return to “Graphics, Figures & Tables”
Who is online
Users browsing this forum: No registered users and 8 guests