index.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <link rel="canonical" href="https://jamesfengcao.gitlab.io/uweb/zh/gnuplot/" />
  7. <link rel="stylesheet" href="../style.css#" type="text/css" />
  8. <title>利用浏览器地址栏对函数作图</title>
  9. <script>
  10. function findLang(){
  11. let href = location.href;
  12. for(let i=href.length-1;i>0;i--){
  13. if('/'==href.charAt(i) && '/'==href.charAt(i-3))
  14. return i;
  15. }
  16. return 0;
  17. }
  18. function nav2(page){
  19. let i = findLang();
  20. location.href = location.href.substring(0,i+1)+page;
  21. }
  22. function nav2Lang(lang){
  23. let i = findLang();
  24. let href = location.href;
  25. location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
  26. }
  27. </script>
  28. </head>
  29. <body>
  30. <header class='header'>
  31. <a class="logo" href="javascript:void(0)" onclick="return nav2('index.html#')">Home</a> <a class="logo" href="javascript:void(0)" onclick="return nav2('tags/index.html#')">Tags</a>
  32. <nav>
  33. </nav>
  34. </header>
  35. <br />
  36. <div class="container">
  37. <h1 class="title">利用浏览器地址栏对函数作图
  38. <br>
  39. <span class="subtitle"></span>
  40. </h1>
  41. <ul class="tags">
  42. <li><a href="../tags/termux/index.html#">termux</a> </li>
  43. </ul>
  44. <p>使用Android端<a href="../index.html#">uweb浏览器</a>。<br>
  45. Termux提供了方便的软件包管理系统,缺省的uWeb地址栏功能配置需用到作图软件gnuplot。</p>
  46. <h4 id="安装gnuplot">安装gnuplot</h4>
  47. <ul>
  48. <li>安装 <a href="../searchurl/plugins.html">uweb定制Termux应用</a></li>
  49. <li>Termux下运行以下命令:<br>
  50. apt update<br>
  51. apt upgrade<br>
  52. apt install gnuplot</li>
  53. </ul>
  54. <h4 id="地址栏功能配置">地址栏功能配置:</h4>
  55. <ul>
  56. <li>配置文件<a href=e:default.acmd>default.acmd</a>每行格式如下:<br>
  57. 菜单名:mimeType:命令行</li>
  58. <li>命令行可包含参数%s,运行时自动用地址栏输入内容替换。</li>
  59. <li>如果浏览器窗口当前地址为本地url,则此目录同时作为命令行工作目录。</li>
  60. </ul>
  61. <h4 id="配置文件defaultacmd如下">配置文件default.acmd如下:</h4>
  62. <pre><code>命令:text/plain:%s
  63. 函数作图:image/svg+xml:gnuplot -e 'set term svg;set output; plot %s'
  64. 函数作图(3d):image/svg+xml:gnuplot -e 'set term svg;set output; splot %s'
  65. 超级计算器:text/html:echo &quot;%s&quot;|bc -l -q
  66. </code></pre>
  67. <p>长按uweb浏览器底部工具条刷新按钮弹出地址栏功能选择,选择“函数作图”,地址栏内输入函数如sin(x)**5就可显示函数图案。</p>
  68. <h4 id="常见问题及诊断">常见问题及诊断</h4>
  69. <ul>
  70. <li>确保gnuplot正确安装,在Termux提示符下,敲入gnuplot,然后回车,保证出现&quot;gnuplot&gt;&quot;。</li>
  71. <li>确保gnuplot正常运行, 在Termux提示符下,执行下面命令:<br>
  72. <code>gnuplot -e 'set term svg;set output; plot x'</code><br>
  73. 屏幕输出应该为正常的svg文件(类似html文本)。</li>
  74. <li>Termux应为uweb定制包,否则有一堆设定需要修改。</li>
  75. <li>超微浏览器下长按设置按钮,勾选“标准错误输出”。再次在地址栏执行画图操作,此时浏览器会显示出错信息。</li>
  76. <li>为保证地址栏输入函数符合gnuplot规范,首个测试函数建议为&quot;x&quot;,即整个地址栏内输入为&quot;x&quot;。</li>
  77. </ul>
  78. </div>
  79. <p>Last Modified: 2 April 2024<br>
  80. add js function in README<br>
  81. <pre></pre>
  82. </p>
  83. <script id='jsgiscus'
  84. src='https://giscus.app/client.js'
  85. data-repo="torappinfo/uweb"
  86. data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
  87. data-category="Announcements"
  88. data-category-id="DIC_kwDOEgNLGc4CQjsh"
  89. data-mapping="title"
  90. data-strict="0"
  91. data-reactions-enabled="1"
  92. data-emit-metadata="0"
  93. data-input-position="top"
  94. data-theme="light"
  95. data-lang="en"
  96. data-loading="lazy"
  97. crossorigin="anonymous" async>
  98. </script>
  99. <footer class="site-footer">
  100. <div class="container">
  101. &copy; 2018-2024 Richard H. Cao
  102. </div>
  103. </footer>
  104. <!-- This document is licensed under the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at <https://www.gnu.org/licenses/>. -->
  105. </body>
  106. </html>