Graphics, Figures & Tablesdots and tikz-3dplot

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Roel
Posts: 4
Joined: Thu Apr 02, 2020 2:50 pm

dots and tikz-3dplot

Post by Roel »

Hello

I'm using tikz-3dplot to draw a 3d coordinate system and would like to draw dots (small spheres).
With the 2d method I normally use (\draw (0,0) circle (2pt) ), the output is a circle in the xy-plane (an ellipse). Not what I want.

Anyone any idea how to solve that?

Code: Select all

\documentclass{standalone}
\usepackage{pgf,tikz}
\usepackage{tikz-3dplot}

\begin{document}
\tdplotsetmaincoords{70}{110} 
\begin{tikzpicture}[scale=.7, tdplot_main_coords] 
% grid and axes
\foreach \i in {1, 2, 3, 4, 5, 6}{
	\draw[gray] (\i,6,0)--(\i,0,0)--(\i,0,6) 
						(6,\i,0)--(0,\i,0)--(0,\i,6)
						(6,0,\i)--(0,0,\i)--(0,6,\i);}
\draw[thick,->] (0,0,0) -- (6,0,0) node[anchor=north east]{$x$}; 
\draw[thick,->] (0,0,0) -- (0,6,0) node[anchor=north west]{$y$}; 
\draw[thick,->] (0,0,0) -- (0,0,6) node[anchor=south]{$z$};

\coordinate (A) at (3,3,0);	\coordinate (B) at (2,0,2);
\coordinate (C) at (2,0,4); \coordinate (D) at (0,4,3);

\foreach \n in {A, B, C, D}
	\fill[red] (\n) circle(0.15);
\end{tikzpicture}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

dots and tikz-3dplot

Post by Bartman »

tikz loads pgf.

Change your command in the loop to

\fill [tdplot_screen_coords, ball color=red] (\n) circle (0.15);
or draw nodes instead.
Roel
Posts: 4
Joined: Thu Apr 02, 2020 2:50 pm

dots and tikz-3dplot

Post by Roel »

Thanks a lot, Bartman.
You really helped me!
Post Reply