You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to make a scatter plot overlaid on ternary contour in Python with Plotly.
scientific
python
base
Ternary Overlay
8
u-guide
python/ternary-scatter-contour/
thumbnail/ternary-scatter-contour.jpg
Load and Process Data Files
importjsonimportpandasaspdcontour_raw_data=pd.read_json('https://raw.githubusercontent.com/plotly/datasets/master/contour_data.json')
scatter_raw_data=pd.read_json('https://raw.githubusercontent.com/plotly/datasets/master/scatter_data.json')
scatter_data=scatter_raw_data['Data']
defclean_data(data_in):
""" Cleans data in a format which can be conveniently used for drawing traces. Takes a dictionary as the input, and returns a list in the following format: input = {'key': ['a b c']} output = [key, [a, b, c]] """key=list(data_in.keys())[0]
data_out= [key]
foriindata_in[key]:
data_out.append(list(map(float, i.split(' '))))
returndata_out#Example:print(clean_data({'L1': ['.03 0.5 0.47','0.4 0.5 0.1']}))