AoG plotting: column name :x not found in data frame

shrdlu
Thu, 28 Mar 2024 18:23:53 +0000
New to Julia

Hi,

I’m trying the AlgebraOfGraphics page demo for heatmap-style visualization (Visual · Algebra of Graphics) using my own local data.

I have no issues importing the external .tsv matrix file, but the process throws an error when it comes to drawing the actual plot. Here’s the code I’m trying to get to work.

using AlgebraOfGraphics, DataFrames, CairoMakie, CSV

set_aog_theme!()

heat_matrix = CSV.read("localdata.tsv", DataFrame)

plt = data(heat_matrix) * mapping(:x, :y) * AlgebraOfGraphics.density(npoints=50)

draw(plt * visual(colormap=:viridis))

The error message is:

julia> draw(plt * visual(colormap=:viridis))
ERROR: ArgumentError: column name :x not found in the data frame

And the input data is roughly in form below, though the number of entries is about 876 by 876

entry_1	entry_2	entry_3	entry_4	entry_5	entry_6	entry_7	entry_8	entry_9	entry_10	entry_11	entry_12	entry_13	entry_14	entry_15
100.0	99.389389	80.807358	81.091492	80.045761	80.2612	80.591591	80.326904	80.517456	80.73204	80.916733	81.039085	80.428047	81.411896	82.012657
99.389389	100.0	80.769554	81.563904	80.253723	81.239258	80.34507	80.411316	80.983093	80.776138	80.54747	80.830902	80.215294	81.910057	82.269379
80.807358	80.769554	100.0	98.784981	87.967583	88.039368	88.1138	88.004013	84.194122	84.372253	84.497612	85.310501	82.93158	82.449257	82.363342
81.091492	81.563904	98.784981	100.0	88.240082	88.462433	87.531174	87.579102	83.479767	83.909073	84.052917	84.921959	83.114807	82.751495	82.161125
80.045761	80.253723	87.967583	88.240082	100.0	98.189163	88.235207	89.16333	84.933044	84.678314	86.075043	86.235718	83.413078	82.43309	80.658096
80.2612	81.239258	88.039368	88.462433	98.189163	100.0	88.264221	88.903702	85.049088	85.365807	86.156403	86.378174	83.042229	82.283073	80.690521
80.591591	80.34507	88.1138	87.531174	88.235207	88.264221	100.0	89.984344	84.083481	83.85466	87.144073	85.681107	83.881477	81.86351	82.695709
80.326904	80.411316	88.004013	87.579102	89.16333	88.903702	89.984344	100.0	85.202805	84.645584	84.900604	85.778015	85.173973	81.289238	82.033951
80.517456	80.983093	84.194122	83.479767	84.933044	85.049088	84.083481	85.202805	100.0	99.035522	87.151443	88.334236	84.80954	86.120651	83.791351
80.73204	80.776138	84.372253	83.909073	84.678314	85.365807	83.85466	84.645584	99.035522	100.0	87.532318	88.439926	84.654488	85.649384	83.718521
80.916733	80.54747	84.497612	84.052917	86.075043	86.156403	87.144073	84.900604	87.151443	87.532318	100.0	92.740463	85.269989	82.425095	83.434967
81.039085	80.830902	85.310501	84.921959	86.235718	86.378174	85.681107	85.778015	88.334236	88.439926	92.740463	100.0	85.421165	82.606354	83.663094
80.428047	80.215294	82.93158	83.114807	83.413078	83.042229	83.881477	85.173973	84.80954	84.654488	85.269989	85.421165	100.0	84.637268	84.210716
81.411896	81.910057	82.449257	82.751495	82.43309	82.283073	81.86351	81.289238	86.120651	85.649384	82.425095	82.606354	84.637268	100.0	84.265274
82.012657	82.269379	82.363342	82.161125	80.658096	80.690521	82.695709	82.033951	83.791351	83.718521	83.434967	83.663094	84.210716	84.265274	100.0

The dataframe clearly shows the first line as the header for each column - am pretty stumped at the moment. What could I be doing wrong?

Thank you!

6 posts - 5 participants