DimensionalData.jl icon indicating copy to clipboard operation
DimensionalData.jl copied to clipboard

add title to DimArray

Open lazarusA opened this issue 1 year ago • 3 comments

Add a title to the DimArray would be nice.

A = DimArray(rand(4,5), (a=1:4, b=1:5)) ╭─────────────────────────╮ │ 4×5 DimArray{Float64,2} │ >>It should be outset this box>TITLE FOR ARRAY/ DATASET-> Default A, but with a karg. ├─────────────────────────┴─────────────────────── dims ┐ ↓ a Sampled{Int64} 1:4 ForwardOrdered Regular Points, → b Sampled{Int64} 1:5 ForwardOrdered Regular Points └───────────────────────────────────────────────────────┘ ↓ → 1 2 3 4 5 1 0.424074 0.593846 0.940429 0.322598 0.889187 2 0.697233 0.213045 0.164312 0.269279 0.44907 3 0.601732 0.267198 0.967271 0.882953 0.97872 4 0.407274 0.0280848 0.619313 0.14258 0.886049

lazarusA avatar Apr 12 '24 06:04 lazarusA

By title do you mean name(A) like we have now?

julia> A = DimArray(rand(4,5), (a=1:4, b=1:5); name=:title)
╭───────────────────────────────╮
│ 4×5 DimArray{Float64,2} title │
├───────────────────────────────┴───────────────── dims ┐
  ↓ a Sampled{Int64} 1:4 ForwardOrdered Regular Points,
  → b Sampled{Int64} 1:5 ForwardOrdered Regular Points
└───────────────────────────────────────────────────────┘
 ↓ →  1         2         3          4         5
 1    0.661617  0.770108  0.575509   0.868416  0.521379
 2    0.812634  0.667707  0.417909   0.623842  0.0260108
 3    0.200963  0.785179  0.0195309  0.250583  0.255492
 4    0.823116  0.112858  0.097574   0.029063  0.403353

But yes it could be in a better spot. One issue is sometimes if the eltype is huge the box goes to the full width of the screen and the line joins with the edge of the dims box.

But I think this looks good:

julia> A = DimArray(rand(4,5), (a=1:4, b=1:5); name=:title)
╭──────────────────────────╮
│ 4×5 DimArray{Float64,2}  │ title
├──────────────────────────┴────────────────────── dims ┐
  ↓ a Sampled{Int64} 1:4 ForwardOrdered Regular Points,
  → b Sampled{Int64} 1:5 ForwardOrdered Regular Points
└───────────────────────────────────────────────────────┘
 ↓ →  1         2         3          4         5
 1    0.661617  0.770108  0.575509   0.868416  0.521379
 2    0.812634  0.667707  0.417909   0.623842  0.0260108
 3    0.200963  0.785179  0.0195309  0.250583  0.255492
 4    0.823116  0.112858  0.097574   0.029063  0.403353

This not so much:

julia> A = DimArray(rand(4,5), (a=1:4, b=1:5); name=:title)
╭──────────────────────────╮
│ 4×5 DimArray{Float64,2}  │ 
│ title                    │ 
├──────────────────────────┴────────────────────── dims ┐
  ↓ a Sampled{Int64} 1:4 ForwardOrdered Regular Points,
  → b Sampled{Int64} 1:5 ForwardOrdered Regular Points
└───────────────────────────────────────────────────────┘
 ↓ →  1         2         3          4         5
 1    0.661617  0.770108  0.575509   0.868416  0.521379
 2    0.812634  0.667707  0.417909   0.623842  0.0260108
 3    0.200963  0.785179  0.0195309  0.250583  0.255492
 4    0.823116  0.112858  0.097574   0.029063  0.403353

Also its green in the REPL so stands out a bit more.

rafaqz avatar Apr 12 '24 07:04 rafaqz

this positioning, I do like:

julia> A = DimArray(rand(4,5), (a=1:4, b=1:5); name=:title)
╭──────────────────────────╮
│ 4×5 DimArray{Float64,2}  │ title
├──────────────────────────┴────────────────────── dims ┐
  ↓ a Sampled{Int64} 1:4 ForwardOrdered Regular Points,
  → b Sampled{Int64} 1:5 ForwardOrdered Regular Points
└───────────────────────────────────────────────────────┘
 ↓ →  1         2         3          4         5
 1    0.661617  0.770108  0.575509   0.868416  0.521379
 2    0.812634  0.667707  0.417909   0.623842  0.0260108
 3    0.200963  0.785179  0.0195309  0.250583  0.255492
 4    0.823116  0.112858  0.097574   0.029063  0.403353

lazarusA avatar Apr 12 '24 07:04 lazarusA

Yeah its more obviously a separate thing

rafaqz avatar Apr 12 '24 08:04 rafaqz