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:
- 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:
- Set title"Simple Funcrion Plot"
- Set xrange [-3: 3]
- Set yrange [-1: 1]
- Set xlabel"Theta"
- Set ylabel"Sin (theta )"
- Set label"Sin (1, 0.0 )"At 0.0, 0.0
- Plot sin (x)
The running result is as follows:
3. Save the data image to a file using a 3-D drawing.
- Set title"A Simple Function to splot"/* Title */
- Set xrange [-4: 4]/* X-axis range */
- Set yrange [-4: 4]/* Y-axis range */
- Set ylabelY-AXES"/* X axis mark */
- Set xlabelX-AXES"/* Y-axis mark */
- Set isosample 40/* Set the grid line density of the image, that is, the sample density of the image */
- Set hidden/* Eliminate hidden lines */
- Set terminal png/* Terminal controls the output format and file output format */
- Set output"Plot.png"/* Specify the output name of the image */
- Splot sin (x) * cos (y)/* Splot 3-D plot function */
4. Multi-graph Mode
- /*
- In the multi-graph mode, use the layout function for partitioning, similar to subplot.
- */
- Set multiplot layout 1, 2 rowsfirst title"Example Multiplot"
- Set title"Top"
- Set hidden
- Set isosample 40
- Splot [x =-4:4] [y =-4:4] sin (x) * cos (y)
- Set title"Down"
- Set hidden
- Set isosample 10
- Set xrange [-3: 3]
- Set yrange [-1: 1]
- Set xlabel"X"
- Set ylabel"Sin (X )"
- Plot sin (x)