Aes

Aes is used to store and access data for plotting

Aes is an InputRange, with named Tuples as elements. The names refer to certain fields, such as x, y, colour etc. If certain fields are not provided then it provides a default value (see DefaultValues).

The fields commonly used are data fields, such as "x" and "y". Which data fields are required depends on the geom* function. By default the named Tuple holds the fields: $(UL

  • "label": Text labels (string)
  • "colour": Identifier for the colour. In general data points with different colour ids get different colours. This can be almost any type. You can also specify the colour by name or cairo.Color type if you want to specify an exact colour (any type that isNumeric, cairo.Color.RGB(A), or can be converted to string)
  • "size": Gives the relative size of points/lineWidth etc.
  • "angle": Angle of printed labels in radians (double)
  • "alpha": Alpha value of the drawn object (double)
  • "mask": Mask the area outside the axes. Prevents you from drawing outside of the area (bool)
  • "fill": Whether to fill the object/holds the alpha value to fill with (double).
  • Members

    Aliases

    extractName
    alias extractName(alias spec) = spec.name
    Undocumented in source.
    extractType
    alias extractType(alias spec) = spec.Type
    Undocumented in source.
    fieldNames
    alias fieldNames = staticMap!(extractName, fieldSpecs)
    Undocumented in source.
    fieldSpecs
    alias fieldSpecs = parseSpecs!Specs
    Undocumented in source.
    sliceSpecs
    alias sliceSpecs(size_t from, size_t to) = staticMap!(expandSpec, fieldSpecs[from..to])
    Undocumented in source.

    Enums

    areBuildCompatibleTuples
    eponymoustemplate areBuildCompatibleTuples(Tup1, Tup2)
    Undocumented in source.
    areCompatibleTuples
    eponymoustemplate areCompatibleTuples(Tup1, Tup2, string op)
    Undocumented in source.
    isBuildable
    eponymoustemplate isBuildable(T, U)
    Undocumented in source.

    Functions

    injectFront
    string injectFront()
    Undocumented in source. Be warned that the author may not have intended to support it.
    injectNamedFields
    string injectNamedFields()
    Undocumented in source. Be warned that the author may not have intended to support it.

    Structs

    Aes
    struct Aes
    Undocumented in source.

    Templates

    FieldSpec
    template FieldSpec(T, string s = "")
    Undocumented in source.
    expandSpec
    template expandSpec(alias spec)
    Undocumented in source.
    isBuildableFrom
    template isBuildableFrom(U)
    Undocumented in source.
    parseSpecs
    template parseSpecs(Specs...)
    Undocumented in source.

    Examples

    Basic Aes usage

    auto aes = Aes!(double[], "x", double[], "y", string[], "colour")([0, 1],
        [2, 1], ["white", "white2"]);
    
    aes.popFront;
    assertEqual(aes.front.y, 1);
    assertEqual(aes.front.colour, "white2");
    
    auto aes2 = Aes!(double[], "x", double[], "y")([0, 1], [2, 1]);
    assertEqual(aes2.front.y, 2);
    
    import std.range : repeat;
    
    auto xs = repeat(0);
    auto aes3 = Aes!(typeof(xs), "x", double[], "y")(xs, [2, 1]);
    
    assertEqual(aes3.front.x, 0);
    aes3.popFront;
    aes3.popFront;
    assertEqual(aes3.empty, true);

    Meta