We got a julia struct that represents a sparse matrix. In the literature this matrix is often represented with its plot (like with imshow) because it only has 0s or 1s.

We want to define custom show methods for it. I realized I can use UnicodePlots to overload show to display the unicode plot instead.I have achieved that, so for the following let’s imagine that I am able to define show for my type that uses UnicodePlots.

Here are my questions:

I still want to have a “short” definition of my type, to be used in tuples/arrays. Julia manual says that I define show(io, mytype) for this short definition and then show(io, ::MIME"text/plain", mytype) for the long definition. Is this actually correct? How does “text/plain” correspond to all platforms that UnicodePlots supports? I mean, I could show this unicode plot to jupyter, juno, repl, everywhere. Does text/plain correspond to the type I should be using? ANSWER: Yes, I just use text/plain.

Can I somehow deduce the character limit of the io ? How many characters can be fit in the single line? If yes, where is this in the documentation?

Is there a way to “detect” the character spacing and the line height from the io ? By this I mean, how many pixels on the screen does the width of one character span, and how many pixels does the height of a line span.

Lastly, is it possible to “deduce” if the io supports unicode characters or only ascii? Because UnicodePlots allows you to use only ascii if need be!