Thermometer Grafik anpassen

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: Thermometer Grafik anpassen

von esdd » Sa 30. Mär 2019, 18:17

@Bartman: Danke! Oben habe ich das jetzt korrigiert, d.h. ein Plus in ein Minus geändert.

von Bartman » Sa 30. Mär 2019, 18:10

@esdd

Die Beschriftungen für den warmen und kalten Bereich sind in Deinem Beispiel vertauscht.

von esdd » Sa 30. Mär 2019, 17:57

Dass die Beschriftungen an den Strichen der Skala kleben, ist kein Wunder. Schließlich setzt Du für das gesamte tikzpicture sowohl inner sep als auch outer sep gleich Null. Entferne beide Einstellungen. Wenn das nicht genügt, kannst Du auch für inner sep einen größeren Wert als das voreingestellte 0.3333em wählen.

Ansonsten ist hier noch ein Alternativvorschlag für das Bild mit Füllung, der u.a. auf Antworten zu Fill of a thermometer beruht:
\documentclass[dvipsnames]{standalone} 
\usepackage{tikz} 
\tikzset{ 
  thermometer/.style={insert path={ 
    (280.0313,169.3125) .. controls (263.9888,169.3125) and (250.6461,179.3446) .. 
    (247.8125,192.5625) -- 
    (247.3438,563.7500) .. controls (235.7346,573.2243) and (228.3438,587.6282) .. 
    (228.3438,603.7813) .. controls (228.3438,632.3161) and (251.4651,655.4688) .. 
    (280.0000,655.4688) .. controls (308.5349,655.4688) and (331.6563,632.3161) .. 
    (331.6563,603.7813) .. controls (331.6563,587.6282) and (324.2654,573.2243) .. 
    (312.6563,563.7500) -- 
    (312.2500,192.5625) .. controls 
    (309.4164,179.3446) and (296.0737,169.3125) .. (280.0313,169.3125) -- cycle 
}}} 

\begin{document} 
\begin{tikzpicture}[y=0.5pt, x=0.5pt,yscale=-1,inner xsep=.5em] 

\foreach 
  [ 
    count=\i from -4, 
    evaluate=\x as \y using (560+190)/2-\i*(560-190)/8 
  ] 
  \text in {sehr kalt, kalt, kühl, leicht kühl, neutral, leicht warm, warm, heiß, sehr heiß} 
  { 
    \draw (210,\y)--(190,\y) node[left](\i-links){\i}; 
    \draw (350,\y)--(370,\y) node[right](\i-rechts){\text}; 
  } 

\path[draw=black,line width=2.5pt] 
  [thermometer] 
  [path picture={ 
    \fill [blue] (path picture bounding box.south west) rectangle (-4-rechts); 
    \fill [red] (4-links) rectangle (path picture bounding box.north east); 
    \clip (-4-links) rectangle (4-rechts); 
    \fill [top color=red,bottom color=blue,middle color=yellow] (-4-links) rectangle (4-rechts); 
  }] 
; 

\path[text=OrangeRed] 
  (0-links|-{0,140}) node {Index} 
  (0-rechts|-{0,140}) node {Thermisches Empfinden} 
; 

\end{tikzpicture} 
\end{document}
Ergebnis:

Bild
Dateianhänge
gl_thermometer.png
gl_thermometer.png (16.09 KiB) 2561 mal betrachtet

von Moritz_F » Sa 30. Mär 2019, 17:55

Ach klasse!

Genau so - sehr sehr cool gemacht!

von Bartman » Sa 30. Mär 2019, 15:52

Als Vorlage für das Beispiel diente vermutlich die Antwort des Nutzers quinmars.
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}

\begin{document}
% Abstand vergrößert durch das Entfernen von inner sep und outer sep
\begin{tikzpicture}[y=0.5pt, x=0.5pt,yscale=-1]
\newcommand{\thermopath}{
  (280.0313,169.3125) .. controls (263.9888,169.3125) and (250.6461,179.3446) ..
  (247.8125,192.5625) --
  (247.3438,563.7500) .. controls (235.7346,573.2243) and (228.3438,587.6282) ..
  (228.3438,603.7813) .. controls (228.3438,632.3161) and (251.4651,655.4688) ..
  (280.0000,655.4688) .. controls (308.5349,655.4688) and (331.6563,632.3161) ..
  (331.6563,603.7813) .. controls (331.6563,587.6282) and (324.2654,573.2243) ..
  (312.6563,563.7500) --
  (312.2500,192.5625) .. controls
  (309.4164,179.3446) and (296.0737,169.3125) .. (280.0313,169.3125) -- cycle
 }
