scale=alt.Scale(type="pow", exponent=np.e)
# Create dummy data
x = np.linspace(0, 1, 100)
y = np.random.exponential(1, 100) # Distribution to verify the inverse-log (exp) plot axis
y.sort()
alt.Chart(pd.DataFrame({"x": x, "y": y}), title="Exp Axes").transform_window(
cumulative_sum="sum(y)",
sort=[{"field": "x"}],
).mark_line().encode(
x=alt.X("x:Q", scale=alt.Scale(type="pow", exponent=np.e)),
y=alt.Y("cumulative_sum:Q", scale=alt.Scale(type="pow", exponent=1)),
)
作为参考,以下是原始信号在绘制时的样子:
alt.Chart(pd.DataFrame({"x": x, "y": y}), title="Raw Plot").transform_window(
cumulative_sum="sum(y)",
sort=[{"field": "x"}],
).mark_line().encode(
x=alt.X("x:Q"),
y=alt.Y("cumulative_sum:Q"),
)