Missing grid lines when displaying a dataframe in Jupyter - python

I'm working on Jupyter notebook now, just learned to open a csv file with pandas.
However the guy in the video (who explains how to do it) has grids to separate things:
Here are screenshot of his screen and mine respectively:
I hope you understood what I meant, you'll see that grids are missing, I'm just curious where they are. It might not effect my work at Jupyter, but still however.

Related

Weird black marks showing next to certain plots in Python with Matplotlib?

While plotting some time series data I ran into an issue. With 2/15 of my plots I got these weird black marks showing up next to them in Jupyter Notebook.
I tried re-running those specific plots in a normal .py file and I got the same results. So I tried plotting it in Excel instead.
Clearly, these plots are totally different. So something must be messing with the data when it runs through Matplotlib somehow. It looks inverted but not all of the peaks seem to be there. It is strange.
Unfortunately, I can't share my dataset. But I'm wondering if anyone has seen this before and could give me an idea of what is causing this. Because as I mentioned, 13/15 of my plots work perfectly as expected, and the code is the same.

Is there an equivalent to the Matlab figure window in Python (with all tools)?

I'm just wondering if it exists an equivalent to the Matlab figure window in Python where we can modify plots directly from the figure window, or add some features (text, box , arrow, and so on), or make curve fitting, etc.
Matplotlib is good, but it is not as high-level as the Matlab figure. We need to code everything and if we want to modify plots, we need to modify the code directly (except for some basic stuffs like modifing the line color)
With matplotlib, you will indeed remain in the "code it all" workflow. This is not directly the answer you expect but the matplotlib documentation recently gained a very instructive figure that will probably help you if you stay with matplotlib: http://matplotlib.org/examples/showcase/anatomy.html shows the "anatomy" of the figure with all the proper designations for the parts of the figure.
Overall, I could always find examples of what I needed in their excellent gallery http://matplotlib.org/gallery.html
In my opinion, you'll save time by coding these customizations instead of doing them by hand. You may indeed feel otherwise but if not there is a ton of examples of matplotlib code on SO, in their docs and a large community of people around it :-)

Plot Graphs in separated window

I have a long Jupyter notebook code and there is many cells, which are redrawing the actual graph plot. When I am running cells after changing their contents I need to check the plot, but I always need to scroll up and down. I would prefer to watch the plot changes in separated window (I am using two monitors), so I will change the cell content, run the cell, and then just turn my head and see the plot - without any scrolling. Is there a way how to do that? I know it can be done by Spyder, but I want to do it in Jupyter notebook, since I use a lot of notebook advantages, such as Latex notes and headings between cells. Thanks a lot for any advice!
It would be great if you could tell us how you print your graph (what library ?). Ipython provide magic command. For example, if you use matplotlib to plot some figures, just add %matplotlib qt on top of your cell to make the plots appear in a separate window.
See the list of magic command available here.

LightTable and matplotlib subplots

While there are a few things that are still being worked out, I am a big fan of the LightTable editor. The IPython Notebook is a remarkable delivery system, but managing a larger product is a bit easier in a more conventional development environment.
One thing that I have not yet figured out, however, is complicated plotting in LightTable. With no cell equivalent, I am not sure how to modify plot components because each command seems to be considered independently. In particular, I am not clear on how to work with subplots. I am unable to connect the actual plot to the subplot array. For example, consider the following:
fig,ax=plt.subplots(2)
ax[0].hist(np.random.uniform(size=100))
ax[1].hist(np.random.normal(size=100))
When I create the subplots, they show up empty inline. The remaining code, however, does not cause them to update inline. In the Notebook, all the code is considered jointly in batch. LightTable interactivity is a bit closer to dealing with an interpreter in interactive mode (even though the script is obviously preserved). I have experiemented with turning interactivity on and off via plt.ioff(), but to no avail. Any assistance would be greatly appreciated...

How do I get the modern style matplotlib plots often seen in iPython Notebook examples?

Take this page, for example, a sample of which is posted below:
It has matplotlib examples with gray background and more subtle coloring, but when I'm running the same examples, I get the more traditionally colored plots with white background and strong colors. This also seems to be the style used in the pandas documentation.
How can I change the default style locally to match their style?
If you read through the page you linked, just above the Plotting in Pandas section is the following line:
If you want to make your plots look pretty like mine, steal the matplotlibrc file from Huy Nguyen.
In the post is a link to this gist, which contains the matplotlibrc file. Make sure you read through the whole thing and customize it, as for example he has MacOSX as his backend, which you may want to change.
To use the file, save it as ~/.matplotlib/matplotlibrc and restart any running instances of IPython. Your plots should now look prettier :)
As MattDMo mentioned, using a sane matplotlibrc really helps.
The book "Probabilistic-Programming-and-Bayesian-Methods-for-Hackers" also uses a nice matplotlibrc. See this for some examples.
Recently I'm using the package seaborn instead of a custom matplotlibrc not only because it makes my plots look great, but also because it adds some functionality for visualizing distributions, linear models and time series.

Categories