Giter Club home page Giter Club logo

Comments (5)

teunbrand avatar teunbrand commented on July 24, 2024

I think this is pretty nice and might have some use cases, but I'm questioning whether this should be a geom or a position adjustment. I don't foresee any problems that don't happen in Cartesian coordinates, but I do wonder if this only has a use case in non-Cartesian coordinates.

Similar to how geom_path() can be reparametrised into [x, y, xend, yend] in geom_segment() and vice versa, I do feel that alternative parametrisations might be useful in general. We could design some parametrisation that has a use cases in Cartesian coordinates too.

from geomtextpath.

AllanCameron avatar AllanCameron commented on July 24, 2024

You're right - it does only do something useful in polar co-ordinates. I do think there is an occasional need for something like this though - see for example this SO question and this other one. It would be great if we could get this to work as just a position adjustment, but I can't immediately see how that would work, since it involves passing row-wise data rather than vertically grouped data.

The implementation above is just a reparameterisation of geom_textpath, similar to the way that geom_line or geom_segment are created, but based on your comments I should probably focus on getting the main geom_textpath to work properly first, so that we can have something simple that works well and that we can build on.

from geomtextpath.

teunbrand avatar teunbrand commented on July 24, 2024

I agree that it is useful to have, but I'm wondering whether there is an opportunity here to kill two birds with one stone. I haven't fully fleshed out anything yet, but I was thinking along the following lines.

  • We could make a geom_textsegment() for placing text on a line segment parametrised by [x, y, xend, yend].
  • We could also make a geom_textspoke() for placing text on some line segment parametrised by [x, y, angle, (length?)].

I imagine in both cases that the line pieces become curves in polar coordinates and because the line pieces are straight in cartesian coordinates, we can extend the hjust() parameters to beyond the [0, 1] interval as these are easily extrapolated (in contrast to non-straight curves).

The case you presented above would then be a geom_textspoke() wherein the (default) angle is 0.

from geomtextpath.

teunbrand avatar teunbrand commented on July 24, 2024

Come to think of it, we could probably also make a geom_textspline() based on our answers here: https://stackoverflow.com/q/68786700/11374827.

from geomtextpath.

AllanCameron avatar AllanCameron commented on July 24, 2024

This enhancement is being archived as it forms part of a later thread, where it is linked for reference.

from geomtextpath.

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.