INFORMS Open Forum

Plots using Python if ($('.thread-icon-follow').length !== 0) {$('.thread-icon-follow').on('click', function () { var $this =$(this); hl_common_ui_blockUI(); HigherLogic.Util.post( '/higherlogic/ui/mvc/Directory/Following/ToggleFollower', JSON.stringify({ itemKey: $this.data('item-key') }), 'json' ).done(function() { var icon =$this.find('i'); icon.toggleClass('fal').toggleClass('fas'); icon.prop('title', icon.hasClass('fal') ? 'Subscribe' : 'Unsubscribe'); \$this.attr('aria-label', icon.hasClass('fal') ? 'Subscribe' : 'Unsubscribe'); hl_common_ui_unBlockUI(); }); }); }

• 1.  Plots using Python

Posted 01-25-2018 02:29
Hello,
I am trying to get my hands dirty with Python. It is impressive with quite a number of sophisticated packages with a wide online support.
Looking out for packages recommendation for plots, especially was wondering to create overlay histograms.

------------------------------
Varalakshmi Tyaggarajan
University of Washington-Tacoma
Tacoma WA
------------------------------

• 2.  RE: Plots using Python

Posted 01-26-2018 06:55
The package matplotlib provides much of the functionality one gets with Matlab.
I'm sure the plot routine you want will be available within matplotlib.
Google "create overlay histograms with matplotlib in python".

------------------------------
Robert Vanderbei
Professor
Princeton University
Princeton NJ
------------------------------

• 3.  RE: Plots using Python

Posted 01-26-2018 07:22
I also recommend using matplotlib. I found this plotting tutorial very helpful for doing twin axes with lines so could help with your histogram.

------------------------------
Destenie Nock
PhD Student
Univ of Mass Amherst
------------------------------

• 4.  RE: Plots using Python

Posted 01-26-2018 09:20
Take a look at HoloViews (http://holoviews.org/).  It can do the overlay histograms that you want (among many other features that make plotting really easy).

For a good tutorial on doing visualization with HoloViews, including how to set up  your environment, see the instructions at http://pyviz.org/

------------------------------
-Irv Lustig
Optimization Principal
Princeton Consultants
------------------------------

• 5.  RE: Plots using Python

Posted 01-30-2018 12:22
For an overview and comparison of plotting options in Python, the places to start are Jake VanderPlas talk The Python Visualization Landscape given at Pycon 2017, https://youtu.be/FytuB8nFHPQ.  Also an article with examples by Dan Saber A Dramatic Tour through Python's Data Visualization Landscape (including ggplot and Altair) https://dsaber.com/2016/10/02/a-dramatic-tour-through-pythons-data-visualization-landscape-including-ggplot-and-altair/

Generally

1. Matplotlib.  This is the baseline standard. You can do anything you can think of, but it may be very complicated. So there are a few libraries that exist to provide more compact and expressive access to this.

2. Then some libraries trying to make Matplotlib easier to work with

pandas.  If you are using pandas to provide data frames anyway, pandas provides simple plotting given the fact that your data is in dataframes.  I will use this for exploratory data analysis, then when I'm pretty sure what type of charts I want to use, switch to something else (seaborn, plotnine, matplotlib)

Seaborn. A more expressive chart specification. Not as far as learning a grammar of graphics, but trying to make a well defined subset of Matplotlib easy to work with.

3. For those of us who come from R, there are some packages that implement a grammar of graphics (a la ggplot2).  The general idea is to separate the specification of the plot from the data, so you can swap out data as needed, and when developing a chart, you can switch visualizations without starting from scratch.  There are a couple packages that pretend to be a grammar (they really are API translaters, which is not the same thing. Implementation on grammar of graphics include

plotnine - implementation of a grammar of graphics.  For people coming from R, they reproduced (generally) the API (function names and usage) in addition to implementing the grammar.
Altair - I actually don't know anything about it, but Jake Vanderplas and Dan Saber seem to like it in their overviews.

4.  interactive plots in the browser. A last group is if you are trying to create interactive plots (you are building a data exploration tool for someone in a web interface). So your client can do things like zoom in, zoom around, and generally play with plot options live.

bokeh - by same
plotly (commercial, but most of it is available in the free version)

------------------------------
Louis Luangkesorn
Assistant Professor
Department of Industrial Engineering
University of Pittsburgh
Pittsburgh PA
------------------------------