Giter Club home page Giter Club logo

Comments (5)

teunbrand avatar teunbrand commented on July 24, 2024

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.

AllanCameron avatar AllanCameron commented on July 24, 2024

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.

Pecners avatar Pecners commented on July 24, 2024

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.

AllanCameron avatar AllanCameron commented on July 24, 2024

I'll leave this open until I get round to improving the docs for this feature. Thanks for raising it @Pecners

from geomtextpath.

teunbrand avatar teunbrand commented on July 24, 2024

I used a boxfill aesthetic for geom_labelsf

Excellent foresight, Allan!

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.