使用 pstricks 计算离散变量的统一 PDF 和 CDF

使用 pstricks 计算离散变量的统一 PDF 和 CDF

我正在尝试为具有 6 个结果的离散变量绘制 PDF 和 CDF。

我的代码是

\documentclass[pstricks]{standalone}
\usepackage{pst-func,amsmath,xfp}
\begin{document}
\begin{filecontents*}{mydata.dat}
    1,0.1667
    2,0.1667
    3,0.1667
    4,0.1667
    5,0.1667
    6,0.1667
\end{filecontents*}
\definecolor{fillColor}{RGB}{125, 185, 250}
\psset{xunit=1cm,yunit=10cm}

\begin{pspicture}(-1.5,-0.1)(12,0.55)
    \readdata{\Data}{mydata.dat} 
    \psaxes[Dy=0.1, dx=1]{->}(0,0)(6.5,0.5)\uput[-90](6.5,0){$x$}
    \uput[-90]{90}(-1.2,0.4){$f(X)=P(X=x)$}
\listplot[plotstyle=bar,linecolor=red]{\Data}
\end{pspicture}

\end{document}

但是我在使用 LuaLaTex 进行编译时出现此错误:

luapstricks: "typecheck" error occured while executing PS code from "./uniformdistrt.tex:19". \end{pspicture}

我没有任何线索……你知道我做错了什么吗? pstricks 中是否有统一的离散函数?谢谢!

PS:这是我的 \listfiles:

*File List*
standalone.cls    2018/03/26 v1.3a Class to compile TeX sub-files standalone
shellesc.sty    2019/11/08 v1.0c unified shell escape interface for LaTeX
ifluatex.sty    2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
   iftex.sty    2020/03/06 v1.0d TeX engine tests
 xkeyval.sty    2020/11/20 v2.8 package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
standalone.cfg    2018/03/26 v1.3a Default configuration file for 'standalone' 
class
 article.cls    2021/10/04 v1.4n Standard LaTeX document class
  size10.clo    2021/10/04 v1.4n Standard LaTeX file (size option)
luatex85.sty    2016/06/15 v1.4 pdftex aliases for luatex
pdftexcmds.sty    2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2019/12/03 v1.5 Providing info/warning/error messages (HO)
 ltxcmds.sty    2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
pstricks.sty    2021/08/23 v0.71 LaTeX wrapper for `PSTricks' (RN,HV)
  xcolor.sty    2021/10/31 v2.13 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
  luatex.def    2021/06/01 v1.2c Graphics/color driver for luatex
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pstricks.tex    2021/09/27 v3.11 `PSTricks' (tvz,hv)
pstricks-dots.tex
  pst-fp.tex    2020/11/20 v0.06 `PST-fp' (hv)
 pst-all.sty    2008/01/01 the main pstricks tools
pst-plot.sty    2021/09/23 package wrapper for pst-plot.tex (hv)
pst-xkey.sty    2005/11/25 v1.6 package wrapper for pst-xkey.tex (HA)
 multido.sty    2004/05/17 package wrapper for PSTricks `multido.tex', (HV/RN)
 multido.tex    2010/05/14 v1.42 `multido' (tvz,hv)
pst-plot.tex    2021/09/23 1.93 `pst-plot' (tvz,hv)
pst-node.sty    2010/04/22 package wrapper for pst-node.tex
pst-node.tex    2021/09/23 1.93 `pst-node' (tvz,hv)
pst-tree.sty    2009/01/25 package wrapper for pst-tree.tex
pst-tree.tex    2021/09/04 1.14 `pst-tree' (tvz,hv)
pst-grad.sty    2004/07/15 package wrapper for pst-grad.tex (hv)
pst-grad.tex    2006/11/27 1.06 `pst-grad' (tvz)
pst-coil.sty    2010/02/01 package wrapper for pst-coil.tex (hv)
pst-coil.tex    2015/05/13 v1.07 `PST-coil' (tvz,hv)
pst-text.sty    2018/12/28 package wrapper for pst-text.tex (hv)
pst-text.tex    2018/12/22 1.01 `pst-text' (tvz)
  pst-3d.sty    2009/07/28 package wrapper for pst-3d.tex (hv)
  pst-3d.tex    2018/12/22 v1.01 `PST-3d' (hv)
 pst-eps.sty    2005/05/20 package wrapper for pst-eps.tex (hv)
 pst-eps.tex    2006/11/04 1.00 `pst-eps' (tvz)
pst-fill.sty    2010/03/20 package wrapper for pst-fill.tex (hv)
pst-fill.tex    2021/10/01 v1.02 `PST-fill' (tvz,dg,hv)
pstricks-add.sty    2021/09/10 v. 0.17 package wrapper for pstricks-add.tex (hv
)
pst-math.sty    2018/12/16 v 0.65 package wrapper for PSTricks pst-math.tex
pst-calculate.sty    2019/01/24 v. 0.02(Herbert Voss) Support for caculations w
ith floating point numbers.
  xparse.sty    2021-11-12 L3 Experimental document command parser
   expl3.sty    2021-11-22 L3 programming layer (loader) 
l3backend-luatex.def    2021-10-18 L3 backend support: PDF output (LuaTeX)
 siunitx.sty    2021-08-16 v3.0.25 A comprehensive (SI) units package
translations.sty    2021/01/17 v1.10a internationalization of LaTeX2e packages 
(CN)
etoolbox.sty    2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
 amstext.sty    2021/08/26 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
