我在文档中使用 pgfplotssetup 来绘制 3d 图,并使用轴设置来绘制 2d 图。文档中显示了除圆圈(绘制或填充)之外的所有图或绘图,我不明白是什么导致了这个问题,因为我在网上找到的设置都很大。代码如下:
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{xcolor}
\def\axisdefaultwidth{360pt}
\pgfplotsset{
legend pos=outer north east,
legend style={
draw=none,
fill opacity=0.75,
fill=text!6!page,
text opacity=1
},
legend cell align={left},
% -- AXIS
axis lines=middle,
axis on top,
% -- AXIS ARROWS
inner axis line style={draw=none},
clip mode=individual,
every axis/.append style = {thick},tick style = {thick,black},
%
% #1 = x, y, or z
% #2 = the shift value
/tikz/normal shift/.code 2 args = {%
\pgftransformshift{%
\pgfpointscale{#2}{\pgfplotspointouternormalvectorofticklabelaxis{#1}}%
}%
},%
%
range3frame/.style = {
tick align = outside,
scaled ticks = false,
enlargelimits = false,
ticklabel shift = {10pt},
axis lines* = left,
line cap = round,
clip = false,
xtick style = {normal shift={x}{10pt}},
ytick style = {normal shift={y}{10pt}},
ztick style = {normal shift={z}{10pt}},
x axis line style = {normal shift={x}{10pt}},
y axis line style = {normal shift={y}{10pt}},
z axis line style = {normal shift={z}{10pt}},
},
% % -- TICKS
minor x tick num=1,
% xtick pos=left,
% ytick pos=left,
enlarge x limits=false,
every x tick/.style={color=text, thin},
every y tick/.style={color=text, thin},
tick align=outside,
% xtick placement tolerance=-1mm,
% ytick placement tolerance=-1mm,
% -- LABELS
yticklabel style={/pgf/number format/fixed},
every tick label/.append style={font=\fontfamily{\headingsFont}\selectfont},
xlabel near ticks,
ylabel near ticks,
% -- COLOURS / STYLES
cycle multi list={solid,{dotted,mark options={solid}},{dashed,mark options={solid}}\nextlist quaternary,secondary,primary,tertiary},
%
every axis plot/.append style={
very thick,
line cap=round
},
samples=100,
enlargelimits={abs=1pt}, % prevent clipping of plot lines
% inner axis line style={shorten >=0.6pt, shorten <=0.6pt},
% -- ASYMPTOTES
asym gap/.initial=0.02,
v asym/.style={unbounded coords=jump,
/utils/exec={\foreach \aympX [count=\asympcount] in {#1} {
\ifnum\asympcount=1
\xdef\bmc@plotasymfilter{abs(x-\aympX)<\pgfkeysvalueof{/pgfplots/asym gap}}
\else
\xdef\bmc@plotasymfilter{\bmc@plotasymfilter || abs(x-\aympX)<\pgfkeysvalueof{/pgfplots/asym gap}}
\fi}},
y filter/.expression = {\bmc@plotasymfilter ? inf:y},
execute at end plot visualization={
\begin{scope}
\clip (rel axis cs:0,0) rectangle (rel axis cs:1,1);
\foreach \aympX in {#1}
{\draw[current plot style,densely dashed,thin]
({rel axis cs:0,0} -| {axis cs:\aympX,0}) -- ({rel axis cs:0,1} -| {axis cs:\aympX,0});}
\end{scope}
}
},
h asym/.style={unbounded coords=jump,
execute at end plot visualization/.append={
\begin{scope}
\clip (rel axis cs:0,0) rectangle (rel axis cs:1,1);
\draw[current plot style,densely dashed,thin]
({rel axis cs:0,0} |- {axis cs:0,#1}) -- ({rel axis cs:1,0} |- {axis cs:0,#1});
\end{scope}
}
}
}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{tikzpicture}
\begin{axis}[%grid=both, grid style={line width=.1pt, draw=gray!10},
axis equal image, minor tick num=0,
enlargelimits={abs=0.5}, ticklabel style={font=\tiny},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ymin=-2,
ymax=2,
xmin=-2,
xmax=2,
xstep=0.5,ystep=0.5,
xtick={-3,...,1.5},ytick={-3,...,1.5},
axis lines = middle,xlabel=$x$,ylabel=$y$,
axis line style={draw},
]
\fill[color=black!15] (axis cs: 0, 0) circle [radius=2];
\fill[color=blue!25] (axis cs: 1, 1.7) circle [radius=0.5];
\node at (axis cs:0.5,0.5) {\small $E$};
\filldraw[blue] (axis cs:1,1.7) circle (1pt) node[anchor=west]{\small $b\notin E$};
\addplot[blue, domain=-1:1]{3*sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}