You could define an approximation directly in gnuplot like this:
Q(a,x) = 1. - igamma(a,x)However this has inherently limited precision as igamma(a,x) approaches 1. If you need a more accurate implementation, it would be better to provide one via a plugin (see below). Once imported, the function can be used just as any other built-in or user-defined function in gnuplot. See import (p. ).
The gnuplot distribution includes source code and instructions for creating a plugin library in the directory demo/plugin. You can modify the simple example file demo_plugin.c by replacing one or more of the toy example functions with an implementation of the function you are interested in. This could include invocation of functions from an external mathematical library.
The demo/plugin directory also contains source for a plugin that implements Q(a,x). As noted above, this plugin allows earlier versions of gnuplot to provide the same function uigamma as the current development version.
import Q(a,x) from "uigamma_plugin" uigamma(a,x) = ((x<1 || x<a) ? 1.0-igamma(a,x) : Q(a,x))