Set log axis for some parameters
Closed this issue · 1 comments
Hello,
I have the code below to create a parallel coordinates plot
paxfig = paxplot.pax_parallel(n_axes=len(cols))
paxfig.plot(df.to_numpy())
paxfig.set_labels(column_names)
paxfig.set_size_inches(12, 7)
paxfig.subplots_adjust(left=0.1, bottom=0.2, right=0.9, top=0.9)
color_col = 5
paxfig.add_colorbar(
ax_idx=color_col,
cmap='jet',
colorbar_kwargs={'label': r"$L_{MSE}$ Validation"}
)
Is it possible to have for some of the parameters (e.g. the last two) log scale in the axis in order to be able to see them better?
Hello @ddiama!
Great question. There is currently no native support for log scales in paxplot. However, you can use the custom tick label functionality with data scaling as a workaround:
import matplotlib.pyplot as plt
import pandas as pd
import paxplot
import math
# Original data (trying to mimic your data's behavior)
data = [
[1.0, 1.0],
[1.1, 1.1],
[5.0, 1.3],
[9.0, 1.5],
[10.0, 1.6],
[50.0, 1.7],
[100.0, 1.8],
]
df = pd.DataFrame(data, columns=['A', 'B'])
# Log transform data
log_scale_func = math.log10
df['Log Version A'] = df['A'].apply(log_scale_func)
# Create figure
cols = df.columns
paxfig = paxplot.pax_parallel(n_axes=len(cols))
paxfig.plot(df.to_numpy())
paxfig.set_labels(cols)
paxfig.set_ticks(
ax_idx=2,
ticks=[log_scale_func(1), log_scale_func(10), log_scale_func(100)],
labels=['1', '10', '100']
)
plt.show()
Adding native log support would not be too hard, and I would be happy to support any interest in adding it!
Also, very shameless plug here based on your labels/data. you may be interested in this blog post I wrote on multi-objective hyperparamter tuning. This blog post also links to other publications.