Tmap aspect ratio when resizing png map

Hi everyone,
I am a fairly unexperienced R user, so please excuse my maybe a bit naive question.
I am trying to create a map with tmap and resize it, however, the aspect ratio gets totally distorted once I enter the specific size I need despite trying several options with width/height/dpi/asp etc. and of course trying to find a solution online.

R code:

map<-tm_shape(carte_week) + 
  tm_polygons(col="pct_cov",palette="Purples", breaks=c(0,0.25,0.5,1,2,4,Inf), title=" ",
              labels=c("<0.25", "0.25-0.5","0.5-1","1-2","2-4",">4"))+ 
  tm_layout(frame=FALSE)
  
#tmap_save(map, "map.png")

tmap_save(map, "map.png", width = 300, height = 300, asp = 0)

If I run this and save just with tmap_save without further specification I get an image of size 2185x2018px (which looks ok), but if I try to resize I get this distorted image (300x300 px):
image

Thanks a lot in advance for your help!

I have found a solution with the following:

tmap_save(map, "map.png", width = 300, height = 300, scale = 0.15)

However, the legends still needs to be adjusted.
image

Welcome @annam and thanks for posting!
What specifically more are you looking to do with the legend?

@mcewenkhundi @chrisJ @yurieizawa or @avaughan might have further tmap tips.

Thank you Neale !
I was able to move the legend :slight_smile: it’s a lot of playing around if you are not an experienced R user…
I wanted it to not overlap with the map, but not be completely outside as well, was a bit far from the mainland :sweat_smile:

map<-tm_shape(carte_week) + 
  tm_polygons(col="pct_cov",palette="Purples", breaks=c(0,0.25,0.5,1,2,4,Inf), title=" ",
              labels=c("<0.25", "0.25-0.5","0.5-1","1-2","2-4",">4"))+ 
  tm_layout(frame=FALSE, legend.text.size = 1, legend.position=c(0.9,0.7))
tmap_save(map, "map.png", width = 300, height = 300, scale = 0.15)

Cheers, Anna