Last modified: 12 December 2018

Can I use ChIPS and Matplotlib at the same timeĀ [New]


Yes, it is possible to create Matplotlib plots within the ChIPS shell, or import both ChIPS and Matplotlib in the same Python session. As an example:

chips> chips
-----------------------------------------
Welcome to ChIPS: CXC's Plotting Package
-----------------------------------------
CIAO 4.11 ChIPS version 1 Wednesday, December 5, 2018

Python 3.5.4 (default, Sep 14 2018, 15:42:52) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.

IPython profile: chips

chips In [1]: x = np.arange(-4, 4, 0.05)

chips In [2]: y = np.sin(x) * np.cos(x / 3)

chips In [3]: add_curve(x, y, ['symbol.style', 'none'])
Gtk-Message: Failed to load module "atk-bridge"

chips In [4]: import matplotlib.pyplot as plt

chips In [5]: %matplotlib
Using matplotlib backend: TkAgg

chips In [6]: plt.plot(x, y)
Out[6]: [<matplotlib.lines.Line2D at 0x7f4a73bb7828>]

chips In [7]:

creates both

[The curve plotted in ChIPS]

and

[The curve plotted in Matplotlib]

Please see the ChIPS to Matplotlib conversion guide for more information on how to use Matplotlib for your data visualization.