我不太明白为什么
- 永远没有零
- 有时我得到的标签不完整
如何让数轴有完整的标签?
案例 1:欧米茄的倍数
\documentclass[pstricks,border=1cm]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
\FPeval\Const{2*pi*10}% f = 10 Hz
\FPeval\Right{2*Const}
\FPeval\Left{0-Const}
\FPset\xTrigLabelBase{3}
\FPset\Dx{1}
\FPeval\dx{Const/xTrigLabelBase*Dx}
\FPeval\XUnit{10/(Right-Left)}
\psset
{
yAxis=false,
xunit=\XUnit,
dx=\dx,
Dx=\Dx,
xtrigLabels,
xtrigLabelBase=\xTrigLabelBase,
}
\def\pi{\omega}
\begin{document}
\begin{pspicture}(\Left,-12pt)(\Right,12pt)
\psaxes(0,0)(\Left,-12pt)(\Right,12pt)
\end{pspicture}
\end{document}
情况 2:圆周率的倍数
\documentclass[pstricks,border=1cm]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
\FPeval\Const{pi}
\FPeval\Right{2*Const}
\FPeval\Left{0-Const}
\FPset\xTrigLabelBase{3}
\FPset\Dx{1}
\FPeval\dx{Const/xTrigLabelBase*Dx}
\FPeval\XUnit{10/(Right-Left)}
\psset
{
yAxis=false,
xunit=\XUnit,
dx=\dx,
Dx=\Dx,
xtrigLabels,
xtrigLabelBase=\xTrigLabelBase,
}
\begin{document}
\begin{pspicture}(\Left,-12pt)(\Right,12pt)
\psaxes(0,0)(\Left,-12pt)(\Right,12pt)
\end{pspicture}
\end{document}
案例 3:2 的平方根的倍数
\documentclass[pstricks,border=1cm]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
\FPeval\Const{root(2,2)}
\FPeval\Right{2*Const}
\FPeval\Left{0-Const}
\FPset\xTrigLabelBase{3}
\FPset\Dx{1}
\FPeval\dx{Const/xTrigLabelBase*Dx}
\FPeval\XUnit{10/(Right-Left)}
\psset
{
yAxis=false,
xunit=\XUnit,
dx=\dx,
Dx=\Dx,
xtrigLabels,
xtrigLabelBase=\xTrigLabelBase,
}
\def\pi{\sqrt2}
\begin{document}
\begin{pspicture}(\Left,-12pt)(\Right,12pt)
\psaxes(0,0)(\Left,-12pt)(\Right,12pt)
\end{pspicture}
\end{document}
案例 4:90 度的倍数
\documentclass[pstricks,border=1cm]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
\FPeval\Const{pi}
\FPeval\Right{2*Const}
\FPeval\Left{0-Const}
\FPset\xTrigLabelBase{180}
\FPset\Dx{90}
\FPeval\dx{Const/xTrigLabelBase*Dx}
\FPeval\XUnit{10/(Right-Left)}
\psset
{
yAxis=false,
xunit=\XUnit,
dx=\dx,
Dx=\Dx,
xlabelFactor={}^\circ,
}
\begin{document}
\begin{pspicture}(\Left,-12pt)(\Right,12pt)
\psaxes(0,0)(\Left,-12pt)(\Right,12pt)
\end{pspicture}
\end{document}
编辑
即使我使用 Herbert 提供的最新版本,问题仍然存在。
\documentclass[border=1cm,pstricks]{standalone}
\usepackage{pst-plot,pst-calculate}
\psset{yAxis=false}
\begin{document}
\begin{pspicture}(-7,0)(13,8)
\psline[linestyle=dashed,linecolor=cyan!50](!Pi 0)(!Pi 8)
\rput(0,1){%
\psaxes(0,0)(-7,-12pt)(13,12pt)%
}
\rput(0,3){%
\def\pi{\sqrt{17}}%
\psaxes[xtrigLabels,xtrigLabelBase=3,dx=\pscalculate{sqrt(17)/3}](0,0)(-\pscalculate{sqrt(17)},-12pt)(\pscalculate{2*sqrt(17)},12pt)%
}
\rput(0,5){%
\psaxes[xtrigLabels,xtrigLabelBase=3,dx=\pscalculate{pi/3}](0,0)(-\psPi,-12pt)(\psPiFour,12pt)%
}
\rput(0,7){%
\psaxes[xlabelFactor={}^\circ,dx=\pscalculate{pi/2},Dx=90](0,0)(-\psPi,-12pt)(\psPiFour,12pt)%
}
\end{pspicture}
\end{document}
答案1
随着pst-plot.tex
http://archiv.dante.de/~herbert/texnik/tex/generic/pst-plot/
\documentclass{article}
\usepackage{pst-plot,pst-calculate}
\psset{yAxis=false,xtrigLabels,xtrigLabelBase=3}
\begin{document}
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\def\pi{\omega}% Hold it local
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\def\pi{\sqrt2}% Hold it local
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\psset{trigLabels=false}
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\psaxes[dx=\pscalculate{3.14/2},Dx=90,Ox=-180](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\end{document}
\documentclass[border=1cm,pstricks]{standalone}
\usepackage{pst-plot,pst-calculate}
\psset{yAxis=false}
\begin{document}
\begin{pspicture}(-7,0)(13,8)
\psline[linestyle=dashed,linecolor=cyan!50](!Pi 0)(!Pi 8)
\rput(0,1){\psaxes[Ox=-7](-7,-5mm)(13,12pt)}
\rput(0,3){%
\def\pi{\sqrt{17}}%
\psaxes[xtrigLabels,xtrigLabelBase=3,dx=\pscalculate{sqrt(17)/3},Ox=-3]%
(-\pscalculate{sqrt(17)},0)(\pscalculate{2*sqrt(17)+0.01},0)%
}
\rput(0,5){%
\psaxes[xtrigLabels,xtrigLabelBase=3,dx=\pscalculate{pi/3}](0,0)(-\psPi,-12pt)(\psPiFour,12pt)%
}
\rput(0,7){%
\psaxes[xlabelFactor={}^\circ,dx=\pscalculate{pi/2},
Dx=90,Ox=-180](-\psPi,-5mm)(12.58,12pt)%
}
\end{pspicture}
\end{document}