ggplotd - curve colour
brocolis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun May 8 19:29:47 PDT 2016
Is this correct usage?
auto gg = GGPlotD().put( geomLine( Aes!(typeof(xs), "x",
typeof(ysfit), "y", string, "colour")( xs, ysfit, "red") ) );
The output is a blank png file.
Full source:
import ggplotd.ggplotd;
import ggplotd.geom;
import ggplotd.aes;
import ggplotd.axes;
void main()
{
import std.array : array;
import std.algorithm : map;
import std.range : iota;
import ggplotd.colour;
auto f = (double x) { return x; };
auto xs = iota(-5, 5, 0.1 ).array;
auto ysfit = xs.map!((x) => f(x)).array;
auto gg = GGPlotD().put( geomLine( Aes!(typeof(xs), "x",
typeof(ysfit), "y", string, "colour")( xs, ysfit, "red") ) );
gg.put( xaxisOffset( 0) ).put( yaxisOffset( 0) );
gg.save( "axes.png", 500, 300 );
}
More information about the Digitalmars-d-learn
mailing list