Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertical names of headers #157

Open
pevnak opened this issue Feb 10, 2022 · 1 comment
Open

Vertical names of headers #157

pevnak opened this issue Feb 10, 2022 · 1 comment

Comments

@pevnak
Copy link

pevnak commented Feb 10, 2022

Hi,

Thanks for wonderful package. I would like to ask, if you have considered to add an option with header printed out vertically. For example like this

                                                        N
                                                        o         S
                                                        n         c
                                                        p         i
                                                        r         e
                        A             F                 o         n
                        u             i              N  f         c     T
                        t             l              e  i   P  P  e     r
                        o          E  m      H       w  t   e  e        a
                        s          n         o       s  s   o  t  &     v
                                   t  &      w              p  s        e
                        &          e         t       &  &   l     T     l
                               E   r  A      o              e  &  e
                        V      d   t  n              P  A         c     &
                        e      u   a  i      &       o  c   &  A  h
                        h  C   c   i  m  G           l  t      n  n  S  E
                        i  o   a   n  a  a   S  M    i  i   B  i  o  p  v
                        c  m   t   m  t  m   t  u    t  v   l  m  l  o  e
                        l  e   i   e  i  i   y  s    i  i   o  a  o  r  n
                        e  d   o   n  o  n   l  i    c  s   g  l  g  t  t
                        s  y   n   t  n  g   e  c    s  m   s  s  y  s  s
──────────────────────────────────────────────────────────────────────────
      Autos & Vehicles  0  0   1   1  0  0   0  0    0  0   2  0  0  0  0
                Comedy  0  0  18  17  1  0   0  0    5  0  12  0  1  0  0
             Education  1  1  49  46  1  1   4  0   45  0  13  0  2  0  4
         Entertainment  0  7  23  40  0  0   4  0   45  0  44  0  6  0  3
      Film & Animation  0  0   1   3  0  0   1  0    0  0   2  0  0  0  0
                Gaming  0  0   3  14  0  1   1  0    2  0  10  0  0  0  0
         Howto & Style  0  1   5   6  0  1   4  0   15  0  22  0  2  0  3
                 Music  0  0   0   0  0  0   0  0    0  0   2  0  0  0  0
       News & Politics  0  0  18  23  0  1   2  0  309  0  14  0  2  0  0
 Nonprofits & Activism  0  0   1   0  0  0   0  0    2  0   0  0  0  0  0
        People & Blogs  0  5  18  35  0  0   6  0   33  0  49  0  7  0  5
        Pets & Animals  0  9   5  16  4  6   6  0    5  0  10  1  0  1  0
  Science & Technology  0  0  15   9  0  1   1  0   12  0   4  0  0  0  1
                Sports  0  0   0   0  0  0   0  0    2  0   2  0  0  0  0
       Travel & Events  0  1   3  13  0  0  12  0    3  0  15  0  0  0  1
──────────────────────────────────────────────────────────────────────────

I did this with a this code snippet

function caption2matrix(captions; bottom_space = 0)
	cm = fill("", maximum(length.(captions))+bottom_space, length(captions))
	b = size(cm, 1) - bottom_space 
	for (i, s) in enumerate(captions)
		for j in 1:length(s)
			cm[b - length(s) + j, i] = string(s[j])
		end 
	end
	cm
end
cm = caption2matrix([" ", captions...])
hlines = [size(cm,1), size(cm,1) + size(confusion,1)]
pretty_table(vcat(cm, hcat(captions, confusion)); noheader = true, vlines = [], hlines)

It is not visually stunning, but it is nice that the table is compactly printed.

Best wishes and thanks for a great work.
Tomas

@ronisbr
Copy link
Owner

ronisbr commented Feb 11, 2022

Hi @pevnak !

Thanks for the proposal! It seems interesting! In fact, I am doing a HUGE rewrite in PrettyTables (check the branch ptable). In this new version, this feature will be very easy to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants