- gnuplot Cookbook
- Lee Phillips
- 367字
- 2021-08-20 15:42:54
Making a scatterplot
If you are in possession of a collection of measurements that, as is usually the case, is subject to random errors, an attempt to simply plot a curve through the measurements may result in a chaotic graph that will be difficult to interpret. In these cases, one usually begins with a scatterplot, which is simply a plot of a dot or small symbol at each data point. An examination of such a plot often leads to the discovery of correlations or patterns.

Getting ready
To make this recipe interesting, we need some slightly random-looking data. You may have some available, in which case you merely need to ensure that it is in a format that gnuplot can read. Simply arrange the data so that each line of the file contains one data point with space-separated x and y values:
x1 y1 x2 y2 ...
Then name the file scatter.dat
.
If you don't have such a file of your own handy, use the one called scatter.dat
that we have provided. Make sure that the file is in the directory in which you have started gnuplot, so that the program can find it.
How to do it…
Now simply tell gnuplot:
plot 'scatter.dat' with points pt 7
If you are using the file we provided, you will get a plot similar to the one shown in the previous figure.
There's more…
You can plot the points using different symbols. Try plot 'scatter.dat' with dots
to get the smallest dot available to your terminal. For use with scatterplots of very large datasets, try the following command:
plot 'scatter.dat' with points pt n
With different integers for n
. pt
stands for pointtype, and the different pointtypes available are dependent on your terminal. Simply type test
in gnuplot to see a demonstration of all the pointtypes available for the currently selected terminal. You can find more about point and line styles in Chapter 3, Applying Colors and Styles.
- 大數據技術基礎
- 計算機綜合設計實驗指導
- 數據挖掘原理與實踐
- Voice Application Development for Android
- 圖解機器學習算法
- Hadoop大數據實戰(zhàn)權威指南(第2版)
- 一個64位操作系統(tǒng)的設計與實現
- Power BI商業(yè)數據分析完全自學教程
- 深入淺出Greenplum分布式數據庫:原理、架構和代碼分析
- Oracle PL/SQL實例精解(原書第5版)
- 新基建:數據中心創(chuàng)新之路
- 科研統(tǒng)計思維與方法:SPSS實戰(zhàn)
- Construct 2 Game Development by Example
- 跨領域信息交換方法與技術(第二版)
- Web Services Testing with soapUI