我尝试设置一个具有精确指定子刻度的绘图区域。
\documentclass[pstricks,border=0pt,12pt,dvipsnames]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
% The following USER INTERFACE are intentionally defined
% to allow users to adjust the PDF output
% to conform to the constraint given by their
% teachers.
% Please don't modify this UI.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% BEGIN OF USER INTERFACE %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Domain of f(x)
\FPeval\XMin{0-pi/6}
\FPeval\XMax{2*pi+pi/6}
\FPeval\YMin{0-1} % We cannot use negative values directly because the author always thinks positively.
\FPeval\YMax{1}
\FPeval\xAtomicUnit{pi} % We cannot use \FPset\xAtomicUnit{pi} because pi is not a constant literal but a function.
\FPset\yAtomicUnit{1}
\FPset\xDivision{180}
\FPset\yDivision{3}
% Dx and Dy represent tick label counters.
% Example:
% yfractionLabels=true,
% yfractionLabelBase=10,
% Dy=3,
% The y tick labels: 3/10, 6/10, 9/10, etc.
\FPset\Dx{30}
\FPset\Dy{2}
% dx and dy represent the distance
% between two consecutive ticks (not subticks)
\FPeval\dx{xAtomicUnit/xDivision*Dx}
\FPeval\dy{yAtomicUnit/yDivision*Dy}
\FPset\xSubTicks{3}
\FPset\ySubTicks{2}
% Extra spaces (paddings) around the domain.
\FPeval\XOL{0-3/xSubTicks} % of dx
\FPeval\XOR{2/xSubTicks} % of dx
\FPeval\YOB{0-1/ySubTicks} % of dy
\FPeval\YOT{1/ySubTicks} % of dy
\FPeval\AxisL{XMin+dx*XOL}
\FPeval\AxisR{XMax+dx*XOR}
\FPeval\AxisB{YMin+dy*YOB}
\FPeval\AxisT{YMax+dy*YOT}
\newlength\Width\Width=148.5mm
\newlength\llx\llx=-30pt
\newlength\urx\urx=15pt
\newlength\lly\lly=-5pt
\newlength\ury\ury=15pt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% END OF USER INTERFACE %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\psset
{
llx=\llx,
lly=\lly,
urx=\urx,
ury=\ury,
xsubticks=\xSubTicks,
ysubticks=\ySubTicks,
algebraic,
plotpoints=100,
}
\newpsstyle{mygrid}
{
dx=\dx,
dy=\dy,
labels=none,
xticksize=\YMin\space \YMax,
yticksize=\XMin\space \XMax,
subticksize=1,
subtickcolor=Red!50,
tickcolor=Green!50,
}
\begin{document}
\begin{psgraph}
[
dx=\dx,
dy=\dy,
Dx=\Dx,
Dy=\Dy,
yfractionLabels,
yfractionLabelBase=\yDivision,
xlabelFactor={}^\circ,
showorigin=false,
axespos=top,
xAxisLabel=$x$,
yAxisLabel=$y$,
labelFontSize=\scriptstyle,
]{->}(0,0)(\AxisL,\AxisB)(\AxisR,\AxisT){\dimexpr\Width-\urx+\llx}{!}
%--------------------------------------------------------------------
\psaxes[style=mygrid](0,0)(\XMin,\YMin)(\XMax,\YMax)
\psplot[linecolor=blue]{\XMin}{\XMax}{2*sin(2*x)/3}
%--------------------------------------------------------------------
\end{psgraph}
\end{document}
不幸的是,尽管我已精确指定填充为单个子刻度宽度的整数倍,但有时靠近边缘的子刻度线和刻度标签仍会丢失。
如何解决这个问题?