- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Interactive plotting with Python Matplotlib via command line
To get interactive plots, we need to activate the figure. Using plt.ioff() and plt.ion(), we can perform interactive actions with a plot.
Open Ipython shell and enter the following commands on the shell.
Example
In [1]: %matplotlib auto Using matplotlib backend: GTK3Agg In [2]: import matplotlib.pyplot as In [3]: fig, ax = plt.subplots() # Diagram will pop up. Let’s interact. In [4]: ln, = ax.plot(range(5)) # Drawing a line In [5]: ln.set_color("orange") # Changing drawn line to orange In [6]: plt.ioff() # Stopped interaction In [7]: ln.set_color("red") # Since we have stopped the interaction in the last step In [8]: plt.ion() # Started interaction
Output
- Related Articles
- Plotting multiple line graphs using Pandas and Matplotlib
- Plotting profile histograms in Python Matplotlib
- Plotting dates on the X-axis with Python's Matplotlib
- Make 3D plot interactive in Jupyter Notebook (Python & Matplotlib)
- Plotting animated quivers in Python using Matplotlib
- MySQL query to discover current default database collation (via command line client)?
- Plotting grids across the subplots in Python Matplotlib
- How get the (x,y) position pointing with mouse in an interactive plot (Python Matplotlib)?
- Plotting scatter points with clover symbols in Matplotlib
- How to deal with NaN values while plotting a boxplot using Python Matplotlib?
- Plotting a cumulative graph of Python datetimes in Matplotlib
- Command Line Automation in Python
- Command Line Arguments in Python
- Command Line Scripts - Python Packaging
- Show MySQL host via SQL Command?

Advertisements