这是indexloc提供的服务,不要输入任何密码
Skip to content

Added maxWidth option to tm_credits. #486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

martinschmelzer
Copy link

While creating several maps for my employer, I needed the feature to have full width credits on the bottom of the map, no matter the actual size of the credits text. For corporate designs that might be useful.

@mtennekes
Copy link
Member

Many thanks @martinschmelzer!

I've improved the implementation a bit, see mtennekes@ebe88f8 Instead of maxWidth, I opted for width which is more general (1 means max width). Let me know if it works as expected.

@mtennekes mtennekes closed this Aug 12, 2020
@martinschmelzer
Copy link
Author

You are very welcome. I'll try it out tomorrow.

@martinschmelzer
Copy link
Author

martinschmelzer commented Aug 17, 2020

@mtennekes Take the following baseic example:

data(World, metro, rivers)

tm_shape(World, projection=4326) + 
  tm_polygons() + 
  tm_credits("Test", width = 1, bg.color = "red", position = c(0,0)) +
  tm_layout(frame = T, inner.margins = c(0,0,0,0))

The credits are usually not positioned in (0,0). When I do so and set width = 1 while also having no inner.margin, the credits do not span the whole map width. Is that the desired behavior? I initially thought inner.margins = c(0,0,0,0) would lead to full span credits.

@mtennekes
Copy link
Member

Found out that it is not the inner.margins, but other types of margins. I agree that width = 1 should correspond to the full map width.
So I implemented it that way now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants