Use Gnuplot in Ubuntu to visualize data

Source: Internet
Author: User
GNU/Linux provides many open-source solutions for data visualization. These solutions not only convert data into charts and specific images, but also filter and streamline the data to make it more useful. Gnuplot is one of the oldest visualization programs and is also the best to use. Today, I saw it in GNU/LINUX environment programming. After learning it, let's take a study note. 1. Install Gnuplot. If your computer does not have Gnuplot, run the following command to install it: s

GNU/Linux provides many open-source solutions for data visualization. These solutions not only convert data into charts and specific images, but also filter and streamline the data to make it more useful. Gnuplot is one of the oldest visualization programs and is also the best to use. Today, I saw it in GNU/LINUX environment programming. After learning it, let's take a study note.

1. Install Gnuplot

If your computer does not have Gnuplot, run the following command to install it:

  1. Sudo apt-get install gnuplot
After the installation is complete, run the command: gnuplot to enter its interface.


2. Simple plotting

Command:> plot sin (x)

The sin (x) image can be easily drawn, which is similar to the plot usage of MATLAB. You can also use set to modify some image parameters. The procedure is as follows:

  1. Set title"Simple Funcrion Plot"
  2. Set xrange [-3: 3]
  3. Set yrange [-1: 1]
  4. Set xlabel"Theta"
  5. Set ylabel"Sin (theta )"
  6. Set label"Sin (1, 0.0 )"At 0.0, 0.0
  7. Plot sin (x)

The running result is as follows:



3. Save the data image to a file using a 3-D drawing.

  1. Set title"A Simple Function to splot"/* Title */
  2. Set xrange [-4: 4]/* X-axis range */
  3. Set yrange [-4: 4]/* Y-axis range */
  4. Set ylabelY-AXES"/* X axis mark */
  5. Set xlabelX-AXES"/* Y-axis mark */
  6. Set isosample 40/* Set the grid line density of the image, that is, the sample density of the image */
  7. Set hidden/* Eliminate hidden lines */
  8. Set terminal png/* Terminal controls the output format and file output format */
  9. Set output"Plot.png"/* Specify the output name of the image */
  10. Splot sin (x) * cos (y)/* Splot 3-D plot function */

4. Multi-graph Mode

  1. /* 
  2. In the multi-graph mode, use the layout function for partitioning, similar to subplot. 
  3. */
  4. Set multiplot layout 1, 2 rowsfirst title"Example Multiplot"
  5. Set title"Top"
  6. Set hidden
  7. Set isosample 40
  8. Splot [x =-4:4] [y =-4:4] sin (x) * cos (y)
  9. Set title"Down"
  10. Set hidden
  11. Set isosample 10
  12. Set xrange [-3: 3]
  13. Set yrange [-1: 1]
  14. Set xlabel"X"
  15. Set ylabel"Sin (X )"
  16. Plot sin (x)

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.