我在 Miktex+Texmaker 中使用 LaTeX+dvips+ps2pdf+View PDF 配置有以下代码:
下面第一个图(fig:cosine-plot
)清晰可见:
\begin{figure}[H]
\centering
\begin{pspicture}(-2,-1.5)(4,1.5)
\psaxes{->}(0,0)(-2,-1.5)(4,1.5)[$x$,0][$y$,90]
\psplot[linecolor=red, algebraic]{-2}{3.5}{cos(x)}
\end{pspicture}
\caption{Plot of $\cos(x)$}
\label{fig:cosine-plot}
\end{figure}
然而,下面的第二个图(Fig-sin-cos
)并没有出现在汇编中。
\begin{figure}[H]
\centering
\begin{pspicture}(-2,-1.5)(4,1.5)
\psgrid[griddots=10,gridlabels=0pt, subgriddiv=0, gridcolor=black!20]
\psaxes{->}(0,0)(-2,-1.5)(4,1.5)
\psplot[linecolor=blue]{-2}{4}{sin(x)}
\psplot[linecolor=red]{-2}{4}{cos(x)}
\end{pspicture}
\caption{Graphs of $\sin(x)$ and $\cos(x)$}\label{Fig-sin-cos}
\end{figure}
\sin(x)
请帮我绘制和的第二张图表\cos(x)
。
相关问题有解决方案这里。
答案1
您需要该选项algebraic
,您可以使用\psset{algebraic}
\documentclass[11pt]{article}
\usepackage{pst-all}
\begin{document}
\psset{algebraic} %change
\begin{figure}[ht]
\centering
\begin{pspicture}(-2,-1.5)(4,1.5)
\psgrid[griddots=10,gridlabels=0pt, subgriddiv=0, gridcolor=black!20]
\psaxes{->}(0,0)(-2,-1.5)(4,1.5)
\psplot[linecolor=blue]{-2}{4}{sin(x)}
\psplot[linecolor=red]{-2}{4}{cos(x)}
\end{pspicture}
\caption{Graphs of $\sin(x)$ and $\cos(x)$}\label{Fig-sin-cos}
\end{figure}
\end{document}