Skip to content

LDA Printing flipped in y and x axis data on docs #225

@jgardona

Description

@jgardona

Hello, good evening.

The LDA comparison with PCA in docs are plotting LDA flipped in Y and X axis. This happens with this example
https://juliastats.org/MultivariateStats.jl/stable/lda/

	iris = dataset("datasets", "iris")

	X = Matrix(iris[1:2:end,1:4])'
	X_labels = Vector(iris[1:2:end,5])
	
	pca = fit(PCA, X; maxoutdim=2)
	Ypca = predict(pca, X)

	lda = fit(MulticlassLDA, X, X_labels; outdim=2)
	Ylda = predict(lda, X)
	
	p = plot(layout=(1,2), size=(800,300))
	
	for s in ["setosa", "versicolor", "virginica"]
	
	    points = Ypca[:,X_labels.==s]
	    scatter!(p[1], points[1,:],points[2,:], label=s, legend=:bottomleft)
	    points = Ylda[:,X_labels.==s]
	    scatter!(p[2], points[1,:],points[2,:], label=s, legend=:bottomleft)
	
	end
	plot!(p[1], title="PCA")
	plot!(p[2], title="LDA")

And here are the plots from example

image

And here are the plots in my tests

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions