# Pretty printing \`AxisArray\` based type alias

**URL:** <https://discourse.julialang.org/t/pretty-printing-axisarray-based-type-alias/116271>\
**Category:** General Usage\
**Tags:** question, axisarrays, print, alias\
**Created:** [June 26, 2024, 4:50pm UTC](https://discourse.julialang.org/t/pretty-printing-axisarray-based-type-alias/116271 "2024-06-26T16:50:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BambOoxX](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bambooxx/32/22179_2.png) [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Post date:** [June 26, 2024, 4:50pm UTC](https://discourse.julialang.org/t/pretty-printing-axisarray-based-type-alias/116271/1 "2024-06-26T16:50:15Z")

</div>

Hi all, I’m currently using `AxisArrays` to store array-like data, while giving some sense to the dimension names and with type parameters so that my type remains generic enough. This is super practical, but whenever I print data to the REPL, I get very long names due to the generic printing done by `AxisArrays`.

I figured I could define my own show methods for my type, but it gets cumbersome very fast.

Here is a toy example

```julia
MyArray{T,M,VI} = AxisArrays.AxisMatrix{T,M,Tuple{AxisArrays.Axis{:x,VI},AxisArrays.Axis{:y,Vector{Symbol}}}} where {T<:Number,M<:AbstractMatrix{T},VI<:AbstractVector{<:Integer}}

```

I have as well secondary aliases as

```julia
MyArrayReal = MyArray{T,M,VI} where {T<:Real,M<:AbstractMatrix{T},VI<:AbstractVector{<:Integer}}
MyArrayComplex = MyArray{T,M,VI} where {T<:Complex,M<:AbstractMatrix{T},VI<:AbstractVector{<:Integer}}

```

To have this printed in the REPL in a shorter manner, I implemented a custom `show` method with

```julia
show(io::IO, m::MIME"text/plain", ::Type{MyArray{T,M,VI}}) where {T<:Number,M<:AbstractMatrix{T},VI<:AbstractVector{<:Integer}} = println(io, "MyArray{$T,$M,$VI}")

```

but that fails easily one I used arrays of `MyArray`…  
What would be a better way to leverage `AxisArrays` functionnality, while maintaining a light printing of the type ?
