# pgfplot | tikzpicture | 更改长度+蜱的宽度

Johnny Canuck 05/29/2015. 1 answers, 4.636 views

  \ {的DocumentClass文章}  \ usepackage {pgfplots}   \ {开始}文件   \ {开始} tikzpicture      \开始{轴}        [width = 190pt，axis x line = middle，axis y line = center，        剔对齐=外部，        XMIN = 0.3，XMAX = 7.7，YMIN = 0.44，YMAX = 1.05，        xlabel = {\ emph {x轴标签}}，ylabel = {\ emph {y轴标签}}，        XTICK = {1,2,3,4,5,6,7}，ytick = {0.5,0.6,0.7,0.8,0.9,1.0}        x label style = {at = {（axis description cs：0.5，-0.1）}，anchor = north}，        y标签style = {at = {（axis description cs：-0.1，.5）}，rotate = 90，anchor = south}，       每个tick / .style = {black，semithick，height = 1cm}，        ylabel style = {yshift = 0.2cm}，xlabel style = {yshift = -0.2cm}]          \ addplot + [mark = none，smooth，thick] plot coordinates {              （1,1）              （2,0.75）              （3,0.666）              （4,0.625）              （5,0.6）              （6,0.5833）              （7,0.571）          };          \ addplot [red，dashed，no markers，thick] coordinates {（0.3,0.5）（7.7,0.5）};      \ {端轴}  \ {端} tikzpicture  \ {端文档}

Heiko Oberdiek 04/13/2017.

\documentclass{article}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.12}

\begin{document}
\begin{tikzpicture}
\pgfmathsetlengthmacro\MajorTickLength{
\pgfkeysvalueof{/pgfplots/major tick length} * 0.5
}
\begin{axis}[
width=190pt,
axis x line=middle,
axis y line=center,
tick align=outside,
xmin=0.3,
xmax=7.7,
ymin=0.44,
ymax=1.05,
xlabel={\emph{x-axis label}},
ylabel={\emph{y-axis label}},
xtick={1,2,3,4,5,6,7},
ytick={0.5,0.6,0.7,0.8,0.9,1.0},
x label style={
at={(axis description cs:0.5,-0.1)},
anchor=north,
},
y label style={
at={(axis description cs:-0.1,.5)},
rotate=90,
anchor=south,
},
major tick length=\MajorTickLength,
every tick/.style={
black,
semithick,
},
ylabel style={yshift=0.2cm},
xlabel style={yshift=-0.2cm}
]
(1,1)
(2,0.75)
(3,0.666)
(4,0.625)
(5,0.6)
(6,0.5833)
(7,0.571)
};
\addplot [red, dashed, no markers, thick] coordinates {(0.3,0.5)
(7.7,0.5)};
\end{axis}
\end{tikzpicture}
\end{document} 

# 大胆的勾号

tick label style=\boldmath,

Johnny Canuck 05/29/2015

CroCo 11/22/2015

1 Heiko Oberdiek 11/23/2015
@CroCo查看更新的答案。