Comments (5)
Hi there,
Thanks for reporting the issue, I can confirm that this isn't currently handled as you'd expect. I'd know how to activate the text parameters, but I'm not sure how I'd go about the fill
aesthetic, since it is ambiguous whether it should apply to the label or the fill of potential polygons in the geometry. @AllanCameron, you probably have a better idea how this works than I do, should we make a box_fill
aesthetic that defaults to the fill
aesthetic?
from geomtextpath.
The aesthetics work a bit differently within the sf geoms, and as Teun says, the fill
aesthetic is already used. Instead, I used a boxfill
aesthetic for geom_labelsf
, which probably isn't documented very well. Having text_only
is also ambiguous when you have collections of linestrings and polygons - what exactly would you leave out the plot?
However, it is possible to achieve what you want using the current version without much trouble:
library(tidyverse)
library(sf)
#> Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE
library(geomtextpath)
sample_coords <- tibble(
x = c(43.00778, 42.99675),
y = c(-87.94263, -87.90710)
) %>%
st_as_sf(coords = c("y", "x"), crs = 4326) %>%
summarise() %>%
st_cast(., "LINESTRING")
sample_coords %>%
ggplot() +
geom_labelsf(label = "Label", boxfill = "red",
linewidth = 0)
Created on 2022-03-02 by the reprex package (v2.0.1)
from geomtextpath.
Ah, got it. I only included the text_only
piece as an example, but the real thing I was trying to do was fill the label. So, the boxfill
option solves it for me. Thanks for the prompt attention here!
from geomtextpath.
I'll leave this open until I get round to improving the docs for this feature. Thanks for raising it @Pecners
from geomtextpath.
I used a boxfill aesthetic for geom_labelsf
Excellent foresight, Allan!
from geomtextpath.
Related Issues (20)
- Long labels with arrow throw cryptic "Error: Cannot create zero-length unit vector ("unit" subsetting)" error
- Strange behaviour of halign HOT 4
- Feature Request: Set angle for geom_labelvline HOT 6
- Feature request - test for text self-overlap on sharp contours HOT 1
- ggplot coord_polar() issue with multiple classes: 'from' must be a finite number error HOT 1
- session aborted when library in Rstudio HOT 2
- 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
- show.legend not working in geom_textabline
- Support for `geom_step()`? HOT 2
- Partial match of 'xoff' to 'xoffset'
- geom_textsf seems to ignore remove_long=F
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.