我的刻度数字重叠了,减小字体大小\tiny
只需要改变大小x
,但子索引保持相同大小。我怎样才能减小刻度标签中子索引的大小?
\documentclass\[10pt,a4paper\]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes,arrows,positioning,calc}
\pgfplotsset{compat=1.16,
integral axis/.style={
axis lines=middle,
enlarge y limits=upper,
axis equal image, width=12cm,
xlabel=$x$, ylabel=$y$,
ytick=\empty,
xticklabel style={font=\small, text height=1.5ex, anchor=north},
samples=100
},
integral/.style={
domain=2:8,
samples=7
},
integral fill/.style={
integral,
draw=none, fill=#1,
},
integral fill/.default=cyan!10,
integral line/.style={
integral,
very thick,
draw=#1
},
integral line/.default=black,
every tick label/.append style={font=\large}
}
\begin{document}
\begin{figure}
\begin{tikzpicture}\[
% The function that is used for all the plots
declare function={f(\x)=\x/5-cos(deg(\x*1.85))/2+2;}
\]
\begin{axis}\[
integral axis,
ymin=0,
xmin=0.75, xmax=9.25,
domain=1.5:8.5,
xtick={2,2.5,3,3.5,...,8},
xticklabels={$x_0$, $x_{1/2}$, $x_1$,$x_{3/2}$,$x_2$,$x_{5/2}$,$x_3$,,,,$x_{N-1}$,$x_{N-\frac{1}{2}}$,$x_N$},
axis on top
\]
\addplot \[integral fill=cyan!15\] {f(x)} \closedcycle;
\addplot \[very thick, cyan!75!blue\] {f(x)} node \[anchor=south\] {$y=f(x)$};
\addplot \[integral line=black\] {f(x)};
\addplot \[integral, ycomb\] {f(x)};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
答案1
我可能会这么做
\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes,arrows,positioning,calc}
\pgfplotsset{compat=1.16,
integral axis/.style={
axis lines=middle,
enlarge y limits=upper,
axis equal image, width=12cm,
xlabel=$x$, ylabel=$y$,
ytick=\empty,
xticklabel style={font=\small, text height=1.5ex, anchor=north},
samples=100
},
integral/.style={
domain=2:8,
samples=7
},
integral fill/.style={
integral,
draw=none, fill=#1,
},
integral fill/.default=cyan!10,
integral line/.style={
integral,
very thick,
draw=#1
},
integral line/.default=black,
every tick label/.append style={font=\large}
}
\begin{document}
\begin{figure}
\begin{tikzpicture}[
% The function that is used for all the plots
declare function={f(\x)=\x/5-cos(deg(\x*1.85))/2+2;}
]
\begin{axis}[
integral axis,
ymin=0,
xmin=0.75, xmax=9.25,
domain=1.5:8.5,
xtick={2,2.5,3,3.5,...,8},
xticklabels={$x_0$, $x_{1/2}$, $x_1$,$x_{3/2}$,$x_2$,$x_{5/2}$,$x_3$,,,,$x_{N-1}$,$x_{N-\frac{1}{2}}$,$x_N$},
axis on top,
xticklabel style={rotate=-45,anchor=north west,yshift=5pt}
]
\addplot [integral fill=cyan!15] {f(x)} \closedcycle;
\addplot [very thick, cyan!75!blue] {f(x)} node [anchor=south] {$y=f(x)$};
\addplot [integral line=black] {f(x)};
\addplot [integral, ycomb] {f(x)};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}