von Sammy93 » So 24. Jan 2021, 21:01
Hallo zusammen,
nachdem ich jetzt nach langer Recherche und Ausprobieren nicht weiterkomme, hoffe ich, dass mir hier jemand helfen kann.
Ich möchte die Fläche zw. den 4 roten Schnittpunkten markieren. Ich habe auch einen Ansatz, aber komme nun nicht mehr weiter, da am Ende immer die falschen Flächen markiert sind.
Mein Minimalbeispiel:
\documentclass[preview]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[font=\small]
\begin{axis}[
width=5cm,height=5cm,
axis lines=middle,
domain=-3:3,
smooth,
xmin=-3,xmax=3,
tick style=black,
xtick={\empty},
xlabel=$x$,
xlabel style={below, anchor=north east,inner xsep=0pt},
restrict y to domain=0:3,
ymin=0,ymax=3,
ytick={\empty},ylabel=$y$,
ylabel style={above,anchor=north east,inner ysep=0pt},
samples=100,
]
\draw [name path =x](axis cs: 0, 0) circle [radius=200];
\addplot[line width=1pt, smooth, name path = y ]{-x+1};
\addplot[line width=1pt, smooth, name path =z]{2*x^2};
\addplot [red, no markers, name path =Y] coordinates {(0,1) (0,2)}; % rotmarkierter Teil der y-Achse
%Schnittpunkte berechnen
\fill [red, name intersections={of=x and z}]
(intersection-1) circle (1pt);
\fill [red, name intersections={of=y and z}]
(intersection-2) circle (1pt);
\fill [red, name intersections={of=x and Y}]
(intersection-1) circle (1pt);
\fill [red, name intersections={of=y and Y}]
(intersection-1) circle (1pt);
}];
% Ab hier wollte ich eigentlich mit folgendem Code arbeiten, aber da habe ich wohl einen Fehler.
\path [draw,green, fill,
name path=xz,
intersection segments={
of=x and z}}];
\end{axis}
\end{tikzpicture}
\end{document}
Hallo zusammen,
nachdem ich jetzt nach langer Recherche und Ausprobieren nicht weiterkomme, hoffe ich, dass mir hier jemand helfen kann.
Ich möchte die Fläche zw. den 4 roten Schnittpunkten markieren. Ich habe auch einen Ansatz, aber komme nun nicht mehr weiter, da am Ende immer die falschen Flächen markiert sind.
Mein Minimalbeispiel:
[code]\documentclass[preview]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[font=\small]
\begin{axis}[
width=5cm,height=5cm,
axis lines=middle,
domain=-3:3,
smooth,
xmin=-3,xmax=3,
tick style=black,
xtick={\empty},
xlabel=$x$,
xlabel style={below, anchor=north east,inner xsep=0pt},
restrict y to domain=0:3,
ymin=0,ymax=3,
ytick={\empty},ylabel=$y$,
ylabel style={above,anchor=north east,inner ysep=0pt},
samples=100,
]
\draw [name path =x](axis cs: 0, 0) circle [radius=200];
\addplot[line width=1pt, smooth, name path = y ]{-x+1};
\addplot[line width=1pt, smooth, name path =z]{2*x^2};
\addplot [red, no markers, name path =Y] coordinates {(0,1) (0,2)}; % rotmarkierter Teil der y-Achse
%Schnittpunkte berechnen
\fill [red, name intersections={of=x and z}]
(intersection-1) circle (1pt);
\fill [red, name intersections={of=y and z}]
(intersection-2) circle (1pt);
\fill [red, name intersections={of=x and Y}]
(intersection-1) circle (1pt);
\fill [red, name intersections={of=y and Y}]
(intersection-1) circle (1pt);
}];
% Ab hier wollte ich eigentlich mit folgendem Code arbeiten, aber da habe ich wohl einen Fehler.
\path [draw,green, fill,
name path=xz,
intersection segments={
of=x and z}}];
\end{axis}
\end{tikzpicture}
\end{document}[/code]