gnuplot 入门教程 2
几年前写的一篇短文,今天找东西时翻出来了,感觉写的还是比较实用的。放在这里供有需要的人参考吧。 3D 绘图 例11: splot [-pi:pi] [-pi:pi] sin(x)*cos(y) 产生图 2 结果 --- 以纵横各 10 条线组成的网画出 sin(x)*cos(y) 的图形。 图 3Plottingsin(x)*co
几年前写的一篇短文,今天找东西时翻出来了,感觉写的还是比较实用的。放在这里供有需要的人参考吧。
3D绘图
例 11:
1 |
|
产生图 2结果 --- 以纵横各 10 条线组成的网格画出 sin(x)*cos(y) 的图形。

图 3 Plotting sin(x)*cos(y)
例 12 画等高线图:
1 2 3 4 5 6 7 |
|

例 13 画pm3d图
1 2 3 |
|

1 2 3 4 5 |
|

输出文件
在启动时,您可能注意到终端类型设置为 X11。gnuplot采用标准设计,可以在多个终端设备上绘图。这包括直接打印到多种打印机中,包括 Epson、HP 和 Imagen 打印机。它甚至可以在伪设备中绘图,如 postscript 和 png。这主要涉及生成输出文件,而不是可查看文件或打印输出。这是将您的图表包含在其他报表中的一种技巧。
例 14 设置输出和终端类型
1 2 3 |
|
现在,文件 output.png 中有了您刚才绘制的图。
所有终端在能力上都不相同。其中的一些(如 LaTeX)可能不支持文本的旋转,所以如果您像我们前面那样设置 ylabel,在不同的终端中可能显示不一样。换句话说,您可以在 LaTeX 的特定终端中使用 LaTex 命令。例如,set ylabel $sin(\\\\theta)$(注意我们使用两个反斜杠产生一个 LaTex 所需的反斜杠 —— gnuplot 在将双引号中所括的字符串传送到终端驱动程序之前,先对其进行反斜杠处理)。现在,您可以使用 \\input{output.tex} 将输出文件包含在 LaTeX 文件中。要在 PostScript 终端中获得相同的结果,使用相应的 PostScript 命令:{/Symbol q}。在 enhanced PostScript 和 LaTeX 中,您可以使用表示法 x^{superscript} 和 x_{subscript} 得到上标文字。还要注意缩写的终端和输出命令:
例 15 eps 驱动程序的能力
1 2 3 4 5 |
|
其他
顺便说一下,我们提供的所有例子都可以在交互模式或批处理模式下运行。要以交互模式运行,在提示符中输入每个命令。要以批处理模式运行,将命令输入或添加到文本文件中,然后在 gnuplot提示符中使用 load 'filename' 读入文件,或者在 shell 提示符下将其作为参数提供给 gnuplot:$ gnuplot filename。使用第二种方法,gnuplot会在执行输入文件中的所有命令后退出,所以当直接绘图到文件中时,采用批处理模式执行特别有效。如果在屏幕上绘图时使用第二种方法,输出窗口一出现(当 gnuplot退出时)就会消失,所以您需要使用显式的“pause -1”命令(请参阅 help pause)来保持窗口。
在 X 环境下,gnuplot 如同其他 X client 程序一样,可接受许多参数。如
1 2 3 |
|
gnuplot 绘制数学函数或数值资料的步骤大体如:
定义常数及函数:定义常数及函数,使程式模组化及易于了解。
设定绘图环境:gnuplot 绘图之前已预先设定许多绘图参数。
绘图:在定义数学函数或设定绘图环境之后,接着就是绘出数学函数或数值资料的图形。gnuplot 提供操作方便的绘图指令——plot (2D) 或 splot (3D)。
产生输出结果:在终端上绘出结果后,可经由一些步骤而产生不同输出装置所需的输出。
依照上述过程,可快速地画出图形。剩下的步骤就是细心的调整绘图环境参数或修改函数方程式、常数等,即可得到满意的结果。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Users may have seen the term wapi when using the Internet, but for some people they definitely don’t know what wapi is. The following is a detailed introduction to help those who don’t know to understand. What is wapi: Answer: wapi is the infrastructure for wireless LAN authentication and confidentiality. This is like functions such as infrared and Bluetooth, which are generally covered near places such as office buildings. Basically they are owned by a small department, so the scope of this function is only a few kilometers. Related introduction to wapi: 1. Wapi is a transmission protocol in wireless LAN. 2. This technology can avoid the problems of narrow-band communication and enable better communication. 3. Only one code is needed to transmit the signal

With the continuous development of Internet technology, Web development technology is also constantly updated and iterated. As an open source programming language, PHP is widely used in web development. As one of the commonly used tools in PHP development, the PHP framework can improve development efficiency and code quality. This article will introduce you to a PHP framework - CakePHP, and provide some simple tutorials to get started. 1. What is CakePHP? CakePHP is a model based on MVC (Model-View-Control

LINUX is a widely used operating system that is highly customizable and stable. CentOS is a free and open source operating system built on the Red Hat Enterprise Linux (RHEL) source code. It is widely used in servers and desktop environments. In CentOS Installing software packages on CentOS is one of the common tasks in daily use. This article will introduce how to install gnuplot on CentOS and solve the problem of missing dependencies of Sunflower software. Gnuplot is a powerful drawing tool that can generate various types of charts, including two-dimensional and three-dimensional data visualization. To install gnuplot on CentOS, you can follow the steps below: 1.

Concise and easy-to-understand MyBatis introductory tutorial: write your first program step by step MyBatis is a popular Java persistence layer framework that simplifies the process of interacting with databases. This tutorial will show you how to use MyBatis to create and perform simple database operations. Step 1: Environment setup First, make sure your Java development environment has been installed. Then, download the latest version of MyBatis and add it to your Java project. You can download it from the official website of MyBatis

Lumen is a PHP-based microframework developed by Laravel framework developers. It was originally designed to quickly build small API applications and microservices, while retaining some components and features of the Laravel framework. The Lumen framework is lightweight, fast, and easy to use, so it has received widespread attention and use. In this article, we will quickly get started with the Lumen framework and learn how to use the Lumen framework to build simple API applications. Framework preparation Before learning the Lumen framework, we need to

PythonFlask framework introductory tutorial Flask is a simple and easy-to-use Python Web framework. It pays more attention to flexibility and lightweight, allowing programmers to build according to their own preferences. This article will introduce you to the basic concepts, installation and use of Flask, and use a simple example to demonstrate how to use Flask to build a web application. What is Flask? Flask is a lightweight web application framework based on Python that does not require the use of any special

Java Email Sending Tutorial: Quick Start and Example Demonstration In recent years, with the popularity and development of the Internet, email has become an indispensable part of people's daily life and work. Sending emails through the Java programming language can not only achieve fast and efficient email sending, but also greatly improve work efficiency through automation. This article will introduce how to use the JavaMail library to send emails in Java and demonstrate it through specific code examples. Step 1: Import and configure the JavaMail library first

With the continuous development of Internet technology, various languages and frameworks have also emerged. As a widely used scripting language, PHP is widely used in website development. Among the PHP frameworks, ThinkPHP is a very excellent framework that provides powerful functions and good performance. Using it can greatly improve the efficiency of website development. In this article, we will introduce you to the introductory tutorial of the ThinkPHP framework to help you quickly master this excellent framework. 1. What is ThinkPHPTh?
