-
Notifications
You must be signed in to change notification settings - Fork 121
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
tm_scalebar width calculation #919
Comments
Thanks, should be fixed now. Please check if it works as expected, and reopen if necessary. |
@mtennekes, it works much better now. Many thanks! I would like to express two wishes for the long-term improvement of tm_scalebar:
For presentations and reports, I like to work with tmap-generated visualizations. These are very appealing to many viewers. |
Thx!
|
The distance of the scalebar to the right is now better, but rather too small. This becomes clear, for example, when tm_scalebar is used within a legend and the scalebar is wider than the legend text. In the example, the
Other distances are also not yet ideal, here for example the distance between legend entries and the scalebar. But you can already work with it ;) The text.size of the scalebar works as desired in the example shown here. Apparently my other code is more complex, so it doesn't scale there for other reasons? I'll look into this more thoroughly and come back to it if necessary. Thanks again for the very quick and competent help and the patches :D |
You're welcome. Thx for the example. Three update in latest commit:
|
I'm afraid I don't understand the use of width properly now. I have always specified the maximum value that the scalebar should use. If I do this now, it has unpredictable effects for me. If I use the scalebar separately from the legend, width changes the position of the scalebar. If width is used within the legend, the legend is set to maximum width. Here are some examples, derived from the example above:
Overall, I currently prefer to work without width, as the results are more reliable.
I really like this automated shortening. It significantly improves the aesthetics. |
One important piece of information you miss (apparently haven't share properly): For the last example: if the position is different, then the scale bar doesn't take the other components (in this case add_legend) into account. You can see the margins a bit better when you enable I still see some room for improvement (apart from the documentation), so I'll leave this open. |
Oh, I'm really sorry. I must have misunderstood that completely. I hadn't found any explanation in the tm_scalebar help, so I had assumed that 'width' referred to the width of the scalebar (in terms of units, e.g. 1000 km in my example). Thanks for the clarification.
I understand that very well, but with my understanding of width at the time, I had expected the scalebar to be oriented to the right edge of the graph in the last example. Instead, it is more to the left of the center of the graphic.
With design_mode active, you can see that the scalebar in the last example is much wider than I expected due to width=1000. Thanks for this tip too!
For me, the design possibilities with tmap are already quite good, so I can continue with my projects. |
In the current v3.99.9002, the examples for arranging tm_scalebar no longer work as expected for me. E.g. in the first example from #747:
tm_scalebar(c(0, 200, 400), position = c(“right”, “bottom”))
positions bottom left instead of bottom right.The positioning obviously only works if no other parameters such as breaks= or width= are used.
In addition, width does not seem to have any influence on the scaling, e.g. with
breaks = seq(0,1000,200)
the length of the scale cannot be changed withwidth = 600
orwidth = 1200
.The text was updated successfully, but these errors were encountered: