使用数学公式控制 yticks

使用数学公式控制 yticks

$ymin$我正在尝试使用和的数学函数来定义 yticks $ymax$。尽管$y_{min}$ $y_{max}$已知,但我无法为 yticks 插入显式值,因为我必须对超过 100 个 Subplot 执行此操作。

以下是使用一个子图的 MWE:

% This file was created by matlab2tikz v0.4.2.
% Copyright (c) 2008--2013, Nico Schlömer <[email protected]>
% All rights reserved.
% 
% The latest updates can be retrieved from
%   http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz
% where you can also make suggestions and rate matlab2tikz.
% 
% 
% 
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{amsmath}
\pgfplotsset{
  yticklabel style={text width=2em,align=right},
}
\begin{document}
\begin{tikzpicture}

\begin{axis}[%
width=0.782786366646341in,
height=0.587194955785812in,
scale only axis,
xmin=-359.244881781626,
xmax=360.065217547088,
xtick={\empty},
ymin=1.28609457650951,
ymax=1.41228987725779,
name=plot13,
label style={font=\large}, every axis/.append style={font=\large},mark size=0.05mm,xticklabel style={/pgf/number format/fixed},ytick={\pgfkeysvalueof{(/pgfplots/ymin+/pgfplots/ymax)/2+(/pgfplots/ymax-/pgfplots/ymin)/3}},\pgfkeysvalueof{(/pgfplots/ymin+/pgfplots/ymax)/2},\pgfkeysvalueof{(/pgfplots/ymin+/pgfplots/ymax)/2-(/pgfplots/ymax-/pgfplots/ymin)/3}}}
]
\addplot[only marks,mark=o,color=red] plot coordinates{
(360.065217547088,1.39854349784227)
(-359.244881781626,1.39982093981607)
(-358.40443489089,1.40172293948734)
(-357.561892567634,1.40301454475056)
(-356.718610304702,1.40301454475056)
(-355.875655724595,1.40301454475056)
(319.221524968047,1.36667619074149)
(320.08970805058,1.36858934829893)
(320.957755672442,1.36304494596182)
(321.826459553688,1.36224724551416)
(322.694770827825,1.36524275455075)
(323.560805974673,1.36481645576931)
(324.425775701233,1.36314189168674)
(325.291672663171,1.36277512257593)
(326.158330953695,1.36287625187893)
(327.024339486036,1.36342938970337)
(327.887351626729,1.36398061366958)
(328.747322724523,1.36596188738228)
(329.606940469401,1.3650567860349)
(330.467046411872,1.36405256454973)
(331.327080302014,1.36384365149643)
(332.185530594617,1.36317683899384)
(348.364917468781,1.36811797091692)
(349.208781043468,1.36945708129693)
(350.054024232307,1.37302916477729)
(350.898631395933,1.37356863309838)
(351.7406957981,1.37457957525552)
(352.580820188072,1.37565278541448)
(353.41941849678,1.37618826330081)
(354.261104922223,1.37735567565605)
(355.102859230821,1.38079070690794)
(355.942327918808,1.38186307944567)
(356.779608020006,1.38641832021829)
(357.616505810991,1.39241054346529)
(358.455157096563,1.39680348485733)
(359.295973133871,1.39854349784227)
};

\end{axis}
\end{tikzpicture}%
\end{document}

编译不通过。如果没有ytick={\pgfkeysvalueof{(/pgfplots/ymin+/pgfplots/ymax)/2+(/pgfplots/ymax-/pgfplots/ymin)/3}},\pgfkeysvalueof{(/pgfplots/ymin+/pgfplots/ymax)/2},\pgfkeysvalueof{(/pgfplots/ymin+/pgfplots/ymax)/2-(/pgfplots/ymax-/pgfplots/ymin)/3}}},我得到以下结果:

在此处输入图片描述

我做错了什么?

相关内容