Figure

A container form for one or more Plot objects.

class Figure : FigureBase {}

Constructors

this
this()
Undocumented in source.
this
this(Plot[] plots)
Undocumented in source.

Members

Functions

addLines
This addLines(FigureLine[] lines)

Add individual lines to the figure. Coordinates are specified relative to the plot area, not in pixels. The lines are is clipped to the visible part of the plot area. This is useful for adding annotation lines, as opposed to plot lines.

addPlot
This addPlot(Plot[] plots)
This addPlot(P[] plots)

Add one or more plots to the figure.

axesFont
Font axesFont()
axesFont
This axesFont(Font newFont)
bottomMost
double bottomMost()

The bottommost point on the figure.

clipLine
bool clipLine(double x1, double y1, double x2, double y2)
Undocumented in source. Be warned that the author may not have intended to support it.
clipRectangle
bool clipRectangle(double x, double y, double width, double height)
Undocumented in source. Be warned that the author may not have intended to support it.
defaultWindowHeight
int defaultWindowHeight()
Undocumented in source. Be warned that the author may not have intended to support it.
defaultWindowWidth
int defaultWindowWidth()
Undocumented in source. Be warned that the author may not have intended to support it.
defaultXTick
This defaultXTick()

Resets the X tick labels to the default, effectively undoing a call to xTickLabels.

defaultYTick
This defaultYTick()

Resets the X tick labels to the default, effectively undoing a call to xTickLabels.

defaultZoom
This defaultZoom()

Set the zoom back to the default value, i.e. just large enough to fit everything on the screen.

drawClippedLine
void drawClippedLine(Pen pen, PlotPoint from, PlotPoint to)
Undocumented in source. Be warned that the author may not have intended to support it.
drawClippedRectangle
void drawClippedRectangle(Pen pen, double x, double y, double width, double height)
Undocumented in source. Be warned that the author may not have intended to support it.
drawClippedRectangle
void drawClippedRectangle(Pen pen, PlotRect r)
Undocumented in source. Be warned that the author may not have intended to support it.
drawClippedText
void drawClippedText(string text, Font font, Color pointColor, PlotRect rect)
Undocumented in source. Be warned that the author may not have intended to support it.
drawImpl
void drawImpl()

Draw the plot but don't display it on screen.

fillClippedRectangle
void fillClippedRectangle(Brush brush, double x, double y, double width, double height)
Undocumented in source. Be warned that the author may not have intended to support it.
fillClippedRectangle
void fillClippedRectangle(Brush brush, PlotRect rect)
Undocumented in source. Be warned that the author may not have intended to support it.
gridIntensity
ubyte gridIntensity()

Grid intensity from zero (pure white) to 255 (pure black).

gridIntensity
This gridIntensity(ubyte newIntensity)

Setter.

horizontalGrid
bool horizontalGrid()

Determines whether horizontal gridlines are drawn. Default is false.

horizontalGrid
This horizontalGrid(bool val)
insideAxes
bool insideAxes(PlotPoint point)
Undocumented in source. Be warned that the author may not have intended to support it.
leftMost
double leftMost()

The leftmost point on the figure.

legendFont
Font legendFont()
legendFont
This legendFont(Font newFont)
legendLocation
LegendLocation legendLocation()
legendLocation
This legendLocation(LegendLocation newLoc)
minWindowHeight
int minWindowHeight()
Undocumented in source. Be warned that the author may not have intended to support it.
minWindowWidth
int minWindowWidth()
Undocumented in source. Be warned that the author may not have intended to support it.
removePlot
This removePlot(Plot[] plots)
This removePlot(P[] plots)

Remove one or more plots from the figure. If the plots are not in the figure, they are silently ignored.

rightMost
double rightMost()

The rightmost point on the figure.

rotatedXTick
bool rotatedXTick()

Determines whether rotated text is used for the X tick labels.

rotatedXTick
This rotatedXTick(bool newVal)

Setter

rotatedYTick
bool rotatedYTick()

Determines whether rotated text is used for the Y tick labels.

rotatedYTick
This rotatedYTick(bool newVal)

Setter

showUsingImplicitMain
void showUsingImplicitMain()
Undocumented in source. Be warned that the author may not have intended to support it.
topMost
double topMost()

The topmost point on the figure.

verticalGrid
bool verticalGrid()

Determines whether vertical gridlines are drawn. Default is false.

verticalGrid
This verticalGrid(bool val)
xLim
This xLim(double newLower, double newUpper)

Manually set the X axis limits.

xTickLabels
This xTickLabels(R locations, string[] text, Color[] colors)

Set the X axis labels. If text is null (default) the axis text is just the text of the axis locations. R should be any range with length identical to text (unless text is null) and elements implicitly convertible to double. If colors is empty, all labels will be made black. Otherwise it must be the same length as locations.

yLim
This yLim(double newLower, double newUpper)

Manually set the Y axis limits.

yTickLabels
This yTickLabels(R locations, string[] text, Color[] colors)

