2次元散布図(x[1]
とx[2]
など)の高濃淡点セットx
(ここではdim(6 x 42))を視覚化しようとしています。 。)bokehを使って。 [edit2] this scikit-optの素敵な例を参考にしてください。 x[1]
が2つのプロットで発生する場合、同じ範囲と対話し、プロットは同時にスケールを変更する必要があります。私はこれを達成しましたが、私はそれを正確に拡大することはできません。ここで、最小限の例です:[EDIT2]複数のプロット間でx_rangeとy_rangeを混在させると、ボケ軸の限界値が失われる
import bokeh
import bokeh.io
import numpy as np
import bokeh.plotting
bokeh.io.output_notebook()
# That's my fictional dataset
x = np.random.randn(6, 42)
x[2] *= 10
# Build the pairwise scatter plots
kw = dict(plot_width=165, plot_height=165)
# `ranges` stores the range in each dimension,
# used as both, x- and y-range depending on
# where the variable is.
figs, ranges = {}, {}
for r, row in enumerate(x):
for c, col in enumerate(x):
if r is not c:
fig = bokeh.plotting.figure(
x_range=ranges.get(c, None), y_range=ranges.get(r, None),
**kw)
fig.scatter(x=col, y=row)
fig.xaxis.axis_label = f'Dim {c}'
fig.yaxis.axis_label = f'Dim {r}'
if c not in ranges:
ranges[c] = fig.x_range
if r not in ranges:
ranges[r] = fig.y_range
figs[f'{r}_{c}'] = fig
else:
break
# Setup the plotting layout
plots = [[]]
for r, row in enumerate(x):
for c, col in enumerate(x):
if r is not c:
plots[-1].append(figs[f'{r}_{c}'])
else:
plots.append([])
break
staircase = bokeh.layouts.gridplot(plots, **kw)
bokeh.plotting.show(staircase)
.. ipythonノート(> = py3.6)に、ボケは、DIM 1のスケールを設定し、2正しく。次に、次の次元の縮尺をdim 2のように設定します。この点を確認するためにdim 2を10倍に縮尺したことに注目してください。
対話的に、プロットを最適な設定に戻すことができます。しかし、私はデフォルトでそれをしたいと思います。どのようなオプションを私はbokeh rescale内に持っていますか?私はfig.xaxis.bounds
で少し演奏しましたが、失敗しました。ご協力いただきありがとうございます!
エピローグ:開始範囲を修正するために
for i, X in enumerate(x):
ranges[i].start = X.min()
ranges[i].end = X.max()
:@のbigreddotの答えに続き は、私は行を追加しました。私はまだその行動がバグだと思っています。
範囲は、各次元が固有の範囲を持つようにリンクされています。 x [1] - 範囲を変更すると、x [1]が表示されているどこでも変更されます。私はそれをより明確にするために私の質問を編集しました。 – Jus
あなたはx範囲をy範囲にリンクしていることはまだ奇妙に思えます(これは、範囲のdictで 'int'を使い、' r'と 'c'を区別しないので起こります)スクリーンショットを撮り、あなたが望むもので注釈を付ける?いずれにせよ、上記のオプションは、範囲をより直接的に制御するために利用できるものです。 – bigreddot
scikit-optの[this](https://scikit-optimize.github.io/notebooks/visualizing-results_files/visualizing-results_15_1.png)を参照してください。私はそれが非常に便利だと思います。 7Dの機能をどのように視覚化しますか? – Jus