[Matplotlib-users] matplotlib interactive in a shell terminal?

Raphael Raccuia rafael.raccuia at blindekinder.com
Mon May 18 05:51:54 EDT 2020


Hi,
thank you for your answers!

I saw about ipython, I would have used that but I use the [shell] object 
in Puredata (music object programmation language) which just send 
commands to terminal, that's why...
There is a Python object, but only works with 2.7.

rph-r

Le 18.05.20 à 11:08, Juan Nunez-Iglesias a écrit :
> Hi Raphael,
>
> Have you seen IPython? It was created precisely for this use case.
>
> http://ipython.org/
>
> Depending on your setup, you will want to `pip install ipython`, `conda install ipython`, or `sudo apt install ipython`. (I don't recommend `sudo pip install [anything]`.)
>
> Once you are in IPython, you can run your script with `%run -i my_script.py`, and get your prompt, from which you can control the plot or create other plots.
>
> I also recommend you use conda environments for development:
>
> https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html
>
> I hope this helps!
>
> Juan.
>
> On Mon, 18 May 2020, at 3:33 AM, Raphael Raccuia wrote:
>> Hi,
>> Any chance  to use matplotlib in a linux shell terminal?
>>
>> if I make 'python3 my/script.py', it displays the plot but I have no
>> prompt >>>.
>> It works in Idle.
>> That would be my test script:
>>
>> #!/usr/bin/env python3 #otherwise loads a 'ghost': cursor turn to cross,
>> but no window.
>>
>> import matplotlib
>> print(matplotlib.get_backend()) #print TkAgg in the terminal
>>
>> import matplotlib.pyplot as plt
>>
>> plt.ion()
>>
>>
>> plt.plot([1, 2, 3, 4], [1, 4, 2, 3])
>>
>> plt.show(block=True) #block=True: othewise it close immediately plot and
>> terminal
>>
>> thank you!
>>
>> rph-r
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users at python.org
>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users



More information about the Matplotlib-users mailing list