Graphics, Figures & TablesFill Between Again (I know.. I am trying)

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Fill Between Again (I know.. I am trying)

Post by coachbennett1981 »

I got the right area, but the axis is covered. I have tried a soft clip with fill between using the points of intersection (5pi/6 and pi/6), but that does not work. I have used Stefan's reference book and another to look some things up, but I can't get the axis to show. Any help is appreciated.

Code: Select all

Code, edit and compile here:
\documentclass[border=5mm]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{backgrounds,arrows.meta}
\pgfplotsset{
interpret as polar/.style={
x filter/.code=\pgfmathparse{cos(rawx)*rawy},
y filter/.code=\pgfmathparse{sin(rawx)*rawy}
}
}
\begin{document}
\begin{tikzpicture}[>=Triangle]
\begin{axis}[
xtick distance=2,
ytick distance=2,
axis lines=center,
axis equal image,
enlargelimits=true,
]
\addplot[name path=A,
very thick,
domain=0:360,
samples=100,
smooth,
interpret as polar
]
(x,{1+sin(x)});
\addplot[name path=B,
very thick,
domain=0:360,
samples=100,
smooth,
interpret as polar
]
(x,{3*sin(x)});
\path[name path=xaxis] (axis cs: -1,0) -- (axis cs:1,0);
\addplot[blue,opacity=0.5] fill between[of=B and A];
\node[anchor=center,label=north west:\(R\)] at (0,0){};
\addplot[white] fill between[of=A and xaxis];
\end{axis}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Re: Fill Between Again (I know.. I am trying)

Post by Stefan Kottwitz »

Just use the option "axis on top" for the axis environment, so the axis lines are drawn over the plot.

Stefan
LaTeX.org admin
Post Reply