von Stefan Kottwitz » Mo 3. Jun 2024, 12:02
Das geht mit
restrict y to domain = 0:4.8. Dazu
ymax etwas größer setzen, damit das Koordinatensystem selber nicht kleiner wird. Zeilen 168-169.
\documentclass[
11pt, % Schriftgröße
paper=a4,
DIV=13, % Seitenlayout (Satzspiegel)
parskip=half, % Abstand zwischen Absätzen
%twoside, % Doppelseitig
%openright, % neues Kapitel rechts
% cleardoublepage,
bibtotoc, % Literaturverzeichis in Inhaltsverzeichnis
headsepline, % Kopfzeilentrennlinie
headings,
% draft, % Korrekturfassung
]{scrreprt} % scrartcl
% Eingabecodierung
\usepackage[utf8]{inputenc}
% Schriftcodierung
\usepackage[T1]{fontenc}
% Sprachraum
\usepackage[ngerman]{babel}
% Blindtext
\usepackage{blindtext}
% Schrifteinstellungen
\usepackage{lmodern} % Vektorschrift
\renewcommand{\familydefault}{\sfdefault} % Serifenlose Schrift
%\usepackage{sansmath} % Mathe-Schrift ohne Serifen
%\sansmath % aktiviert serifenlose Matheschrift
\usepackage{microtype} % harmonische Typenverteilung
%\usepackage{hyperref}
% Literatur einbinden
\usepackage{csquotes} % Steuerung der Anführungszeichen
\usepackage[
backend=biber, % Sortier-Compiler
style=numeric-comp, % Zitationsstil
block=ragged,
]{biblatex}
\addbibresource{ref/Bibliothek.bib}
\usepackage{booktabs}
% Mathemodus
\usepackage{amsmath,amssymb}
% Trennung
\hyphenation{Crash-zo-ne}
\usepackage{pgfkeys}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{startstop} = [rectangle, rounded corners,
minimum width=3cm,
minimum height=1cm,
text centered,
draw=black,
fill=red!30]
\tikzstyle{io} = [trapezium,
trapezium stretches=true, % A later addition
trapezium left angle=70,
trapezium right angle=110,
minimum width=3cm,
minimum height=1cm, text centered,
draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle,
minimum width=3cm,
minimum height=1cm,
text centered,
text width=3cm,
draw=black,
fill=orange!30]
\tikzstyle{decision} = [diamond,
minimum width=3cm,
minimum height=1cm,
text centered,
draw=black,
fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\usepackage{pgfplots}\pgfplotsset{compat=newest}
\usetikzlibrary{arrows.meta,positioning,calc}
%für lange Tabelle
\usepackage{longtable}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[export]{adjustbox}
% für tikz
\pgfplotsset{select coords between index/.style 2 args={
x filter/.code={
\ifnum\coordindex<#1\def\pgfmathresult{}\fi
\ifnum\coordindex>#2\def\pgfmathresult{}\fi
}
}}
\usepackage{subcaption}
\usepackage{pdfpages}
\usepackage{acronym}%abkürzung
\usetikzlibrary{arrows, decorations.markings}
\makeatletter
\tikzset{
nomorepostaction/.code=\makeatletter\let\tikz@postactions\pgfutil@empty,
my axis/.style={
postaction={
decoration={
markings,
mark=at position 1 with {
\arrow[ultra thick]{latex}
}
},
decorate,
nomorepostaction
},
thin,
-, % switch off other arrow tips
every path/.append style=my axis % this is necessary
%so it works both with "axis lines=left" and "axis lines=center"
}
}
\begin{document}
\begin{figure}[ht] % links nicht bis 5 hoch
\begin{tikzpicture}[baseline]
\pgfplotstableread{
x y
1 5
5 4.7
10 4.4
15 4.1
20 3.8
25 3.72
30 3.7
35 3.7
40 3.7
45 3.7
50 3.7
55 3.72
60 3.75
70 3.98
75 4.13
80 4.33
85 4.53
90 4.73
}\mytable
\begin{axis}[
xtick=\empty,ytick=\empty,
axis lines=left,
xlabel={x},
ylabel={y},
axis line style={my axis},
xmin=0,
xmax=100,
ymin=3.6,
width=\linewidth, %Bildbreite
height=7cm, %Bildhöhe
restrict y to domain = 0:4.8,
ymax=5,
]
\draw[<->] (axis cs:1,4.7) -- node[above] {Bereich 1} (axis cs:23,4.7);
\draw[<->] (axis cs:25,4.7) -- node[above] {Bereich 2} (axis cs:58,4.7);
\draw[<->] (axis cs:60,4.7) -- node[above] {Bereich 3} (axis cs:85,4.7);
\draw[dashed] (axis cs:24,1)--(axis cs:24,5);
\draw[dashed] (axis cs:59,1)--(axis cs:59,5);
\addplot +[
smooth,
no marks,
line join=round,line width=1.5pt,
]
table [x=x,y=y] {\mytable};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
Stefan
Das geht mit [tt]restrict y to domain = 0:4.8[/tt]. Dazu [tt]ymax[/tt] etwas größer setzen, damit das Koordinatensystem selber nicht kleiner wird. Zeilen 168-169.
[code]\documentclass[
11pt, % Schriftgröße
paper=a4,
DIV=13, % Seitenlayout (Satzspiegel)
parskip=half, % Abstand zwischen Absätzen
%twoside, % Doppelseitig
%openright, % neues Kapitel rechts
% cleardoublepage,
bibtotoc, % Literaturverzeichis in Inhaltsverzeichnis
headsepline, % Kopfzeilentrennlinie
headings,
% draft, % Korrekturfassung
]{scrreprt} % scrartcl
% Eingabecodierung
\usepackage[utf8]{inputenc}
% Schriftcodierung
\usepackage[T1]{fontenc}
% Sprachraum
\usepackage[ngerman]{babel}
% Blindtext
\usepackage{blindtext}
% Schrifteinstellungen
\usepackage{lmodern} % Vektorschrift
\renewcommand{\familydefault}{\sfdefault} % Serifenlose Schrift
%\usepackage{sansmath} % Mathe-Schrift ohne Serifen
%\sansmath % aktiviert serifenlose Matheschrift
\usepackage{microtype} % harmonische Typenverteilung
%\usepackage{hyperref}
% Literatur einbinden
\usepackage{csquotes} % Steuerung der Anführungszeichen
\usepackage[
backend=biber, % Sortier-Compiler
style=numeric-comp, % Zitationsstil
block=ragged,
]{biblatex}
\addbibresource{ref/Bibliothek.bib}
\usepackage{booktabs}
% Mathemodus
\usepackage{amsmath,amssymb}
% Trennung
\hyphenation{Crash-zo-ne}
\usepackage{pgfkeys}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{startstop} = [rectangle, rounded corners,
minimum width=3cm,
minimum height=1cm,
text centered,
draw=black,
fill=red!30]
\tikzstyle{io} = [trapezium,
trapezium stretches=true, % A later addition
trapezium left angle=70,
trapezium right angle=110,
minimum width=3cm,
minimum height=1cm, text centered,
draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle,
minimum width=3cm,
minimum height=1cm,
text centered,
text width=3cm,
draw=black,
fill=orange!30]
\tikzstyle{decision} = [diamond,
minimum width=3cm,
minimum height=1cm,
text centered,
draw=black,
fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\usepackage{pgfplots}\pgfplotsset{compat=newest}
\usetikzlibrary{arrows.meta,positioning,calc}
%für lange Tabelle
\usepackage{longtable}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[export]{adjustbox}
% für tikz
\pgfplotsset{select coords between index/.style 2 args={
x filter/.code={
\ifnum\coordindex<#1\def\pgfmathresult{}\fi
\ifnum\coordindex>#2\def\pgfmathresult{}\fi
}
}}
\usepackage{subcaption}
\usepackage{pdfpages}
\usepackage{acronym}%abkürzung
\usetikzlibrary{arrows, decorations.markings}
\makeatletter
\tikzset{
nomorepostaction/.code=\makeatletter\let\tikz@postactions\pgfutil@empty,
my axis/.style={
postaction={
decoration={
markings,
mark=at position 1 with {
\arrow[ultra thick]{latex}
}
},
decorate,
nomorepostaction
},
thin,
-, % switch off other arrow tips
every path/.append style=my axis % this is necessary
%so it works both with "axis lines=left" and "axis lines=center"
}
}
\begin{document}
\begin{figure}[ht] % links nicht bis 5 hoch
\begin{tikzpicture}[baseline]
\pgfplotstableread{
x y
1 5
5 4.7
10 4.4
15 4.1
20 3.8
25 3.72
30 3.7
35 3.7
40 3.7
45 3.7
50 3.7
55 3.72
60 3.75
70 3.98
75 4.13
80 4.33
85 4.53
90 4.73
}\mytable
\begin{axis}[
xtick=\empty,ytick=\empty,
axis lines=left,
xlabel={x},
ylabel={y},
axis line style={my axis},
xmin=0,
xmax=100,
ymin=3.6,
width=\linewidth, %Bildbreite
height=7cm, %Bildhöhe
restrict y to domain = 0:4.8,
ymax=5,
]
\draw[<->] (axis cs:1,4.7) -- node[above] {Bereich 1} (axis cs:23,4.7);
\draw[<->] (axis cs:25,4.7) -- node[above] {Bereich 2} (axis cs:58,4.7);
\draw[<->] (axis cs:60,4.7) -- node[above] {Bereich 3} (axis cs:85,4.7);
\draw[dashed] (axis cs:24,1)--(axis cs:24,5);
\draw[dashed] (axis cs:59,1)--(axis cs:59,5);
\addplot +[
smooth,
no marks,
line join=round,line width=1.5pt,
]
table [x=x,y=y] {\mytable};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}[/code]
Stefan