l3keys2e.sty    2021-11-12 LaTeX2e option processing using LaTeX3 keys
   array.sty    2021/10/04 v2.5f Tabular extension package (FMi)
 xstring.sty    2021/07/21 v1.84 String manipulations (CT)
pstricks-add.tex    2021/10/01 v1.02 `PSTricks-add' (hv)
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions
supp-pdf.mkii
translations-basic-dictionary-english.trsl    (english translation file `transl
ations-basic-dictionary')
 ***********

答案1

\listfiles其作为第一行放入您的文档中,并将我的列表与您的列表(位于 logile 末尾)进行比较。我对您的示例没有任何问题。

 *File List*
standalone.cls    2018/03/26 v1.3a Class to compile TeX sub-files standalone
shellesc.sty    2019/11/08 v1.0c unified shell escape interface for LaTeX
ifluatex.sty    2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
   iftex.sty    2022/02/03 v1.0f TeX engine tests
 xkeyval.sty    2022/06/16 v2.9 package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
standalone.cfg    2018/03/26 v1.3a Default configuration file for 'standalone' 
class
 article.cls    2021/10/04 v1.4n Standard LaTeX document class
  size10.clo    2021/10/04 v1.4n Standard LaTeX file (size option)
luatex85.sty    2016/06/15 v1.4 pdftex aliases for luatex
pdftexcmds.sty    2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2019/12/03 v1.5 Providing info/warning/error messages (HO)
 ltxcmds.sty    2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
pstricks.sty    2021/08/23 v0.71 LaTeX wrapper for `PSTricks' (RN,HV)
  xcolor.sty    2022/06/12 v2.14 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
  luatex.def    2021/06/01 v1.2c Graphics/color driver for luatex
mathcolor.ltx
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pstricks.tex    2022/08/30 v3.14 `PSTricks' (tvz,hv)
pstricks-dots.tex
  pst-fp.tex    2020/11/20 v0.06 `PST-fp' (hv)
pstricks.pro    2020/06/09 v. 1.31, PostScript prologue file (hv)
pst-algparser.pro    2011/10/31 v. 0.04, PostScript prologue file (hv)
pst-tools.pro    2017/12/03 v 0.06, PostScript prologue file
pst-dots.pro    2006/12/19 v. 2.00, PostScript prologue file (hv)
pst-func.sty    2018/12/13 package wrapper for pst-func.tex (hv)
pst-plot.sty    2021/09/23 package wrapper for pst-plot.tex (hv)
pst-xkey.sty    2005/11/25 v1.6 package wrapper for pst-xkey.tex (HA)
 multido.sty    2004/05/17 package wrapper for PSTricks `multido.tex', (HV/RN)
 multido.tex    2010/05/14 v1.42 `multido' (tvz,hv)
pst-plot.tex    2021/09/23 1.93 `pst-plot' (tvz,hv)
pst-math.sty    2018/12/16 v 0.65 package wrapper for PSTricks pst-math.tex
pst-calculate.sty    2019/01/24 v. 0.02(Herbert Voss) Support for caculations w
ith floating point numbers.
  xparse.sty    2022-06-22 L3 Experimental document command parser
   expl3.sty    2022-08-30 L3 programming layer (loader) 
l3backend-luatex.def    2022-08-30 L3 backend support: PDF output (LuaTeX)
 siunitx.sty    2022-08-08 v3.1.6 A comprehensive (SI) units package
translations.sty    2022/02/05 v1.12 internationalization of LaTeX2e packages (
CN)
etoolbox.sty    2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
 amstext.sty    2021/08/26 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
   array.sty    2022/03/10 v2.5f Tabular extension package (FMi)
 xstring.sty    2021/07/21 v1.84 String manipulations (CT)
pst-math.pro    2018/12/13 v. 0.65, PostScript prologue file (hv)
pst-tools.sty    2012/01/01 package wrapper for pst-tools.tex (hv)
pst-tools.tex    2021/09/23 v1.93 `PST-tools' (hv)
pst-tools.pro    2017/12/03 v 0.06, PostScript prologue file
pstricks-add.sty    2021/09/10 v. 0.17 package wrapper for pstricks-add.tex (hv
)
pst-node.sty    2010/04/22 package wrapper for pst-node.tex
pst-node.tex    2021/09/23 1.93 `pst-node' (tvz,hv)
pst-node.pro    2011/09/18 v. 1.14, PostScript prologue file (hv)
  pst-3d.sty    2009/07/28 package wrapper for pst-3d.tex (hv)
  pst-3d.tex    2021/09/23 v1.93 `PST-3d' (hv)
  pst-3d.pro    2010/01/01 v. 0.01, PostScript prologue file (hv)
pstricks-add.tex    2021/09/23 v1.93 `PSTricks-add' (hv)
pstricks-add.pro    2009/12/17 v. 0.23, PostScript prologue file (hv)
pst-func.tex    2021/11/03 v0.99 `PST-func' (hv)
pst-func.pro    2018/12/13 v. 0.17, PostScript prologue file (hv)
 amsmath.sty    2022/04/08 v2.17n AMS math features
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2022/04/08 v2.04 operator names
     xfp.sty    2022-06-22 L3 Floating point unit
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions
supp-pdf.mkii
translations-basic-dictionary-english.trsl    (english translation file `transl
ations-basic-dictionary')

相关内容