public auto geomRectangle(AES)(AES aes)

Draw rectangle centered at given x,y location

Aside from x and y also width and height are required. If the type of width is of type Pixel (see aes.d) then dimensions are assumed to be in Pixel (not user coordinates).

public auto geomEllipse(AES)(AES aes)

Draw ellipse centered at given x,y location

Aside from x and y also width and height are required. If the type of width is of type Pixel (see aes.d) then dimensions are assumed to be in Pixel (not user coordinates).

public auto geomTriangle(AES)(AES aes)

Draw triangle centered at given x,y location

Aside from x and y also width and height are required. If the type of width is of type Pixel (see aes.d) then dimensions are assumed to be in Pixel (not user coordinates).

public auto geomDiamond(AES)(AES aes)

Draw diamond centered at given x,y location

Aside from x and y also width and height are required. If the type of width is of type Pixel (see aes.d) then dimensions are assumed to be in Pixel (not user coordinates).

public auto geomPoint(AES)(AES aesRange)

Create points from the data

Example

auto aes = Aes!(double[], "x", double[], "y")([1.0], [2.0]);
auto gl = geomPoint(aes);
gl.popFront;
assert(gl.empty);

public auto geomHist(AES)(
    AES aes, 
    size_t noBins = 0)

Draw histograms based on the x coordinates of the data

public auto geomHist2D(AES)(
    AES aes, 
    size_t noBinsX = 0, 
    size_t noBinsY = 0)

Draw histograms based on the x and y coordinates of the data

Examples

    /// http://blackedder.github.io/ggplotd/images/hist2D.svg
     import std.array : array;
    import std.algorithm : map;
    import std.conv : to;
    import std.range : repeat, iota;
    import std.random : uniform;

    import ggplotd.aes : Aes;
    import ggplotd.colour : colourGradient;
    import ggplotd.colourspace : XYZ;
    import ggplotd.geom : geomHist2D;
    import ggplotd.ggplotd : GGPlotD;

    auto xs = iota(0,500,1).map!((x) => uniform(0.0,5)+uniform(0.0,5))
        .array;
    auto ys = iota(0,500,1).map!((y) => uniform(0.0,5)+uniform(0.0,5))
        .array;
    auto aes = Aes!(typeof(xs), "x", typeof(ys), "y")( xs, ys);
    auto gg = GGPlotD().put( geomHist2D( aes ) );
    // Use a different colour scheme
    gg.put( colourGradient!XYZ( "white-cornflowerBlue-crimson" ) );

    gg.save( "hist2D.svg" );
 
alias geomHist3D = geomHist2D

Deprecated

superseded by geomHist2D

public auto geomAxis(AES)(
    AES aesRaw, 
    double tickLength, 
    string label)

Draw axis, first and last location are start/finish others are ticks (perpendicular)

private auto limits(RANGE)(
    RANGE range, 
    double[] alphas)

Return the limits indicated with different alphas

public auto geomBox(AES)(AES aesRange)

Draw a boxplot. The "x" data is used. If labels are given then the data is grouped by the label

Example

import std.array : array;
import std.algorithm : map;
import std.range : repeat, iota, chain, zip;
import std.random : uniform;
auto xs = iota(0,50,1).map!((x) => uniform(0.0,5)+uniform(0.0,5)).array;
auto cols = "a".repeat(25).chain("b".repeat(25)).array;
auto aesRange = zip(xs, cols)
    .map!((a) => aes!("x", "colour", "fill", "label")(a[0], a[1], 0.45, a[1]));
auto gb = geomBox( aesRange );
assertEqual( gb.front.xStore.min(), -0.4 );

public auto geomPolygon(AES)(AES aes)

Draw a polygon

public auto geomDensity(AES)(AES aes)

Draw kernel density based on the x coordinates of the data

Examples

    /// http://blackedder.github.io/ggplotd/images/filled_density.svg
    import std.array : array;
    import std.algorithm : map;
    import std.range : repeat, iota, chain;
    import std.random : uniform;

    import ggplotd.aes : Aes;
    import ggplotd.geom : geomDensity;
    import ggplotd.ggplotd : GGPlotD;
    import ggplotd.legend : discreteLegend;
    auto xs = iota(0,50,1).map!((x) => uniform(0.0,5)+uniform(0.0,5)).array;
    auto cols = "a".repeat(25).chain("b".repeat(25));
    auto aes = Aes!(typeof(xs), "x", typeof(cols), "colour", 
        double[], "fill" )( 
            xs, cols, 0.45.repeat(xs.length).array);
    auto gg = GGPlotD().put( geomDensity( aes ) );
    gg.put(discreteLegend);
    gg.save( "filled_density.svg" );
 
public auto geomDensity2D(AES)(AES aes)

Draw kernel density based on the x and y coordinates of the data

Examples

    /// http://blackedder.github.io/ggplotd/images/density2D.png
    import std.array : array;
    import std.algorithm : map;
    import std.conv : to;
    import std.range : repeat, iota;
    import std.random : uniform;

    import ggplotd.aes : Aes;
    import ggplotd.colour : colourGradient;
    import ggplotd.colourspace : XYZ;
    import ggplotd.geom : geomDensity2D;
    import ggplotd.ggplotd : GGPlotD;
    import ggplotd.legend : continuousLegend;

    auto xs = iota(0,500,1).map!((x) => uniform(0.0,5)+uniform(0.0,5))
        .array;
    auto ys = iota(0,500,1).map!((y) => uniform(0.5,1.5)+uniform(0.5,1.5))
        .array;
    auto aes = Aes!(typeof(xs), "x", typeof(ys), "y")( xs, ys);
    auto gg = GGPlotD().put( geomDensity2D( aes ) );
    // Use a different colour scheme
    gg.put( colourGradient!XYZ( "white-cornflowerBlue-crimson" ) );
    gg.put(continuousLegend);

    gg.save( "density2D.png" );
 

Aliases

geomHist3D
geomHist2D

Functions

autogeomRectangle

Draw rectangle centered at given x,y location

autogeomEllipse

Draw ellipse centered at given x,y location

autogeomTriangle

Draw triangle centered at given x,y location

autogeomDiamond

Draw diamond centered at given x,y location

autogeomPoint

Create points from the data

autogeomHist

Draw histograms based on the x coordinates of the data

autogeomHist2D

Draw histograms based on the x and y coordinates of the data

autogeomAxis

Draw axis, first and last location are start/finish others are ticks (perpendicular)

private, autolimits

Return the limits indicated with different alphas

autogeomBox

Draw a boxplot. The "x" data is used. If labels are given then the data is grouped by the label

autogeomPolygon

Draw a polygon

autogeomDensity

Draw kernel density based on the x coordinates of the data

autogeomDensity2D

Draw kernel density based on the x and y coordinates of the data

Structs

Geom

Hold the data needed to draw to a plot context

Templates

geomShape

General function for drawing geomShapes

geomType

Draw any type of geom

geomLine

Create lines from data

geomLabel

Draw Label at given x and y position