Reputation: 1
I want to export a matplotlib scatter plot as a SVG with a different hyperlink from each scatter points which are not simple markers but Unicode characters.
I've try the following:
import matplotlib.cm as cm
import matplotlib as mpl
import matplotlib.pyplot as pyplot
mpl.rcParams['text.usetex'] = True
mpl.rcParams['text.latex.preamble'] = [r'\usepackage{amsmath}'] #for \text command
f = pyplot.figure()
stemp='6F22'
markerstring=r'$\\unichar{"%s}$' % stemp
print(markerstring)
ss = pyplot.scatter([1, 2, 3], [4, 5, 6],color='black',s=[100, 0, 0],alpha=0.5, marker=markerstring)
ss.set_urls(['http://www.bbc.co.uk/news', 'http://www.google.com', None])
f.savefig('scatter.svg')
It either crashs because "\u" or "\unichar" is unknown
Or displays 6F22 instead of 漢 in the final SVG
Upvotes: 0
Views: 150