我一直试图在乳胶中重新创建下面的图像。
我目前得到的 MWE
\documentclass[conference]{IEEEtran}
\usepackage{geometry}
\usepackage{tikz}
\usepackage{lipsum}
\title{A Title}
\date{\today}
\author{Author}
\begin{document}
\maketitle
\lipsum[1]
\begin{figure}[!ht]
\centering
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (2,2);
\coordinate (c) at (4,0);
\coordinate (d) at (-1,0);
\coordinate (e) at (5,0);
\coordinate (f) at (-1,3);
\coordinate (g) at (2,0);
\coordinate (h) at (-1,2);
\draw (a)--(b)--(c)--(a);
\draw (d) -- (e);
\draw (d)--(f);
\draw [densely dotted] (b)--(g);
\draw [densely dotted] (b)--(h);
\draw(a) node[anchor=east,align=center] {a};
\draw(b) node[anchor=south,align=center] {b} ;
\draw(c) node[anchor=west,align=center] {c};
\end{tikzpicture}
\caption{Some Caption}
\label{fig:tikz picture}
\end{figure}
\lipsum[5]
\end{document}
我该如何完成这幅图。我猜主要问题是 xy 轴以及标签。我还想知道我们如何添加\columnwidth
或\textwidth
选项,以便可以在 ieee 格式的单列中进行调整。
答案1
编辑:1
在被遗忘的标签 之前添加c
像这样:
\documentclass[conference]{IEEEtran}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{lipsum}
\title{A Title}
\date{\today}
\author{Author}
\begin{document}
\maketitle
\lipsum[1]
\begin{figure}[!ht]
\centering
\begin{tikzpicture}[>=Straight Barb,
every label/.append style={text height=2ex}]
\draw[->] (0,0) coordinate[label=below left:0] (o)
-- ++ (5,0) node[below left] {$U$};
\draw[->] (o) -- ++ (0,4) node[below left] {$\mu_A(U)$};
\coordinate[label=below:$b$] (b) at (1,0);
\coordinate[label=above:$A$] (A) at (2,3);
\coordinate[label=below:$c$] (c) at (2,0);
\coordinate[label=below:$a$] (a) at (3,0);
\draw[thick] (a)--(A)--(b);
\draw[densely dashed]
(o |- A) node[left] {1} -| (c);
\end{tikzpicture}
\caption{Some Caption}
\label{fig:tikz picture}
\end{figure}
\lipsum[5]
\end{document}
答案2
万一您需要一个正三角形(长度可调),下面是我研究的解决方案(而 Zarko 抢先了一步):
\usepackage{geometry}
\usepackage{tikz}
\usepackage{lipsum}
\title{A Title}
\date{\today}
\author{Author}
\begin{document}
\maketitle
\lipsum[1]
\begin{figure}[!ht]
\centering
\begin{tikzpicture}
\def\l{1.5}
\coordinate (o) at (0,0);
\coordinate (b) at (3-\l,0);
\coordinate (A) at (3,{\l*sqrt(3)});
\coordinate (a) at (3+\l,0);
\draw[<->] (0,{\l*sqrt(3)+.5}) node[above] {$p_A(U)$}|- (6,0) node[right] {$U$} node[midway, below left] {$0$};
\draw (b) node[below] {\strut $b$} --(A) node[above]{$A$} --(a)node[below] {\strut $a$};
\draw[densely dashed] (o|-A) node[left]{$1.0$} -| (o-|A) node[below]{\strut $c$};
\end{tikzpicture}
\caption{A triangular membership function}
\label{fig:tikz picture}
\end{figure}
\lipsum[5]
\end{document}
答案3
\documentclass[margin=2mm]{standalone}
\usepackage{tikz,pgfplots}
\usepackage{amsmath, amsfonts, amssymb}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1]
\begin{axis}[
%title = teste,
%axis lines=middle,
axis x line=middle,
axis y line=middle,
xmin = -1,
xmax = 6,
xtick=data,
xticklabels={,,,$m$,,$n$,,$p$},
ymin = 0,
ymax = 1.1,
extra x ticks={0},
%xtick = {-1,0,1},
%xticklabels = {$-1$,$0$,$1$},
ytick = {1},
%yticklabels = {$1$},
xlabel = {$x$},
ylabel = {$\varphi_F (x)$},
every axis x label/.style={at={(ticklabel* cs:1.05)},anchor=west},
every axis y label/.style={at={(ticklabel* cs:1.05)},anchor=south},
]
\draw [red,line width=1pt,line join=round] (axis cs:-1,0) -- (axis cs:1,0) -- (axis cs: 3,1) -- (axis cs:5,0) -- (axis cs: 6,0);
\draw (axis cs: 3,1) node[above] {$\varphi_F$};
\draw [dashed, help lines] (axis cs:3,0) -- (axis cs:3,1) -- (axis cs:0,1);
\end{axis}
\end{tikzpicture}
\end{document}