# Makie PairPlot

**URL:** <https://discourse.julialang.org/t/makie-pairplot/39298>\
**Category:** Visualization\
**Tags:** question, plotting, makie\
**Created:** [May 11, 2020, 5:04pm UTC](https://discourse.julialang.org/t/makie-pairplot/39298 "2020-05-11T17:04:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Post date:** [January 21, 2021, 9:14pm UTC](https://discourse.julialang.org/t/makie-pairplot/39298/4 "2021-01-21T21:14:56Z")

</div>

For future reference, in case anyone wants the full working code, here it is. I am on Julia v1.5:

```julia
using Makie
using StatsMakie
using DataFrames
using DelimitedFiles
using GLFW
using AbstractPlotting
using MakieLayout

col_names = [:sepalLength, :sepalWidth, :petalLength, :petalWidth, :class]
df = readdlm("iris.csv", ',')|> DataFrame
rename!(df, col_names)
df[!, 1:4] = Float32.(df[!,1:4])
df[!, 5] = String.(df[!, 5])

function pairplot(df)
    dim = size(df, 2)-1

    scene, layout = layoutscene(30, resolution = (900, 900))
    axs = layout[1:dim, 1:dim] = [LAxis(scene) for i in 1:dim^2]
    x = 0
    for i in 1:dim, j in 1:dim  
	      
	if i == j
	    x+=1
	    plt = plot!(axs[x],Position.stack, histogram, Data(df), Group(:class), df[:, i])
	else
	    x+=1
	    plt = Makie.scatter!(axs[x], Data(df), Group(:class), df[:,j], df[:,i])    
	end
    end
    scene
end

testPlot = pairplot(df)

```

Also, you can download the data here: [https://gist.githubusercontent.com/curran/a08a1080b88344b0c8a7/raw/0e7a9b0a5d22642a06d3d5b9bcbad9890c8ee534/iris.csv](https://gist.githubusercontent.com/curran/a08a1080b88344b0c8a7/raw/0e7a9b0a5d22642a06d3d5b9bcbad9890c8ee534/iris.csv) - Just make sure to delete the first row of the CSV or it will fail.

Here are the package versions I had:

```julia
  [537997a7] AbstractPlotting v0.10.11
  [a93c6f00] DataFrames v0.20.2
  [f7f18e0c] GLFW v3.4.0
  [ee78f7c6] Makie v0.10.0
  [5a521ce4] MakieLayout v0.9.10
  [65254759] StatsMakie v0.2.3

```

Hopefully this helps future generations of Julians trying to make their own pairplot!

P.S. Thanks to @Dustin_Hess for providing the initial impetus for this!

---

_[View the full topic](https://discourse.julialang.org/t/makie-pairplot/39298)._
