Giter Site home page Giter Site logo

Comments (2)

Mattriks avatar Mattriks commented on June 16, 2024

I can't tell whether you think the circle or rectangle (or both) are "inconsistent".
In Compose.jl, circles are always circles (this behaviour is useful for plotting e.g. in Gadfly.jl you can change the size of image to fit your publication, and still get point circles). The radius defaults to cx units, but you can change to cy as shown below (or other units). Other forms should behave as you expect: e.g. in both your images the rectangle is drawn relative to the UnitBox coordinates. So both the rectangles and circles are correct as designed.
Two notes:

  • The circle didn't get clipped in your second image: did you convert the svg to png in another program?
  • Compose also has a fourth type of unit (sx,sy) (#409). Unfortunately the docs have not been deploying correctly (#410), but the info can be found in the doc md files.
gridf(xs, ys, args...) = (context(),
 line([[(x, 0h), (x, 1h)] for x in xs]), line([[(0w, y), (1w, y)] for y in ys]), args..., linewidth(0.1mm))

c3 = compose(context(units=UnitBox(-2., -2., 4., 4.)),
    gridf(-2:2, -2:2, stroke("gray")),
#    (context(), rectangle(-1, -1, 2, 2), fill("red")),
    circle([0], [0], [1.5cx, 1.5cy]), fill(["deepskyblue","coral"])
)
draw(PNG("Comp431.png", 10cm, 5cm), c3)

Comp431

from compose.jl.

etiennedeg avatar etiennedeg commented on June 16, 2024

Indeed, my circles are clipped in svg, this is due to conversion to png.
Ok, I didn't see that there were absolute and relative coordinates, I should have read the documentation more carefully.
I understand the rationale, but it still feels weird that the circle favors the x coordinate.

from compose.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.