nschloe / termplotlib

:chart_with_upwards_trend: Plotting on the command line
GNU General Public License v3.0
673 stars 19 forks source link

widht and height arguments of plot non working? #33

Closed TitouanGendron closed 4 years ago

TitouanGendron commented 5 years ago

Hello, I just discovered this lib, this is very useful for servers without graphical interface! thanks a lot for the work.

I just can't make the widht and height arguments of plot function work :

(python 3.7.3)

>>> prof
array([-2.        , -2.        , -1.77777778, -1.77777778, -1.55555556,
       -1.55555556, -1.33333333, -1.33333333, -1.11111111, -1.11111111,
       -0.88888889, -0.88888889, -0.66666667, -0.66666667, -0.44444444,
       -0.44444444, -0.22222222, -0.22222222, -0.        , -0.        ,
        0.        ,  0.        ,  0.22222222,  0.22222222,  0.44444444,
        0.44444444,  0.66666667,  0.66666667,  0.88888889,  0.88888889,
        1.11111111,  1.11111111,  1.33333333,  1.33333333,  1.55555556,
        1.55555556,  1.77777778,  1.77777778,  2.        ,  2.        ])
>>> fig = tplt.figure()
>>> fig.plot(range(len(prof)), prof, width=len(prof), height=20)
>>> fig.show()

    2 +--------+-------+--------+--------+-------+--------+-------+----***-+
      |                                                            ****    |
  1.5 +                                                         ***        +
      |                                                     ****           |
      |                                                  ***               |
    1 +                                               ***                  +
      |                                           ****                     |
  0.5 +                                        ***                         +
      |                                    ****                            |
    0 +                              ******                                +
      |                             *                                      |
      |                          ***                                       |
 -0.5 +                      ****                                          +
      |                   ***                                              |
   -1 +                ***                                                 +
      |            ****                                                    |
      |         ***                                                        |
 -1.5 +     ****                                                           +
      |  ***                                                               |
   -2 ***------+-------+--------+--------+-------+--------+-------+--------+
      0        5       10       15       20      25       30      35       40

It seems that the plot uses the defaut values for widht and height of the figure. Maybe I did something wrong?

nschloe commented 5 years ago

Seems to work fine here. Try upgrading?

TitouanGendron commented 5 years ago

I am using the 0.2.3 version. If it works for you, then it comes from my computer. Thanks for the help!

nschloe commented 5 years ago

Could also be gnuplot which causes the trouble here.