pgfplots - Kugeln im 3D Diagramm darstellen

Antwort erstellen


Diese Frage dient dazu, das automatisierte Versenden von Formularen durch Spam-Bots zu verhindern.
Smilies
:D :) :( :o :shock: :? 8) :lol: :-x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode ist eingeschaltet
[img] ist eingeschaltet
[flash] ist ausgeschaltet
[url] ist eingeschaltet
Smilies sind eingeschaltet

Die letzten Beiträge des Themas

Ich habe die Datenschutzerklärung gelesen und bin damit einverstanden.

   

Wenn du eine Datei oder mehrere Dateien anhängen möchtest, gib die Details unten ein.

Ansicht erweitern Die letzten Beiträge des Themas: pgfplots - Kugeln im 3D Diagramm darstellen

von Mr.Goonie » Di 7. Jul 2015, 07:28

ich habe die Option table weggelassen, jetzt geht es. Vielen Dank nochmal für Deine Hilfe.

Gruß

von Mr.Goonie » Di 7. Jul 2015, 07:18

kann es sein, dass \pgfplotset nicht kompatibel mit dem Paket \usepackage[table]{xcolor} ist? Gibt es eine Alternative?

von LaRiFaRi » Mo 6. Jul 2015, 15:14

Das müsste dann so aussehen:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}
	\begin{figure}
		\begin{tikzpicture}
		\begin{axis}[%
		,width=\textwidth
		,axis lines=center
		,xlabel={$x$}, ylabel={$y$}, zlabel={$z$}
		,xmin=-20, xmax=20, xtick={-20,20} % setzt die Ticks nur da, wo Du sie möchtest
		,ymin=-20, ymax=20, ytick={-20,20}
		,zmin=-20, zmax=20, ztick={-20,20}
		,view={50}{30} % rotation eines 3D Plots. 
		]	
		\addplot3[mark=ball,only marks,ball color=red,mark size=8] coordinates {(10,5,0)};
		\addplot3[mark=ball,only marks,ball color=green,mark size=4] coordinates {(1,2,4)};
		\addplot3[mark=ball,only marks,ball color=blue,mark size=2] coordinates {(3,-10,-3)};
		\end{axis}
		\end{tikzpicture}
	\end{figure}
\end{document}

von Mr.Goonie » Mo 6. Jul 2015, 14:38

ah: ...yticklabels={,,}

:lol:

von Mr.Goonie » Mo 6. Jul 2015, 14:04

@LaRiFaRi:

danke für Deine Antwort. Ist sogar etwas eleganter als mein Gebastel. Kann man an der Achsenbeschriftung jeweils nur die Grenzen (also 20) anzeigen lassen und wie kann die Ansicht gedreht werden?

Dank und Gruß

von Mr.Goonie » Mo 6. Jul 2015, 13:58

ok, ich denke ich habe es jetzt herausgefunden:
 \documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}



\begin{document}
	\begin{tikzpicture}[scale=.05, x = {(0.8cm,0.5cm)}, y={(0cm,2cm)}, z={(1cm,-0.5cm)}]
	\draw[thick,->] (0,-50,0) -- (0,50,0) node[above] {z};
	\draw[thick,->] (0,0,-100) -- (0,0,100) node[right] {x};
	\draw[thick,->] (-100,0,0) -- (100,0,0) node[right] {y};
	
	
	\path (30,0,0) node[circle, color=red!60, fill, inner sep=3]{};
	\path (15,30,0) node[circle, color=blue!60, fill, inner sep=3]{};
	\path (-12,0,30) node[circle, color=black!60, fill, inner sep=6]{};
	\end{tikzpicture}
\end{document}

Füge drei Plots hinzu

von LaRiFaRi » Mo 6. Jul 2015, 13:57

Du kannst das lösen, indem Du drei Plots einfügst und nicht nur einen. Das sieht dann so aus:
% arara: pdflatex

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12} % wichtig für die Achsenlabels

\begin{document}
	\begin{figure}
		\begin{tikzpicture}
		\begin{axis}[width=\textwidth, axis lines=center,
		xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
		xmin=-20, xmax=20,
		ymin=-20, ymax=20,
		zmin=-20, zmax=20]	
		\addplot3[mark=ball,only marks,ball color=red,mark size=8] coordinates {(10,5,0)}; % plus nicht nötig, geht aber auch. Achte auf die Umrandung der Bälle
		\addplot3[mark=ball,only marks,ball color=green,mark size=4] coordinates {(1,2,4)};
		\addplot3[mark=ball,only marks,ball color=blue,mark size=2] coordinates {(3,-10,-3)};
		\end{axis}
		\end{tikzpicture}
	\end{figure}
\end{document} 

pgfplots - Kugeln im 3D Diagramm darstellen

von Mr.Goonie » Mo 6. Jul 2015, 08:17

Hallo zusammen,

ich würde gerne Kugeln/Balls im 3D Diagramm ausgeben und komme leider nicht weiter.

Folgende Eigenschaften wären wichtig:
1. Größe der Kugeln (radius) unterschiedlich
2. Jeder Kugel eine eigene Farbe zuweisen
\documentclass{article}
\usepackage{pgfplots}


\begin{document}
\begin{figure}
	\begin{tikzpicture}
		\begin{axis}[width=\textwidth, axis lines=center,
		xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
		xmin=-20, xmax=20,
		ymin=-20, ymax=20,
		zmin=-20, zmax=20,]
	
		\addplot3+[mark=ball, only marks,] coordinates {(10,5,0) (1,2,4) (3,-10,-3)};
		
		\end{axis}
	\end{tikzpicture}
\end{figure}
\end{document}
Wäre echt super, wenn ihr mir helfen könntet.

Vielen Dank und Gruß

Nach oben