pierebean
pierebean

Reputation: 1

MatplotLib: Scatter of Unicode characters with URL links

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')

Upvotes: 0

Views: 150

Answers (0)

Related Questions