@ColinTheMathmo I was uploading from saved SVG because the image is only temporarily stored on your system.
I have reverted the post to its first revision that links to SVG on your server, and that works fine.
You might consider storing generated images on e.g. a PixelFed instance, or maybe on archive.org or somewhere else that is suited for long-term storage.
@humanetech So the problem lies in the upload of the SVG to Discourse. Since it displayed fine for you locally, that makes it sound like the problem is in Discourse's handling of the image when uploaded.