Comments (3)
Hi there,
Have you tried playing around with the hjust
aesthetic? It control where along the line text is placed. See also this part of the vignette.
from geomtextpath.
You can set the hjust
to any value between 0 and 1, or you can map it to an aesthetic (we have included scale_hjust_*
functions for this very purpose, which by default dodge labels), or you can even set it to "auto"
library(tidyverse)
library(geomtextpath)
set.seed(2022)
tibble(x = seq(0, 1, 0.01),
a_fairly_long_label = rnorm(x, mean = 0, sd = 1),
b_fairly_long_label = rnorm(x, mean = 0.5, sd = 1)
) %>%
pivot_longer(cols = c(a_fairly_long_label, b_fairly_long_label),
names_to = "group", values_to = "y") %>%
ggplot(aes(x, y, linetype = group)) +
#geom_smooth(se = FALSE) +
geom_labelsmooth(aes(label = group), method = "loess", formula = y ~ x,
se = FALSE, hjust = "auto") +
theme_minimal() +
theme(legend.position = "none")
Created on 2022-02-23 by the reprex package (v2.0.1)
from geomtextpath.
Wow, very good! Thanks for the explanation. For anyone who comes along after and is reading this:
- using hjust = 0.2 will put both labels in this case on the left side of the cross-over.
- using hjust = "auto" in this case puts them at opposite ends as shown above.
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.