||
如前所述,最近在把两个版本的PDL Book(2012年2月版、2015年5月版)的电子书(.pdf格式)转化为可在IPerl内核的Jupyter Notebook中进行交互学习的电子书(.ipynb格式)。在制作基于2012年2月版第二章内容的.ipynb文件时,示例中的use PDL::Graphics::TriD代码居然不工作,最终自己想办法找到问题解决了。
期间也发现,使用PDL::Graphics::PGPLOT的代码中,画散点图的函数不工作。窗口标题giza,窗口背景白色,画图窗口里有坐标、有刻度、有数字,就是没有散点图,一片空白。是不是散点颜色与背景一致了?在Jupyter Notebook页面对应代码框内加代码{color => black},运行后仍然是一片空白;进一步点线结合,加代码{plotline => 1, color => black},这下能看到点牵出的线了,但还是看不到点。于是运行pdl命令,进入后运行demo pgplot测试。结果发现,points、cont、vect等函数都不能正常工作,line等其余各种画图函数都能正常工作。不得其解,于是加入PDL上的邮件列表,然后群发一个求助邮件如下:
Dear all,
I am trying convert the PDL Book in PDF format to an interactive book powered by Jupyter NoteBook with IPerl kernel. In the process, I found that the points function in PDL::Graphics::PGPLOT did not work. Then I used pdl shell. With the command demo pgplot
---- Code: # First we define some variables to use for the rest of the demo. $x=sequence(10); $y=2*$x**2; # Now a simple plot with points points $x, $y; ---- Output:
There is however no points in the popup window, only a 2d graph with two axes and numbers...no points...
After that, I found vect and cont functions might also have some problems and all the other functions worked properly.
What's wrong with my PDL::Graphics::PGPLOT? I installed PDL via cpan on Ubuntu 23.04 with Perl 5.36. The installing process seemed normally except many complains of "Warning: Fortran 2018 deleted feature:..."
Can somebody help me on this issue?
Best wishes,
可惜得到的回复是还没有向邮件列表发送邮件的权限。于是只能自己摸索。先sudo cpan,然后fforce install PDL::Graphics::PGPLOT,结果无效。思考上次fforce PDL::Graphics::TriD后完全正常,前提是先指定好libglut.so.3。所以,恐怕得有合适的库文件后,再编译安装相应Perl模块才行。从窗口标题giza入手, apt search giza,得到了一系列信息如下:
giza-dev/lunar 1.3.2-1 amd64 [已安装]
Lightweight scientific plotting library (development files)
libcpgplot0/lunar,now 1.3.2-1 amd64 [已安装]
CPGPLOT replacement shared lib based on giza
libgiza0/lunar,now 1.3.2-1 amd64 [已安装,自动]
Lightweight scientific plotting library (shared library)
libpgplot0/lunar,now 1.3.2-1 amd64 [已安装]
PGPLOT replacement shared lib based on giza
网络搜索转到giza的主页,其中有关于PGPLOT接口的页面,的确说了有不少函数尚未实现或只是部分实现了。看来,要PDL::Graphics::PGPLOT完全正常工作,先得换库才行。最后,sudo apt install pgplot5,使用官方的库,同时自动卸载giza-dev库。然后sudo cpan后fforce install PGPLOT,重新编译安装PGPLOT.so及PGPLOT.pm。进入pdl命令行,demo pgplot测试,都能正常工作了。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-14 20:15
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社