Seite 1 von 1

Tikz pgfplots Scatterplot farbig, soll aber nur schwarz

Verfasst: Di 5. Nov 2013, 12:10
von BlackDevil
Ahoi

Noch eine Frage. Ich versuche mit PGF Plots einfache Sachen zu plotten. Klappt an und für sich auch. Allerdings ist der Ausdruck farbig, ich hätte ihn aber gerne einfach nur Schwarz. Farbig bedeutet das die Punkte alle andere Farben haben.

Vielleicht hat jemand eine Idee?
\documentclass[listof=totocnumbered,
				bibliography=totoc,
				twoside,12pt,
				headsepline,
				footsepline,
				cleardoublepage=current,
				chapterprefix,headings=normal]{scrbook}
% Tikz 
\usepackage{pgf}
\usepackage{tikz}
% pgfplots
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usetikzlibrary{pgfplots.patchplots}
\usetikzlibrary{pgfplots.dateplot}
\usetikzlibrary{pgfplots.colormaps}
\usetikzlibrary{pgfplots.groupplots}
\usetikzlibrary{pgfplots.polar}
\usetikzlibrary{pgfplots.units}
\usepgflibrary{plotmarks}

\begin{document}
		\begin{tikzpicture}
			\begin{axis}[
			xlabel=Output $\lbrack TPD \rbrack$,
			ylabel=Efficiency $\lbrack \% \rbrack$,
			xmin=0,
			ymin=94]
				\addplot[black,only marks,scatter] table {./chapter/ch4/rawdata.data};
			\end{axis}
		\end{tikzpicture}
\end{document}
Daten:
Output	Efficiency
4.1391	98.2273
2.8161	96.7087
3.4206	94.4587
7.3207  100.9902
1.0889	98.6273
1.9256	95.6042
3.7164	94.6458
6.8843	95.6869
2.4929  100.3180
7.5466	95.5214
7.7886	97.3567
3.6268  100.3646
7.8940	95.3565
1.8546	97.1359
6.3267	98.3246
5.0555	98.1595
5.3481	98.6611
4.4293	95.8738
2.5432	96.9671
2.0089	99.5953

Vielleicht hat jemand eine Idee :)

Verfasst: Di 5. Nov 2013, 12:47
von esdd
Mir ist jetzt nicht klar, ob die Punkte unterschiedliche Grautöne haben sollen
\documentclass[margin=5mm]{standalone} 

\usepackage{pgfplots}
\pgfplotsset{compat=1.9} 

\begin{document} 
\begin{tikzpicture} 
  \begin{axis}[
      xlabel=Output $\lbrack TPD \rbrack$, 
      ylabel=Efficiency $\lbrack \% \rbrack$, 
      xmin=0,ymin=94,
    ]
    \addplot[only marks,colormap={bw}{gray(0cm)=(0); gray(1cm)=(1)},scatter] table {daten.data}; 
  \end{axis} 
\end{tikzpicture} 
\end{document}
oder alle gleich schwarz sein sollen
\addplot[only marks] table {daten.data};
Weitere Infos und Beispiele zu scatter plots und colormap findest du in der Dokumentation von pgfplots.

Gruß
Elke

Verfasst: Di 5. Nov 2013, 12:49
von BlackDevil
Sie sollten einfach nur schwarz sein, danke. Irgendwie ging das nicht aus der Doku hervor, bzw. ich habe es wohl überlesen das die Option "scatter" alles bunt macht (zumal in der Doku in der Sektion Scatterplot alles blau ist) :?

Dankeschön.

Verfasst: Di 5. Nov 2013, 13:48
von esdd
Dann hast du nur den Anfang mit den Erläuterungen zur Option only marks gelesen, nicht aber die Informationen zur Option scatter selbst. Dort sind die Beispiele alle bunt.

Verfasst: Di 5. Nov 2013, 14:27
von BlackDevil
pgfplots.pdf, S.30 hat geschrieben:We added two options to our example: the option scatter to the option list for \addplot and the option
meta=f(x) right after table. The option scatter has a slightly misleading name as we already had a scatter
plot before we added that option. It activates scatter plots with individual appearance: without further
options, it chooses individual colors for every marker.
Ich gebe zu, ich habe mich mehr an den Überschriften und dem Beispielcode orientiert ohne zu lesen. Ich wollte halt schnell das Kapitel hochziehen, und das ist das Ergebnis.

Danke. Eine Frage poste ich heute dennoch, da habe ihc zwar viel gelesen aber keine Lösung gefunden :roll:

Grüße

Verfasst: Di 22. Mär 2016, 08:50
von AlexTester
Nur falls das jemand noch einmal sucht:

Um die Knoten / Datenpunkte alle schwarz zu färben, muss lediglich die scatter-Option in

\addplot[....,scatter] entfernt werden.

Das wars