Chapter 7. Programming gnuplot and Dealing with Data

This chapter contains the following recipes:

  • Scripting gnuplot with its own language
  • Plotting on subintervals
  • Smoothing your data
  • Fitting functions to your data
  • Using kdensity smoothing to improve on histograms [new]
  • Creating a cumulative distribution [new]
  • Talking to gnuplot with C
  • Scripting gnuplot with Python
  • Plotting with Clojure
  • Handling volatile data [new]

Introduction

Up to now our style of interacting with gnuplot has mainly been to have an interactive conversation at the terminal, or to create a linear sequence of commands that can be read in and executed by typing gnuplot file. We went beyond this a bit in the previous chapter, where we learned how to arrange for a document preparation system to invoke gnuplot automatically. In this chapter, we shall learn how to leverage the full power of gnuplot as a programmable graphing engine. This is made possible by gnuplot's design as a program that can be completely controlled by textual commands, rather than by a limited graphical user interface. This means that any programming language that can send text to a process or socket can send commands to gnuplot. The result is that there are libraries for interfacing with gnuplot in almost every high-level programming or scripting language, and even in cases where no library is available it is straightforward to communicate manually from within your program, as we shall see. In addition, gnuplot's own built-in scripting language contains enough programming constructs to allow significant automation without the use of another language.

Another set of topics we visit in this chapter are gnuplot's built-in smoothing algorithms, including two immensely useful types of statistical plots that are new in version 4.4. We end the chapter with a recipe introducing gnuplot's new ability to deal gracefully with data that may be changing under your feet as you try to work with it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.184.102