It can actually actually work both ways: cx and cy give "context units",
which by default are between 0 and 1, and go from left-to-right and
top-to-bottom, but can be redefined to be anything.
So, this draws a line from the top-left to the bottom-right.
compose(context(), line([(0cx,0cy), (1cx,1cy)]), stroke("black"))
But I can change the units in the context, it draws a line from the
bottom-left to top-right.
compose(context(units=UnitBox(0,1,1,-1)), line([(0cx,0cy), (1cx,1cy)]),
stroke("black"))
UnitBox defines a new coordinate system in which the top-left corner is (0,
1), and the context is 1 unit wide and 1 unit tall, but the height is given
as "-1", which somewhat unintuitively flips the orientation of the units.
If you look at the bottom of "coord.jl" in Gadfly, you'll see how the
coordinate system for the plot gets set up:
context(units=UnitBox(
coord.xflip ? xmax : xmin,
coord.yflip ? ymin : ymax,
coord.xflip ? -width : width,
coord.yflip ? height : -height,
leftpad=xpadding,
rightpad=xpadding,
toppad=ypadding,
bottompad=ypadding),
On Wednesday, March 11, 2015 at 10:33:35 PM UTC-7, nanaya tachibana wrote:
>
> I wanted to contribute to Gadfly.jl and I started from looking into
> bar.jl.
> I found that the value cy of Measure in Gadfly.jl increases from bottom to
> top, but it increases from top to bottom in Compose.jl.
> What makes Measure work in that way?
>
> I really appreciate any help you can provide.
>
>