我想创建一个包含 3 个(或更多)图的图片,这些图将具有数百个样本的标准差。这是我的 Latex 图片:
由于样本量太大,所以看起来不太好看。这是 MatLab 中的同一张图片:
它有点拉伸(因为我的显示器,不用担心),但阴影错误看起来好多了。我如何在 Latex 中做到这一点?
我这里只有 1 个图的乳胶代码示例:
\begin{figure*}[!t]
\centering
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=104,
ymin=0, ymax=500,
ymajorgrids=true,
grid style=dashed,
width=0.9\textwidth,
]
\addplot[color=red, error bars/.cd, y dir=both, y explicit] coordinates {(0,0.224)+=(0,0.000)-=(0,0.000)(1,4.205)+=(1,3.416)-=(1,3.416)(2,25.467)+=(2,14.280)-=(2,14.280)(3,52.231)+=(3,20.196)-=(3,20.196)(4,65.673)+=(4,20.982)-=(4,20.982)(5,69.218)+=(5,14.747)-=(5,14.747)(6,71.268)+=(6,14.081)-=(6,14.081)(7,73.148)+=(7,16.250)-=(7,16.250)(8,73.693)+=(8,18.405)-=(8,18.405)(9,73.599)+=(9,22.527)-=(9,22.527)(10,77.449)+=(10,27.273)-=(10,27.273)(11,89.192)+=(11,42.360)-=(11,42.360)(12,96.434)+=(12,47.407)-=(12,47.407)(13,95.075)+=(13,48.195)-=(13,48.195)(14,91.326)+=(14,47.163)-=(14,47.163)(15,89.722)+=(15,45.783)-=(15,45.783)(16,88.292)+=(16,47.313)-=(16,47.313)(17,88.676)+=(17,46.570)-=(17,46.570)(18,92.385)+=(18,48.606)-=(18,48.606)(19,100.665)+=(19,58.200)-=(19,58.200)(20,101.036)+=(20,59.284)-=(20,59.284)(21,99.163)+=(21,56.802)-=(21,56.802)(22,98.548)+=(22,56.120)-=(22,56.120)(23,96.174)+=(23,56.345)-=(23,56.345)(24,95.205)+=(24,56.569)-=(24,56.569)(25,96.056)+=(25,55.202)-=(25,55.202)(26,100.164)+=(26,53.525)-=(26,53.525)(27,101.274)+=(27,55.441)-=(27,55.441)(28,103.403)+=(28,56.793)-=(28,56.793)(29,105.818)+=(29,59.267)-=(29,59.267)(30,106.274)+=(30,57.561)-=(30,57.561)(31,108.765)+=(31,55.798)-=(31,55.798)(32,114.637)+=(32,50.816)-=(32,50.816)(33,118.263)+=(33,48.703)-=(33,48.703)(34,118.484)+=(34,49.160)-=(34,49.160)(35,117.704)+=(35,48.206)-=(35,48.206)(36,119.837)+=(36,47.593)-=(36,47.593)(37,118.594)+=(37,48.779)-=(37,48.779)(38,116.587)+=(38,50.543)-=(38,50.543)(39,117.633)+=(39,56.970)-=(39,56.970)(40,123.923)+=(40,58.094)-=(40,58.094)(41,126.986)+=(41,62.988)-=(41,62.988)(42,126.599)+=(42,54.805)-=(42,54.805)(43,128.723)+=(43,57.758)-=(43,57.758)(44,131.958)+=(44,56.155)-=(44,56.155)(45,136.809)+=(45,60.811)-=(45,60.811)(46,135.276)+=(46,64.177)-=(46,64.177)(47,135.190)+=(47,64.530)-=(47,64.530)(48,136.841)+=(48,63.921)-=(48,63.921)(49,135.721)+=(49,61.899)-=(49,61.899)(50,139.175)+=(50,64.210)-=(50,64.210)(51,141.411)+=(51,59.908)-=(51,59.908)(52,141.724)+=(52,60.329)-=(52,60.329)(53,143.269)+=(53,59.867)-=(53,59.867)(54,148.070)+=(54,58.350)-=(54,58.350)(55,143.483)+=(55,57.578)-=(55,57.578)(56,144.473)+=(56,59.385)-=(56,59.385)(57,148.930)+=(57,62.112)-=(57,62.112)(58,155.431)+=(58,62.463)-=(58,62.463)(59,160.489)+=(59,63.534)-=(59,63.534)(60,159.029)+=(60,61.840)-=(60,61.840)(61,156.140)+=(61,62.124)-=(61,62.124)(62,155.336)+=(62,60.944)-=(62,60.944)(63,153.868)+=(63,59.996)-=(63,59.996)(64,154.243)+=(64,61.573)-=(64,61.573)(65,156.299)+=(65,60.551)-=(65,60.551)(66,155.569)+=(66,58.158)-=(66,58.158)(67,160.299)+=(67,58.813)-=(67,58.813)(68,163.249)+=(68,57.448)-=(68,57.448)(69,163.121)+=(69,58.308)-=(69,58.308)(70,163.117)+=(70,59.797)-=(70,59.797)(71,160.687)+=(71,59.985)-=(71,59.985)(72,159.729)+=(72,60.022)-=(72,60.022)(73,159.356)+=(73,61.807)-=(73,61.807)(74,157.507)+=(74,58.970)-=(74,58.970)(75,156.925)+=(75,58.859)-=(75,58.859)(76,159.168)+=(76,54.277)-=(76,54.277)(77,164.158)+=(77,52.668)-=(77,52.668)(78,172.283)+=(78,54.742)-=(78,54.742)(79,174.177)+=(79,51.602)-=(79,51.602)(80,178.273)+=(80,52.599)-=(80,52.599)(81,180.454)+=(81,53.622)-=(81,53.622)(82,184.283)+=(82,54.410)-=(82,54.410)(83,179.580)+=(83,52.350)-=(83,52.350)(84,180.243)+=(84,48.510)-=(84,48.510)(85,180.319)+=(85,47.431)-=(85,47.431)(86,178.535)+=(86,48.179)-=(86,48.179)(87,179.896)+=(87,48.532)-=(87,48.532)(88,182.799)+=(88,45.744)-=(88,45.744)(89,183.684)+=(89,44.370)-=(89,44.370)(90,182.891)+=(90,42.702)-=(90,42.702)(91,178.799)+=(91,43.012)-=(91,43.012)(92,177.769)+=(92,44.467)-=(92,44.467)(93,184.186)+=(93,42.660)-=(93,42.660)(94,184.601)+=(94,41.323)-=(94,41.323)(95,182.563)+=(95,43.651)-=(95,43.651)(96,178.976)+=(96,46.911)-=(96,46.911)(97,168.782)+=(97,55.141)-=(97,55.141)(98,166.078)+=(98,55.158)-=(98,55.158)(99,168.017)+=(99,58.878)-=(99,58.878)(100,167.712)+=(100,56.439)-=(100,56.439)(101,168.566)+=(101,62.681)-=(101,62.681)(102,164.440)+=(102,61.769)-=(102,61.769)(103,166.395)+=(103,64.007)-=(103,64.007)};
\end{axis}
\end{tikzpicture}
\caption{aa.}
\label{fig:kickPositions}
\end{figure*}
答案1
谢谢托比约恩T,使用fillbetween
,我让它看起来像 matlab(我还将标准差减半以提高可读性)!
如果有人想检查一下,这里有一个单一情节的代码:
\begin{figure*}[!t]
\centering
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=103,
ymin=0, ymax=450,
ymajorgrids=true,
grid style=dashed,
legend pos=north west,
width=0.9\textwidth,
]
\addplot[color=green] coordinates {(0,0.224)(1,3.950)(2,22.342)(3,45.714)(4,57.661)(5,61.423)(6,65.176)(7,68.131)(8,68.278)(9,67.468)(10,70.739)(11,80.818)(12,87.117)(13,85.556)(14,81.694)(15,78.921)(16,78.547)(17,80.517)(18,84.881)(19,92.278)(20,92.836)(21,92.800)(22,92.687)(23,90.633)(24,89.472)(25,88.903)(26,92.447)(27,93.281)(28,95.455)(29,98.653)(30,99.269)(31,101.879)(32,108.376)(33,111.317)(34,111.437)(35,111.704)(36,113.694)(37,112.706)(38,110.847)(39,112.595)(40,117.620)(41,120.180)(42,120.507)(43,121.170)(44,124.625)(45,128.774)(46,127.270)(47,127.436)(48,128.484)(49,126.953)(50,129.903)(51,132.016)(52,132.538)(53,134.100)(54,138.201)(55,134.187)(56,135.329)(57,139.811)(58,145.078)(59,149.390)(60,148.206)(61,145.845)(62,145.084)(63,144.335)(64,146.273)(65,150.068)(66,155.423)(67,166.859)(68,173.803)(69,174.050)(70,175.557)(71,173.866)(72,173.925)(73,174.348)(74,173.486)(75,173.179)(76,175.438)(77,180.299)(78,188.149)(79,189.498)(80,192.600)(81,195.405)(82,199.601)(83,195.834)(84,196.922)(85,197.858)(86,197.697)(87,203.071)(88,205.700)(89,208.696)(90,210.966)(91,206.956)(92,207.140)(93,212.596)(94,214.412)(95,212.446)(96,210.315)(97,201.999)(98,201.029)(99,204.034)(100,203.493)(101,204.802)(102,202.206)(103,203.943)};
\addplot[name path=us_top,color=green!70] coordinates {(0,0.224)(1,5.535)(2,29.737)(3,57.464)(4,70.775)(5,72.435)(6,74.541)(7,77.430)(8,78.633)(9,79.826)(10,85.274)(11,102.300)(12,111.132)(13,109.993)(14,105.764)(15,103.056)(16,102.735)(17,103.648)(18,108.600)(19,120.449)(20,121.406)(21,119.685)(22,119.127)(23,117.087)(24,116.076)(25,115.338)(26,118.357)(27,120.118)(28,122.858)(29,126.866)(30,126.685)(31,128.485)(32,132.603)(33,134.864)(34,135.218)(35,134.707)(36,136.477)(37,135.923)(38,134.793)(39,139.202)(40,145.056)(41,149.920)(42,146.433)(43,148.852)(44,151.536)(45,157.948)(46,157.900)(47,158.139)(48,159.120)(49,156.858)(50,160.990)(51,161.308)(52,161.927)(53,163.285)(54,167.029)(55,162.448)(56,164.298)(57,169.939)(58,175.848)(59,180.932)(60,178.916)(61,176.447)(62,175.170)(63,173.720)(64,175.756)(65,178.570)(66,181.969)(67,194.687)(68,202.557)(69,203.334)(70,206.189)(71,204.959)(72,205.586)(73,207.163)(74,205.791)(75,205.614)(76,206.172)(77,210.358)(78,218.791)(79,218.622)(80,221.460)(81,225.044)(82,229.769)(83,225.853)(84,225.870)(85,227.067)(86,228.399)(87,237.160)(88,238.738)(89,243.223)(90,247.914)(91,244.057)(92,245.744)(93,249.853)(94,252.708)(95,251.345)(96,251.377)(97,246.861)(98,247.513)(99,252.447)(100,251.075)(101,254.400)(102,252.977)(103,255.088)};
\addplot[name path=us_down,color=green!70] coordinates {(0,0.224)(1,2.365)(2,14.947)(3,33.965)(4,44.548)(5,50.411)(6,55.811)(7,58.832)(8,57.924)(9,55.111)(10,56.205)(11,59.337)(12,63.102)(13,61.118)(14,57.623)(15,54.786)(16,54.358)(17,57.387)(18,61.163)(19,64.107)(20,64.266)(21,65.916)(22,66.247)(23,64.180)(24,62.868)(25,62.468)(26,66.538)(27,66.445)(28,68.052)(29,70.440)(30,71.853)(31,75.272)(32,84.149)(33,87.770)(34,87.655)(35,88.701)(36,90.911)(37,89.489)(38,86.901)(39,85.989)(40,90.183)(41,90.440)(42,94.581)(43,93.487)(44,97.715)(45,99.600)(46,96.640)(47,96.733)(48,97.849)(49,97.049)(50,98.815)(51,102.723)(52,103.148)(53,104.915)(54,109.372)(55,105.926)(56,106.359)(57,109.684)(58,114.308)(59,117.847)(60,117.496)(61,115.242)(62,114.998)(63,114.950)(64,116.789)(65,121.565)(66,128.877)(67,139.031)(68,145.049)(69,144.765)(70,144.924)(71,142.774)(72,142.263)(73,141.533)(74,141.181)(75,140.745)(76,144.703)(77,150.240)(78,157.506)(79,160.375)(80,163.739)(81,165.767)(82,169.434)(83,165.815)(84,167.974)(85,168.648)(86,166.996)(87,168.982)(88,172.662)(89,174.168)(90,174.018)(91,169.855)(92,168.536)(93,175.339)(94,176.116)(95,173.546)(96,169.253)(97,157.136)(98,154.544)(99,155.621)(100,155.912)(101,155.205)(102,151.434)(103,152.798)};
\addplot[green!50,fill opacity=0.5] fill between[of=us_top and us_down];
\legend{US, PUS, APUS}
\end{axis}
\end{tikzpicture}
\caption{aa.}
\label{fig:samplingComp}
\end{figure*}