Skip to content

Commit 567b0b8

Browse files
committed
validate: tweak plot layout, SVG
1 parent 42e68e1 commit 567b0b8

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

docs/source/validate.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ provides mean silhouette metric for the datapoints. Higher values indicate bette
192192

193193
Exemplary data with 3 real clusters.
194194
```@example clu_quality
195-
using Plots, Clustering
195+
using Plots, Plots.PlotMeasures, Clustering
196196
X_clusters = [(center = [4., 5.], std = 0.4, n = 10),
197197
(center = [9., -5.], std = 0.4, n = 5),
198198
(center = [-4., -9.], std = 1, n = 5)]
@@ -207,11 +207,14 @@ scatter(view(X, 1, :), view(X, 2, :),
207207
markercolor = X_assignments,
208208
plot_title = "Data", label = nothing,
209209
xlabel = "x", ylabel = "y",
210-
legend = :outerright
211-
)
210+
legend = :outerright,
211+
size = (600, 500)
212+
);
213+
savefig("clu_quality_data.svg"); nothing # hide
212214
```
215+
![](clu_quality_data.svg)
213216

214-
Hard clustering quality for K-means method with 2 to 5 clusters:
217+
Hard clustering quality for [K-means](@ref) method with 2 to 5 clusters:
215218

216219
```@example clu_quality
217220
hard_nclusters = 2:5
@@ -223,11 +226,14 @@ plot((
223226
marker = :circle,
224227
title = ":$qidx", label = nothing,
225228
) for qidx in [:silhouettes, :calinski_harabasz, :xie_beni, :davies_bouldin, :dunn])...,
226-
layout = (3, 2),
227-
xaxis = "N clusters",
228-
plot_title = "\"Hard\" clustering quality indices"
229+
layout = (2, 3),
230+
xaxis = "N clusters", yaxis = "Quality",
231+
plot_title = "\"Hard\" clustering quality indices",
232+
size = (1000, 600), left_margin = 10pt
229233
)
234+
savefig("clu_quality_hard.svg"); nothing # hide
230235
```
236+
![](clu_quality_hard.svg)
231237

232238
Fuzzy clustering quality for fuzzy C-means method with 2 to 5 clusters:
233239
```@example clu_quality
@@ -242,11 +248,14 @@ plot((
242248
marker = :circle,
243249
title = ":$qidx", label = nothing,
244250
) for qidx in [:calinski_harabasz, :xie_beni])...,
245-
layout = (2, 1),
246-
xaxis = "N clusters",
247-
plot_title = "\"Soft\" clustering quality indices"
251+
layout = (1, 2),
252+
xaxis = "N clusters", yaxis = "Quality",
253+
plot_title = "\"Soft\" clustering quality indices",
254+
size = (700, 350), left_margin = 10pt
248255
)
256+
savefig("clu_quality_soft.svg"); nothing # hide
249257
```
258+
![](clu_quality_soft.svg)
250259

251260

252261
## Other packages

0 commit comments

Comments
 (0)