\path[miter limit=4,even odd rule,fill=gray!20]
    \thermopath;

%\newcommand{\tempincelsius}{55}
\begin{scope}
    \clip \thermopath;
    \fill[blue!90!yellow] (210,559) rectangle (350, 660);
    \fill[red!90!yellow] (210,165) rectangle (350, 191);
    \draw[draw=none, top color=red, bottom color=blue, middle color=yellow] (210,190) rectangle (350, 560);
\end{scope}

\path[draw=black,miter limit=4,even odd rule,line width=2.5pt]
    \thermopath;

\foreach \y/\x in {190/4,
                   236.25/3,
                   282.5/2,
                   328.75/1,
                   375/0,
                   421/-1,
                   467.5/-2,
                   513.75/-3,
                   560/-4%
                   }
    {
    \draw (210,\y)--(190,\y) node[left](\x){$\x$};% Anpassung für die negativen Vorzeichen
    }
\foreach \u/\v in {190/sehr heiss,
                   236.25/heiss,
                   282.5/warm,
                   328.75/leicht warm,
                   375/neutral,
                   421/leicht kühl,
                   467.5/kühl,
                   513.75/kalt,
                   560/sehr kalt%
                   }
    {
    \draw (350,\u)--(370,\u) node[right](\v){\v};
    }

% Zusammenfassung der Optionen
\begin{scope}[xshift=-5em, OrangeRed]
\node at (260,140) {Index};
\node at (500,140) {Thermisches Empfinden};
\end{scope}
\end{tikzpicture}
\end{document}
Nachtrag: Aufgrund der Bemerkung von esdd habe ich den erwähnten Abstand im Beispiel angepasst.

Thermometer Grafik anpassen

von Moritz_F » Sa 30. Mär 2019, 12:30

Hallo,

ich habe mir ein Thermometer zurechtgebastelt:
\documentclass{standalone}
%\usepackage[showframe]{geometry}
\usepackage{fourier}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[y=0.5pt, x=0.5pt,yscale=-1, inner sep=0pt, outer sep=0pt]
\def\thermopath{
  (280.0313,169.3125) .. controls (263.9888,169.3125) and (250.6461,179.3446) ..
  (247.8125,192.5625) -- 
  (247.3438,563.7500) .. controls (235.7346,573.2243) and (228.3438,587.6282) ..
  (228.3438,603.7813) .. controls (228.3438,632.3161) and (251.4651,655.4688) ..
  (280.0000,655.4688) .. controls (308.5349,655.4688) and (331.6563,632.3161) ..
  (331.6563,603.7813) .. controls (331.6563,587.6282) and (324.2654,573.2243) ..
  (312.6563,563.7500) -- 
  (312.2500,192.5625) .. controls 
  (309.4164,179.3446) and (296.0737,169.3125) .. (280.0313,169.3125) -- cycle
 }
\path[miter limit=4,even odd rule,fill=gray!20]
    \thermopath;

\def\tempincelsius{55}
\begin{scope}
    \clip \thermopath;
    \fill[red] (210,{560- 3.7*\tempincelsius}) -- ++(140,0)
        -- (350, 690) -- (210, 690) -- cycle;
\end{scope}

\path[draw=black,miter limit=4,even odd rule,line width=2.5pt]
    \thermopath;
    
    

\foreach \y/\x in {190/4,
                   236.25/3,
                   282.5/2,
                   328.75/1,
                   375/0,
                   421/-1,
                   467.5/-2,
                   513.75/-3,
                   560/-4%
                   }
    {
    \draw (210,\y)--(190,\y) node[left](\x){\x};
    }
\foreach \u/\v in {190/sehr heiss,
                   236.25/heiss,
                   282.5/warm,
                   328.75/leicht warm,
                   375/neutral,
                   421/leicht kühl,
                   467.5/kühl,
                   513.75/kalt,
                   560/sehr kalt%
                   }
    {
    \draw (350,\u)--(370,\u) node[right](\v){\v};
    }


\draw node[xshift=-5em, OrangeRed] at (260,140) {Index};
\draw node[xshift=-5em, OrangeRed] at (500,140) {Thermisches Empfinden};
    

\end{tikzpicture}
\end{document}
Was mir jetzt noch fehlt:

Abstand der Wörter (kühl,...) von der Achse. Habe das mit Tilde probiert, es funktioniert, aber es kommt eine Fehlermeldung.

Zusätzlich würde ich gerne das ganze Thermometer füllen und unten mit blau beginnen lassen, dann gelb (neutral) und oben rot haben.


Ist so etwas möglich?

Danke für Euer Feedback :-)

Nach oben