Comments (5)
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.
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.
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.
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.
This enhancement is being archived as it forms part of a later thread, where it is linked for reference.
from geomtextpath.
Related Issues (20)
- geom_labelsf() not recognizing aesthetics HOT 5
- While working with ragg, minuses aren't drawn HOT 2
- geom_textpath() always draw a empty box when label is ""
- Ignoring unknown parameters: text_smoothing HOT 10
- Feature request - multiple labels per line HOT 7
- geom_textsmooth computation fails if method argument is not specified HOT 3
- ggplot2 is separating size and linewidth HOT 2
- Negative values in geom_textcontour not appearing HOT 1
- geom_textlinerange HOT 1
- Question on angle HOT 1
- text_only in geom_labelsegment
- Feature request - avoid text overlapping
- two labels on same curve HOT 5
- straight argument unknown in geom_textsf() HOT 2
- `label` aesthetic in `geom_textdensity2d` HOT 2
- R 4.3.0 and glyphs 👀 HOT 1
- Can't get things to work HOT 11
- vjust and hjust as aesthetics in geom_textsf HOT 3
- Different behavior for line breaks when there's no data
- geomtextline not accommodating RGBA colors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geomtextpath.