Tikz pgfplots Scatterplot farbig, soll aber nur schwarz

Tabellen und Grafiken erstellen und anordnen


BlackDevil
Forum-Century
Forum-Century
Beiträge: 107
Registriert: Di 23. Jul 2013, 11:38
Wohnort: Deutschland

Tikz pgfplots Scatterplot farbig, soll aber nur schwarz

Beitrag 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 :)

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag 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

BlackDevil
Forum-Century
Forum-Century
Beiträge: 107
Registriert: Di 23. Jul 2013, 11:38
Wohnort: Deutschland

Beitrag 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.

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag 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.

BlackDevil
Forum-Century
Forum-Century
Beiträge: 107
Registriert: Di 23. Jul 2013, 11:38
Wohnort: Deutschland

Beitrag 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

AlexTester

Beitrag 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

Antworten