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