#include <stdio.h>
#include <gd.h>
Include dependency graph for gd_graph.h:
Go to the source code of this file.
Defines | |
#define | NUM_COLORS 8 |
#define | gdgGetGD(gdg) gdg->im |
Typedefs | |
typedef enum gdgBar | gdgBarType |
Enumerations | |
enum | gdgMarker { FILLED_SQUARE, OPEN_SQUARE, POINT, HORIZONTAL_CROSS, DIAGONAL_CROSS, OPEN_TRIANGLE, FILLED_TRIANGLE, OPEN_UTRIANGLE, FILLED_UTRIANGLE, FILLED_CIRCLE, OPEN_CIRCLE, AUTO_MARKER } |
enum | gdgBar { FILLED, OPEN, OUTLINE } |
Functions | |
gdgImagePtr | gdgCreatePlot (int width, int height) |
allocate memory needed for plotting | |
void | gdgImageDestroy (gdgImagePtr gdg) |
free all memory associated with the plot | |
void | gdgSetColorMap (int map) |
void | gdgSetLegend (gdgImagePtr gdg, char **legends) |
void | gdgSetYLabel (gdgImagePtr gdg, char *ylabel) |
void | gdgSetXLabel (gdgImagePtr gdg, char *xlabel) |
void | gdgSetTitle (gdgImagePtr gdg, char *title) |
void | gdgSetMarker (gdgImagePtr gdg, gdgMarkerType marker) |
void | gdgSetBar (gdgImagePtr gdg, gdgBarType bar) |
void | gdgSetMarkerSize (gdgImagePtr gdg, int size) |
void | gdgSetUseLine (int val) |
void | gdgSetNoSort (int val) |
int | gdgGetColor (const gdgImagePtr gdg, const char *color) |
void | gdgImage2DPlot (gdgImagePtr gdg, int numPoints, double *x, double *y, int markerColor, int lineColor) |
void | gdgImageHist (gdgImagePtr gdg, int numPoints, double *x, int maxBreaks, int noYscale, int color) |
void | gdgImageHeat (gdgImagePtr gdg, int numRows, int numCols, double **matrix, char **xlabels, char **ylabels, double squishWithin, int autoCenter) |
void | gdgImagePng (gdgImagePtr gdg, FILE *out) |
writes the current plot as a png to out | |
void | gdgImageJpeg (gdgImagePtr gdg, FILE *out, int quality) |
writes the current plot as a jpeg to out |
The main functions in libwebplot are gdgImage2DPlot(), gdgImageHist(), gdgImageHeat(). After calling one of these functions, you can call gdgImagePng() to generate the image file. All of the other functions are for adding legends, axis, labels, and other plot customizations.
Note that png is the currently the only available image file type. jpeg support will be coming shortly.
|
get the gdImagePtr for creating custom colors or customizing the plot in anyway |
|
available markers for the points on a graph; some perform much better than others at various tasks |
|
available formats for histogram bars |
|
available formats for histogram bars |
|
|
provides a way to retrieve built-in colors (eg gdgGetColor("red") will return the integer for red); available colors are: red, blue, green, magenta, cyan, chartreuse, yellow, chocolate, orange, gray, lightGrayThe built in functions are case sensitive. |
|
plots x vs y; if markerColor < 0 or lineColor < 0, the color is chosen automatically. You can call this many times be for you call gdgImagePng() or gdgImageJpeg() and all of the data you submit will be plotted in the reverse order that you submitted it. |
|
creates a heat plot of matrix; maximum number of unique colors is 256. There are currently three colormaps; a microarray style green to red, a more color blind friendly blue to red, and a grayScale. The color map is set with gdgSetColorMap(). If xlabels or ylabels are provided they MUST equal to numCols and numRows respectively. Note that extremely long names can drastically reduce the amount of space available to create the heat plot, and your plot size choice should take this into consideration. |
|
plots a histogram of x using maxBreaks divisions of the data; if noYscale is true, it forces the minimum point on the Y axis to be 0, otherwise the y-axis is scaled to maximally show the differences amongst the histogram bins; color is the color used in drawing the bar (you either need to create a color using gdgGetGD() and the color creation functions in gd or retrieve one of the default colors from gdgGetColor() ) |
|
writes the current plot as a jpeg to out This function is currently not working, but will be fixed soon. |
|
set the histogram bar to a new type (default is OPEN) |
|
sets the color map used for a heat map. |
|
used for scatterplots if you want a legend at the bottom of the plot. Particularly useful when you are plotting multiple things on the same plot. legends must be the same size as the number of plots you've made. The programmer is reponsible for freeing legends, and a local copy is NOT made (so don't free this before you call gdgImagePng() ) |
|
set the marker to a new type (default is FILLED_SQUARE) |
|
size of marker in pixels; note this function has no effect on marker type POINT, which is only 1 pixel in size |
|
don't sort the data. only used when drawing line plots. This will cause the line connecting data points to be drawn in the order the data points are in the original array passed to gdg2DImagePlot() (this is not usually what you want, unless you have sorted the data yourself) |
|
set graph title |
|
set true if you want the graph to draw a line connecting your points. If you don't want a visible marker, call gdgSetMarker(gdg, POINT) |
|
set label for the x axis |
|
set label for the y axis |