我正在尝试绘制平面的某个区域,但我找不到方法。
它看起来应该是这样的:
此外,如果有办法改变该区域的绘画,使其像所画的那样,那就完美了,这里是代码:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{mathtools}
\usepackage[siunitx, american]{circuitikz}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{paracol}
\usepackage{siunitx}
\usetikzlibrary{shapes,arrows}
\usepackage{titling}
\usepackage{changepage}
\usepackage{float}
\usepackage{geometry}
\usepackage{xfrac}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{pst-plot}
\usetikzlibrary{shapes,arrows}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\begin{document}
\begin{figure}[H] \centering
\begin{tikzpicture}
\begin{axis} [xmin = -0.7, xmax = 1.7, ymin = -1.5, ymax = 1.5, xlabel =$\phi_1$, ylabel =$\phi_2$, axis lines = middle,width = 8cm, height=7cm , title = Constelación de Señales, ytick distance = 3, xtick distance = 5]
\node[label={180:{(0,$\sqrt{T}$)}},circle,fill,inner sep=2pt] at (axis cs:0,1) {};
\node[label={},circle,fill,inner sep=2pt] at (axis cs:1,0) {};
\node [above = 1mm] at (axis cs:1,0) {($\sqrt{T}$,0)};
\node[label={180:{(0,$-\sqrt{T}$)}},circle,fill,inner sep=2pt] at (axis cs:0,-1) {};
\addplot +[const plot, no marks, black]
coordinates{(0,0) (-0.7,0)};
\addplot[name path=b, domain=0:1.7] {x} \closedcycle node at (current path bounding box.center) {};
\addplot[name path=a, domain=0:1.7] {-x} \closedcycle node at (current path bounding box.center) {};
\addplot[gray!30] fill between[of=b and a];
\path[name path=axisl] (axis cs:-1,0) -- (axis cs:0,0);
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
答案1
只需添加一些图案。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns.meta}
\begin{document}
\begin{figure} \centering
\begin{tikzpicture}
\begin{axis} [xmin = -0.7, xmax = 1.7, ymin = -1.5, ymax = 1.5, xlabel
=$\phi_1$, ylabel =$\phi_2$, axis lines = middle,width = 8cm, height=7cm , title
= Constelaci\'on de Se\~nales, ytick distance = 3, xtick distance = 5]
\path[pattern={Lines[angle=45,distance={3pt/sqrt(2)}]},pattern color=blue]
(\pgfkeysvalueof{/pgfplots/xmin},0) -- (0,0) --
(\pgfkeysvalueof{/pgfplots/xmax},\pgfkeysvalueof{/pgfplots/xmax}) -| cycle;
\path[pattern={Lines[angle=-45,distance={3pt/sqrt(2)}]},pattern color=blue]
(\pgfkeysvalueof{/pgfplots/xmin},0) -- (0,0) --
(\pgfkeysvalueof{/pgfplots/xmax},-\pgfkeysvalueof{/pgfplots/xmax}) -| cycle;
\node[label={180:{(0,$\sqrt{T}$)}},circle,fill,inner sep=2pt] at (axis cs:0,1) {};
\node[label={},circle,fill,inner sep=2pt] at (axis cs:1,0) {};
\node [above = 1mm] at (axis cs:1,0) {($\sqrt{T}$,0)};
\node[label={180:{(0,$-\sqrt{T}$)}},circle,fill,inner sep=2pt] at (axis cs:0,-1) {};
\addplot +[const plot, no marks, black]
coordinates{(0,0) (-0.7,0)};
\addplot[name path=b, domain=0:1.7] {x} \closedcycle node at (current path bounding box.center) {};
\addplot[name path=a, domain=0:1.7] {-x} \closedcycle node at (current path bounding box.center) {};
\addplot[gray!30] fill between[of=b and a];
\path[name path=axisl] (axis cs:-1,0) -- (axis cs:0,0);
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
从语法上可以明显看出如何改变这些线的颜色、密度和斜率。
另外,我恳请您不要将不相关的包添加到 MWE 的序言中,也不要加载两次包。