Python ASCII plots in terminal

后端 未结 9 2157
一向
一向 2020-12-04 15:39

With Octave I am able to plot arrays to the terminal, for example, plotting an array with values for the function x^2 gives this output in my terminal:

9条回答
  •  暖寄归人
    2020-12-04 16:00

    You can also try Sympy's TextBackend for plots, see doc. Or just use textplot.

    Here it is an example

    from sympy import symbols
    from sympy.plotting import textplot
    x = symbols('x')
    textplot(x**2,0,5)
    

    with the output

    24.0992 |                                                      / 
            |                                                    ..  
            |                                                   /    
            |                                                 ..     
            |                                               ..       
            |                                              /         
            |                                            ..          
            |                                          ..            
    12.0496 | ---------------------------------------..--------------
            |                                     ...                
            |                                   ..                   
            |                                 ..                     
            |                              ...                       
            |                           ...                          
            |                        ...                             
            |                   .....                                
            |              .....                                     
          0 | .............                                          
              0                      2.5                        5    
    

提交回复
热议问题