I’m new to pygmt specifically, and GMT in general. I’m trying to plot a rectangle on my map with a semi-transparent background. To that end, I’ve used the following code:
fig.plot(data = numpy.array([scale_params['background']]), style = 'r',
color = "black@50")
Unfortunately, while this gives me the desired rectangle, it would appear that it is not 50% transparent, as expected. What am I doing wrong?
So according to this: https://docs.generic-mapping-tools.org/latest/cookbook/features.html#stroke-fill-and-font-transparency, it would appear that some formats may not support transparency. However, it also seems to apply that pdf does. So perhaps it is something about how the file is converted to PDF? At the moment I’m just doing a “show” with external=True, so maybe I need to actually save the image for transparency to work?
Please check your ghostscript version via gs --version
. It’s known that ghostscript 9.51 and 9.52 has serious bugs to support transparency.
Ah, that could be it then. I have 9.52, installed via homebrew on my MacOS Catalina machine.
Of course, 9.52 also appears to be the current version, so it’s not like I can upgrade to fix the problem…