Probleme Contour Plot mit Tikz

Tabellen und Grafiken erstellen und anordnen


Peter2001
Forum-Newbie
Forum-Newbie
Beiträge: 1
Registriert: Mi 27. Jul 2022, 14:51

Probleme Contour Plot mit Tikz

Beitrag von Peter2001 »

Hallo zusammen,
ich bin neu hier im Forum und hoffe ihr könnt mir bei einem Problem mit Tikz helfen. Mein Ziel ist ein Kennfeld zu erstellen (Vorlage siehe angehängtes Bild).
Leider habe ich Probleme dabei, dass die Farben richtig dargestellt werden entsprechend ihres z-Wertes. Mein bisheriger Ansatz sieht so aus:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Welcome to Overleaf --- just edit your LaTeX on the left,
% and we'll compile it for you on the right. If you open the
% 'Share' menu, you can invite other users to edit at the same
% time. See www.overleaf.com/learn for more info. Enjoy!
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.18}
%\usepgfplotslibrary{external}
%\tikzexternalize
\begin{document}
\begin{filecontents*}{speedmap.txt}
massflow press_ratio rpm
0.016 1.267 58925
0.021 1.263 58925
0.024 1.256 58925
0.030 1.25  58925
0.032 1.243 58925
0.033 1.236 58925
0.038 1.223 58925
0.042 1.196 58925
0.044 1.17  58925
0.022167588	1.5417721 84010
0.02602282	1.5417721 84010
0.029396148	1.5351266 84010
0.03228757	1.528481 84010
0.0356609	1.528481 84010
0.04144375	1.5218354 84010
0.04481708	1.5151899 84010
0.049636118	1.4952532 84010
0.053973254	1.4753164 84010
0.05590087	1.4553797 84010
0.058792297	1.4287975 84010
0.061201815	1.4088608 84010
0.063611336	1.388924 84010
0.06650276	1.3689873 84010
0.06987609	1.3224684 84010
0.026986629	1.7411393 97987
0.031805668	1.7411393 97987
0.0356609	1.7411393 97987
0.038552325	1.7411393 97987
0.042407557	1.7411393 97987 
0.048190407	1.7344936 97987
0.050599925	1.7212025 97987
0.054455157	1.7145569 97987
0.0592742	1.6879747 97987
0.063611336	1.668038 97987
0.066020854	1.6481012 97987
0.067948475	1.6281645 97987
0.0713218	1.5949367 97987
0.073731326	1.5617088 97987
0.07662275	1.5351266 97987
0.07951417	1.4952532 97987
0.0828875	1.4420886 97987
0.031805668	1.9737341 111934
0.03807042	1.9737341 111934
0.04288946	1.9803797 111934
0.047226597	1.9870253 111934
0.05204564	1.9870253 111934
0.05782849	1.9803797 111934
0.06071991	1.9803797 111934
0.06457514	1.9737341 111934
0.0708399	1.9471519 111934
0.07565894	1.9006329 111934
0.07806846	1.8740506 111934
0.07999607	1.8541139 111934
0.0828875	1.8075949 111934
0.08529702	1.7677215 111934
0.08818845	1.727848 111934
0.090597965	1.6746836 111934
0.09397129	1.6015823 111934
0.0356609	2.2661393 127000
0.039516132	2.2661393 127000
0.0477085	2.2661393 127000
0.054455157	2.2860758 127000
0.059756104	2.2927215 127000
0.06553895	2.2993672 127000
0.0713218	2.2993672 127000
0.07614084	2.2993672 127000
0.083369404	2.2794304 127000
0.08867035	2.206329 127000
0.09156177	2.15981 127000
0.09445319	2.113291 127000
0.09734462	2.0468354 127000
0.09879033	2.006962 127000
0.10119985	1.9272152 127000
0.103609376	1.8275317 127000
0.039516132	2.5186708 140000
0.0477085	2.5386076 140000
0.058310393	2.5585444 140000
0.06650276	2.5718355 140000
0.07228561	2.591772 140000
0.07951417	2.625 140000
0.090597965	2.591772 140000
0.09879033	2.472152 140000
0.10216366	2.4056962 140000
0.10409128	2.3392406 140000
0.10601889	2.226266 140000
0.10842841	2.0933545 140000
0.04144375	2.6050632 144000
0.050599925	2.625 144000
0.06168372	2.6449368 144000
0.0713218	2.6648734 144000
0.07806846	2.7047467 144000
0.08529702	2.7313292 144000
0.092043675	2.6914556 144000
0.09830843	2.6050632 144000
0.10216366	2.5386076 144000
0.10457318	2.4588609 144000
0.1069827	2.3325949 144000
0.10939222	2.1398735 144000
\end{filecontents*}

\begin{tikzpicture}
\begin{axis}[
height=9cm,
width=15cm,
view={0}{90},
mesh/ordering=x varies,
mesh/cols=2,
mesh/rows=49,
%xtick={1,1.5,2,2.5,3,3.5,4},
colorbar,
ymin=1,
ymax=3.0,
point meta min=0.1, 
point meta max=150e3,
xmin = 0,
xmax = 0.12,
colorbar sampled,
colorbar style={ylabel=$z$},
xlabel=$x$,
ylabel=$y$,
shader=interp
]
%\addplot3[surf] table[x=x, y=y, z=z] {mydata.dat};
%\addplot3[contour gnuplot={number = 20,labels={false}}] table[x=massflow,y=press_ratio,z=rpm] {speedmap.txt};
\addplot3[contour filled={number = 20,labels={false}},only marks] table[x=massflow,y=press_ratio,z=rpm] {speedmap.txt};
\end{axis}
\end{tikzpicture}
\end{document}
Mein Ziel ist, dass alle Werte mit dem selbem "rpm"-Wert farbilch gleich dargestellt werden entsprechend ihrer Farbe in der Colorbar. Außerdem habe ich Probleme damit, was genau mesh/cols bzw. mesh/rows für Werte haben sollten.

Vielen Dank im voraus :)
Dateianhänge
Speedmap.PNG