Black Lives Matter. Please consider donating to Black Girls Code today.

Latex or HTML support for Parallel Coordinates

Hey guys,
I have a problem with the offline parallel coordinate plot in the python environment. I have the problem, that I cannot use Latex or even HTML notation for my axis titles. Currently I am working with unicode representation for e.g. the greek beta, but I need to show nice indices as well… It seems, that MahthJax is only loaded in the wrapper of the plot, so that I can use LaTex commands for the titles. But it does not work for inside the plot for the axis titles. For the colorbar title I can use the HTML Syntax as well as LaTex commands… But the LaTex symbols are turned.
Unfortunately, I cannot publish my original code and data, but I tried to rebuild the problem with an example. So, regarding the github issue thread #515 (see here), I tried to implement the workaround from ianhbell. But as already mentioned, it does not work for the parallel coordinates plot :frowning:

Can anybody help me or give me a hint? I’m a total newbie to javascript and d3.js… Thank you!
mrclore

python Code:

import plotly.offline as offline
import plotly.graph_objs as go
import os
import pandas as pd

df = pd.read_csv(“https://raw.githubusercontent.com/bcdunbar/datasets/master/parcoords_data.csv”)

data = [
go.Parcoords(
line = dict(color = df[‘colorVal’],
colorscale = ‘Jet’,
colorbar = dict(title = ‘A5’,#’$\beta$’,
tickformat=“r”,
ticks=“outside”,
titlefont=dict(size=21)),
showscale = True,
reversescale = True,
cmin = -4000,
cmax = -100),
dimensions = list([
dict(range = [32000,227900],
constraintrange = [100000,150000],
label = ‘$\beta$’, values = df[‘blockHeight’]),
dict(range = [-4000, -100],
label = ‘A5’, values = df[‘colorVal’]),
dict(range = [0,700000],
label = ‘Block Width’, values = df[‘blockWidth’]),
dict(tickvals = [0,0.5,1,2,3],
ticktext = [‘A’,‘AB’,‘B’,‘Y’,‘Z’],
label = ‘Cyclinder Material’, values = df[‘cycMaterial’]),
dict(range = [4, -1],
tickvals = [0,1,2,3],
label = ‘Block Material’, values = df[‘blockMaterial’]),
dict(range = [3154,123],
visible = True,
label = ‘Total Weight’, values = df[‘totalWeight’]),
dict(range = [9,19984],
label = ‘Assembly Penalty Weight’, values = df[‘assemblyPW’]),
dict(range = [49000,568000],
label = ‘Height st Width’, values = df[‘HstW’]),
dict(range = [-28000,196430],
label = ‘Min Height Width’, values = df[‘minHW’]),
dict(range = [98453,501789],
label = ‘Min Width Diameter’, values = df[‘minWD’]),
dict(range = [1417,107154],
label = ‘RF Block’, values = df[‘rfBlock’])
])
)
]

layout = go.Layout(
title=’$\sqrt{5}$’
)
fig = go.Figure(data=data, layout=layout)

def with_jax(fig, filename):

plot_div = offline.plot(fig, output_type = 'div')

template = """
<head>
<script type="text/javascript" async
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_SVG">
</script>
</head>
<body>
{plot_div:s}
</body>""".format(plot_div = plot_div)
with open(filename, 'w') as fp:
    fp.write(template)
os.startfile(filename)

with_jax(fig, ‘cube.html’)