Set the Y axis labels. If text is null (default) the axis text is just the text of the axis locations. R should be any range with length identical to text (unless text is null) and elements implicitly convertible to double. If colors is empty, all labels will be made black. Otherwise it must be the same length as locations.

Static functions

between
bool between(T num, U lower, V upper)
Undocumented in source. Be warned that the author may not have intended to support it.
opCall
Figure opCall()
opCall
Figure opCall(Plot[] plots)
Figure opCall(P[] plots)

Convenience factory that adds all plots provided to the Figure.

Variables

bottomMargin
double bottomMargin;
Undocumented in source.
leftMargin
double leftMargin;
Undocumented in source.
plotData
Plot[] plotData;
Undocumented in source.
rightMargin
double rightMargin;
Undocumented in source.
topMargin
double topMargin;
Undocumented in source.
xAxisLocations
double[] xAxisLocations;
Undocumented in source.
xAxisText
string[] xAxisText;
Undocumented in source.
yAxisLocations
double[] yAxisLocations;
Undocumented in source.
yAxisText
string[] yAxisText;
Undocumented in source.

Inherited Members

From FigureBase

fontSizeAdjust
enum fontSizeAdjust;
Undocumented in source.
context
Context context;
Undocumented in source.
drawLine
void drawLine(Pen pen, double startX, double startY, double endX, double endY)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLine
void drawLine(Pen pen, PlotPoint start, PlotPoint end)
Undocumented in source. Be warned that the author may not have intended to support it.
drawRectangle
void drawRectangle(Pen pen, double x, double y, double width, double height)
Undocumented in source. Be warned that the author may not have intended to support it.
drawRectangle
void drawRectangle(Pen pen, Rect r)
Undocumented in source. Be warned that the author may not have intended to support it.
fillRectangle
void fillRectangle(Brush brush, double x, double y, double width, double height)
Undocumented in source. Be warned that the author may not have intended to support it.
fillRectangle
void fillRectangle(Brush brush, Rect r)
Undocumented in source. Be warned that the author may not have intended to support it.
drawText
void drawText(string text, Font font, Color pointColor, PlotRect rect, TextAlignment alignment)
Undocumented in source. Be warned that the author may not have intended to support it.
drawTextCurrentContext
void drawTextCurrentContext(string text, Font font, Color pointColor, PlotRect rect, TextAlignment alignment)
Undocumented in source. Be warned that the author may not have intended to support it.
drawText
void drawText(string text, Font font, Color pointColor, PlotRect rect)
Undocumented in source. Be warned that the author may not have intended to support it.
drawRotatedText
void drawRotatedText(string text, Font font, Color pointColor, PlotRect rect, TextAlignment alignment)
Undocumented in source. Be warned that the author may not have intended to support it.
drawRotatedText
void drawRotatedText(string text, Font font, Color pointColor, PlotRect rect)
Undocumented in source. Be warned that the author may not have intended to support it.
measureText
PlotSize measureText(string text, Font font, double maxWidth, TextAlignment alignment)
Undocumented in source. Be warned that the author may not have intended to support it.
measureText
PlotSize measureText(string text, Font font, double maxWidth)
Undocumented in source. Be warned that the author may not have intended to support it.
measureText
PlotSize measureText(string text, Font font)
Undocumented in source. Be warned that the author may not have intended to support it.
getBrush
Brush getBrush(Color color)
Undocumented in source. Be warned that the author may not have intended to support it.
getPen
Pen getPen(Color color, double width)
Undocumented in source. Be warned that the author may not have intended to support it.
drawTo
void drawTo(Context context)
Undocumented in source. Be warned that the author may not have intended to support it.
drawTo
void drawTo(Context context, double width, double height)
Undocumented in source. Be warned that the author may not have intended to support it.
drawTo
void drawTo(Context context, PlotRect whereToDraw)
Undocumented in source. Be warned that the author may not have intended to support it.
saveToFile
void saveToFile(string filename, string type, double width, double height)

Saves this figure to a file. The file type can be one of either the raster formats .png, .jpg, .tiff, and .bmp, or the vector formats .pdf, .svg and .eps. The width and height parameters allow you to specify explicit width and height parameters for the image file. If width and height are left at their default values of 0, the default width and height of the subclass being saved will be used.

saveToFile
void saveToFile(string filename, double width, double height)

Convenience function that infers the type from the filename extenstion and defaults to .png if no valid file format extension is found.

toWidget
FigureWidget toWidget()

Creates a Widget that will have this object drawn to it. This Widget can be displayed in a window.

showAsMain
void showAsMain()

Draw and display the figure as a main form. This is useful in otherwise console-based apps that want to display a few plots. However, you can't have another main form up at the same time.

getDefaultWindow
gtk.Window.Window getDefaultWindow()

Returns a default plot window with this figure in it.

Examples

auto nums = [1,1,1,1,2,2,3,3,4,5,6,7];
auto hist = Histogram(nums, 10);
auto fig = new Figure;
fig.addPllot(hist);
fig.title = "A plot";
fig.xLabel = "X label";
fig.yLabel = "Y label";
fig.showAsMain();

Meta