增加线条的粗细并着色

增加线条的粗细并着色

我一直在研究一个小图形,我想增加一半线条(右半部分)的粗细并想改变颜色。

梅威瑟:

\documentclass[12pt]{article}
\usepackage[a4paper,top=1 in,bottom=1 in,left=0.7 in,right=0.7 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{forest}
\usepackage{tikz,tkz-euclide,xcolor,graphicx}
%\usetkzobj{all}

\begin{document}
\large
\begin{center}
\begin{tikzpicture}

\tkzDefPoints{0/0/A, 12/0/B, 6/0/C}

\draw[thick](A)--(B);
\tkzDrawPoints[color=black,size=0.15cm](A,B,C)

\tkzDefPoint[label=below:{$(-)$}](0,0){A}
\tkzDefPoint[label=above:{$a=2$}](0,0){A}
\tkzDefPoint[label=below:{$(+)$}](12,0){B}
\tkzDefPoint[label=above:{$b=3$}](12,0){B}
\tkzDefPoint[label=below:{$(-)$}](6,0){C}
\tkzDefPoint[label=above:{$f(x_{1})=f(2.5)$}](6,0){C}
\end{tikzpicture}
\end{center}
\end{document}

答案1

你的问题很简单。我很惊讶居然没人回答。

您已经拥有\draw和所需的 3 分。

只需将原图分\draw成两半,然后在右半部分添加您喜欢的颜色和线条宽度。

\documentclass[12pt]{article}
\usepackage[a4paper,top=1 in,bottom=1 in,left=0.7 in,right=0.7 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{forest}
\usepackage{tikz,tkz-euclide,xcolor,graphicx}
%\usetkzobj{all}

\begin{document}
\large
\begin{center}
\begin{tikzpicture}

\tkzDefPoints{0/0/A, 12/0/B, 6/0/C}

\draw[thick](A)--(C);
\draw[red, line width=4pt](C)--(B);
\tkzDrawPoints[color=black,size=0.15cm](A,B,C)

\tkzDefPoint[label=below:{$(-)$}](0,0){A}
\tkzDefPoint[label=above:{$a=2$}](0,0){A}
\tkzDefPoint[label=below:{$(+)$}](12,0){B}
\tkzDefPoint[label=above:{$b=3$}](12,0){B}
\tkzDefPoint[label=below:{$(-)$}](6,0){C}
\tkzDefPoint[label=above:{$f(x_{1})=f(2.5)$}](6,0){C}
\end{tikzpicture}
\end{center}
\end{document}

在此处输入图片描述

相关内容