在下图中,我想使用图例、写$x$
标签等。当我使用\begin{axis}
这些时,图形变得太大。
\begin{tikzpicture}[scale=12]
\draw [<->] (0,0.5) -- (0,0) -- (0.9,0);
\draw[black, dashed, domain=0:0.5] plot (\x, {0.25-0.5*\x});
\draw (0.053, 0.2234)--(0.1835,0.158)--(0.207,0.167)--(0.15,0.1853);
\draw[black, domain=0:0.5] plot (\x, {0.25-0.5*\x+ 0.5*\x *\x});
\draw[black, dashed, domain=0:0.5] plot (\x, {1.0+\x- 0.25*sqrt(13.0+20.0*\x +4.0*\x *\x)});
\draw ( 0.0, 0.284 )--( 0.01, 0.272 )--( 0.05, 0.227 )--( 0.054, 0.223)--(0.1, 0.178)--( 0.15, 0.136 )--(0.2, 0.101)--(0.25, 0.071 )--( 0.3, 0.047 )--( 0.35, 0.028 )--( 0.4, 0.011 )--( 0.45, 0.003 )--( 0.49, 0.0 );
\draw [color=black, fill=gray!50] (0,0.25) -- (0,0.284) -- (0.052,0.225) -- cycle;
\draw [color=black, fill=gray!50] (0.053,0.2234) -- (0.1835,0.158) -- (0.207,0.167) --(0.15,0.1853)-- cycle;
%\draw (0.4,-0.1) node{ Value of $x$};
\end{tikzpicture}
答案1
我已经使用轴环境做了一些事情,但我不确定这是否是你想要的:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}%[scale=1.5]
\begin{axis}[axis y line=center,
axis x line=middle,
x=10cm,y=10cm, % units
xmin=-0.02,xmax=0.6,ymin=-0.02,ymax=0.5, % x and y ranges
%xticklabels={}, yticklabels={} % no labels on ticks
xlabel style={below=5mm}, ylabel style={left=10mm, sloped},
xlabel=Values of $x$, ylabel=Values of $y$
]
\addplot[domain=0:0.5,mark=none,blue,dashed,samples=150] {0.25-0.5*x};
\draw (axis cs:0.053, 0.2234)
--(axis cs:0.1835,0.158)
--(axis cs:0.207,0.167)
--(axis cs:0.15,0.1853);
\addplot[domain=0:0.5,mark=none,blue,dashed,samples=150] {1.0+x-0.25*sqrt(13.0+20.0*x+4.0*x^2)};
\draw[blue] (axis cs:0.0, 0.284 )
-- (axis cs:0.01, 0.272 )
-- (axis cs:0.05, 0.227 )
-- (axis cs:0.054, 0.223)
-- (axis cs:0.1, 0.178)
-- (axis cs:0.15, 0.136)
-- (axis cs:0.2, 0.101)
-- (axis cs:0.25, 0.071)
-- (axis cs:0.3, 0.047)
-- (axis cs:0.35, 0.028)
-- (axis cs:0.4, 0.011)
-- (axis cs:0.45, 0.003)
-- (axis cs:0.49, 0.0);
\addplot[domain=0:0.5,mark=none,blue,samples=150] {0.25-0.5*x+ 0.5*x^2};
\draw [color=black, fill=gray!50] (axis cs:0,0.25)
-- (axis cs:0,0.284)
-- (axis cs:0.052,0.225)
-- cycle;
\draw [color=black, fill=gray!50] (axis cs:0.053,0.2234)
-- (axis cs:0.1835,0.158)
-- (axis cs:0.207,0.167)
--(axis cs:0.15,0.1853)
-- cycle;
\end{axis}
\end{tikzpicture}
\end{document}