Wondering if it is possible to have different scale the axis in ternary plots.
I’ve seen all the examples have the same range.
If I had axis with the following ranges a 50-100, b 0-1, c 0-10 it doesn’t look like this can be plotted using the ternary plots at the moment
I notice that other ternary plots offer the ability to change the starting and ending points of the axis limits provided that they match the scale (I think plotly calls this sum)
fontsize = 16
tax.left_axis_label("Logs", fontsize=fontsize, offset=0.13)
tax.right_axis_label("Dogs", fontsize=fontsize, offset=0.12)
tax.bottom_axis_label("Hogs", fontsize=fontsize, offset=0.06)
# Set custom axis limits by passing a dict into set_limits.
# The keys are b, l and r for the three axes and the vals are a list
# of the min and max in data coords for that axis. max-min for each
# axis must be the same as the scale i.e. 9 in this case.
tax.set_axis_limits({'b': [67, 76], 'l': [24, 33], 'r': [0, 9]})
# get and set the custom ticks:
tax.get_ticks_from_axis_limits()
tax.set_custom_ticks(fontsize=10, offset=0.02)
# data can be plotted by entering data coords (rather than simplex coords):
points = [(70, 3, 27), (73, 2, 25), (68, 6, 26)]
points_c = tax.convert_coordinates(points,axisorder='brl')
tax.scatter(points_c, marker='o', s=25, c='r')
tax.ax.set_aspect('equal', adjustable='box')
Thanks
empet
July 21, 2020, 9:24am
2
@shimwell With data from your link above, you can restrict the aaxis from a 0< min_val <100 and the corresponding ternary plot looks like this one:
import plotly.graph_objects as go
import numpy as np
points = np.array([(62, 12, 26), (63.5, 13.5, 23), (65, 14, 21), (61, 15, 24),
(62, 16, 22), (67.5, 14.5, 18), (68.2, 16.5, 15.3), (62, 22.5, 15.5)])
A, B, C = points.T
fig=go.Figure(go.Scatterternary(a=A, b=B, c=C, mode='markers', marker_size=8))
fig.update_ternaries(sum=100, aaxis_min=55);
1 Like