I am trying to rotate a viewport object in R. However, I end up getting boundaries for the rotated object.

Any idea as to how to rotate but not end up with these boxes?

Below is the code. m_cont, m_AK and m_HI are the maps.


vp_AK <- viewport(x = 0.15, y = 0.25, width = 0.3, height = 0.3)
vp_HI <- viewport(x = 0.36, y = 0.2, width = 0.2, height = 0.13)

print(m_AK, vp = vp_AK)
print(m_HI, vp = vp_HI)

enter image description here


I think you need to add tm_layout(frame=FALSE, bg.color=NA) to your maps.

The first option removes the frame, and the second stops the system painting a white rectangle over the viewport. It does create (for me) some warnings, which I am ignoring.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.