两条笛卡尔线和一条极坐标曲线之间的阴影

两条笛卡尔线和一条极坐标曲线之间的阴影

我正在尝试对两条笛卡尔线(下图中的两条蓝线)和一条极坐标曲线(下图中的波浪线)之间的区域进行着色。使用填充命令,我只能对所需区域的一部分进行着色。我想一直着色到原点,而不仅仅是现在被着色的部分。

我当前的图表

这是我当前的代码:

\documentclass[twocolumn, notitlepage, 11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{titling}
\usepackage{pgfplots}

\usepgfplotslibrary{polar}
\usepgfplotslibrary{fillbetween}

\setlength{\droptitle}{-12em} 
\pagenumbering{gobble}

\pgfplotsset{width=12cm,compat=1.9}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        axis lines = left,
        xmin = 0, xmax = 1.25, ymin = 0, ymax = 1.25,
        yticklabels={,,},
        xticklabels={,,}
        ]
        \addplot[color=red, domain=0:1,samples=100,smooth,ultra thick] {tan(20)*x} node[above,pos=1] {$\theta=\alpha$};
        \addplot[name path = squiggle, color=black, data cs = polar, domain=0:90,smooth, ultra thick] {.15*sin(10*x-40) + .75} node[above, pos=0] {$r=f(\theta)$};
        \addplot[name path = a, color=cyan, domain=0:1,samples=100,smooth,ultra thick] {tan(40)*x} node[above,pos=1] {$\theta=\theta_{i-1}$};
        \addplot[name path = b, color=cyan, domain=0:.6,samples=100,smooth,ultra thick] {tan(60)*x} node[above,pos=1] {$\theta=\theta_i$};
        \addplot[color=purple, domain=0:.2,samples=100,smooth,ultra thick] {tan(80)*x} node[above,pos=1] {$\theta=\beta$};
        \addplot [domain=40:60, samples=30, smooth, black, ultra thick, fill=blue!40, data cs = polar] {.15*sin(10*x-40) + .75};
        
    \end{axis}
\end{tikzpicture}
\end{document}

答案1

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        axis lines = left,
        xmin = 0, xmax = 1.25,
        ymin = 0, ymax = 1.25,
        yticklabels=\empty,
        xticklabels=\empty,
        ]
        \fill[blue!40] (0,0) -- plot[domain=40:60] (  {(.15*sin(10*\x-40) + .75)*cos(\x)},  {(.15*sin(10*\x-40) + .75)*sin(\x)}) -- cycle;
        \addplot[red,ultra thick] coordinates {(0,0) (1,tan(20)} node[above] {$\theta=\alpha$};
        \addplot[cyan,ultra thick] coordinates {(0,0) (1,tan(40)} node[above] {$\theta=\theta_{i-1}$};
        \addplot[cyan,ultra thick] coordinates {(0,0) (0.6,0.6*tan(60)} node[above] {$\theta=\theta_i$};
        \addplot[purple,ultra thick] coordinates {(0,0) (0.2,0.2*tan(80)} node[above] {$\theta=\beta$};
        \addplot[data cs = polar, domain=91:-1, samples=100, smooth, ultra thick] {.15*sin(10*x-40) + .75} node[above, xshift=2cm] {$r=f(\theta)$};
    \end{axis}
\end{tikzpicture}
\end{document}

带填充区域的图形

相关内容