How to load customizations for matplotlib graphs? - python

I have used customization using css and other scripts for matplotlib graphs on ipython notebooks. Can I use the customization scripts for the code being run on terminal? How?

Matplotlib allows customizations using so called rcParams. The documentation is pretty easily accessible:
http://matplotlib.org/users/customizing.html

Related

Drawing on jupyter notebooks on DataSpell

I know this is "seeking for recommendations", but I have no experience with this.
I'm looking for a library for basic drawing in jupyter notebooks.
In particular I don't want libraries like plotly or matplotlib, since I don't need to draw graphs.
I'm looking for something like Canvas for JS.
I've already tested ipycanvas and tkinter but they don't work on DataSpell:
You can use the package turtle to produce drawings in Python.

Integrating Plotly inside WxPython

Plotly says it is a web library. Matplotlib does support Wxpython but comparatively, it is too low level. Is there any way to integrate Plotly inside a Wxpython GUI or are there any alternative for it?
You might be able to use Plotly's ability to export plots to images to get the plots into wxPython:
https://plot.ly/python/offline/#static-image-export
If you need the live plotting though, then you will need to use Webview:
https://wxpython.org/Phoenix/docs/html/wx.html2.WebView.html
I also see that Plotly can now be used offline, so if you used that plus Webview, it should work.
Wxpython webview doesn't support 3-d graphs from plotly.
For 3-d graphs, I used cefpython. It embeds a full chromium browser inside python application. wxpython example can be found here: https://github.com/cztomczak/cefpython/blob/master/examples/wxpython.py.
I used plotly offline, and read the file inside cefpython.

iGraph won't plot from function - Python

So I'm setting up iGraph, and I'm having issues with the plot showing up.
The simple code is this
import iGraph
igraph.plot(igraph.Graph.Tree(127,2), layout='tree')
this will plot when i type it directly into python compiler (i'm using canopy)
But when trying to run it through the intpreter it does not display?
I assume this is a very basic issue but cannot seem to understand why it is occurring.
The Canopy GUI's default graphical backend is Qt. Most likely igraph uses a different graphical backend which conflicts with Qt. Try disabling Canopy's default Pylab mode in the Preferences dialog (Python tab). For more information, see https://support.enthought.com/hc/en-us/articles/204469880

Distributing an interactive matplotlib plot

I have a Python script that generates an interactive matplotlib plot with several sliders and radio buttons using the matplotlib.widgets submodule. I'd like to let others play with the resulting plot without having to install python, scipy, numpy, and matplotlib.
I first tried converting my python script to a stand-alone executable that I could distribute. This turned out to be a nightmare - every package I tried (pyinstaller, py2exe, cx_Freeze) failed for one reason or another. The main issue I had was with integrating various scipy and matplotlib libraries, and I'm now very pessimistic about successfully "freezing" my interactive plot.
My next idea was to see if I could get some interactivity through a web browser. Using an IPython notebook with the third-party package JSAnimation initially seemed very promising (http://nbviewer.ipython.org/github/jakevdp/JSAnimation/blob/master/animation_example.ipynb), but it seems that the package only supports the matplotlib "animate" function. This doesn't quite fit the bill for what I'd like to do, as I have multiple sliders which 1) doesn't seem to be supported by this package, and 2) even if supported, would likely result in too many static figures to pre-render effectively, since any such arrangement would require snapshots for every possible combination of the three variables.
Any ideas for how to get this interactive matplotlib plot to others without requiring them to install Python?

IPython Pylab Configuration - imshow interpolation

I have been working with IPython for several months now and I think it is one of the best interactive shells I've used. I especially like the built in matplotlib support through pylab.
One issue I have had is that I am working with image analysis and often plot images and other arrays using imshow. When using pure matplotlib, I have the ability to set the default interpolation as nearest using the matplotlibrc file. I have not been able to find such a file for the built in matplotlib in IPython.
Is there a way to configure IPython and Pylab to use nearest interpolation by default instead of bilinear? I have read the IPython documentation regarding configuration and customization and I'm not sure I follow how to access such specific properties.

Categories