Gnuplot-painting tool in Linux

Source: Internet
Author: User
Gnuplot is a free plotting tool that can be ported to various mainstream platforms. It can be operated in one of the following two modes: When you need to adjust and modify the chart for normal display, you can operate the tool in interactive mode by issuing a command at the gnuplot prompt. Alternatively, gnuplot can read commands from the file and generate charts in batch mode.
Beat "gnuplot" in the shell and enter the gnuplot editing environment.
Basic commands:
1. Set terminal postscript
Set Terminal
2. Set xlabel 'x-date'
The X axis is named "X-date"
3. Set title "Demo"
The image name is "Demo"
4. Set key top left
Set key box
Set the legend position and shape
5. Set output '/test/AA. Ps'
Set the file directory to which the image is saved
6. Set xdata time
Set timefmt "% H: % m: % s"
Set format X "% H: % m: % s"
Format X axis data
7. Plot ["17:39:31": "17:50:48"] '/var/log/DNS. log' using title "test" with lines linetype 1
Drawing. The starting point of X coordinate is "17:39:31", the ending point is "17:50:48", and the source file is '/var/log/DNS. log', draw a line chart using the data of the first and second columns of the file

8. Example:
Set xlabel 'x-time'
Set ylabel 'Y-%'
Set mxtics 1
Set title "CPU data analysis"
Set key top left
Set key box
Set term post EPS color solid ENH
Set output '/export/home/Nancy/CPU. EPS'
Set xdata time
Set timefmt "% H: % m: % s"
Set format X "% H: % m: % s"
Plot ["17:39:31": "17:50:48"] '/export/home/Nancy/CPU' using title "USR" with line
S linecolor RGB "yellow", '/export/home/Nancy/CPU' using title "sys" with line linecolor R
GB "red", '/export/home/Nancy/CPU' using :4 title "W" with line linecolor RGB "blue", '/Expo
RT/home/Nancy/CPU 'using 1:5 title "idle" with line linecolor RGB "green"

9. Run the script directly.
Write the commands in 8 to the *. PLT file. You can use gnuplot> load 'a. PLT '. If you only want to generate the PS or EPS file, you can directly run gnuplot A. PLT in shell.

10. ps and EPS
PS: generate a PFT File
EPS: can be directly inserted into the word/execel file.

11. There is still a small problem that has not been solved --- solved, update example (8)
How can I use different colors to differentiate multiple lines in a graph?

12. Useful articles
Http://www.ibm.com/developerworks/cn/linux/l-gnuplot/index.html
Http://cycloid.blog.163.com/blog/static/8847862006823102056295/
Http://dsec.pku.edu.cn/dsectest/dsec_cn/gnuplot/ (gnuplot Chinese manual)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.