Jupyter not showing proper matplotlib plots and seaborn plots - matplotlib

I tried to do a box plot with salary and loan. However its not showing even though the code is correct. And I tried with matplotlib plots, it doesnt work as well.
Here is the code

Related

Removing background on a 3d plot Julia

I am having some real trouble trying to plot nice things with Julia.
I first used PyPlot which I was happy with but I had to be able to change the angle on a 3D plots (in that case using surface) so I now use Plots directly with the camera speficication. I would like to remove the background on a 3D plot.
using PyPlot, the following command :
ax=gca(); ax:set_axis_off
works fine.
When using Plots, I tried the following :
using Plots; pyplot(grid=false)
and then my code for the surface, and it does not change the output.
I also tried the first example on this page :https://github.com/JuliaPlots/Plots.jl/pull/695 and grid specification does not work (grids are the same on every area of the layout).
I tried after updating every package and it still does not work.
Does anyone have an idea about what would the problem be please?
Thank you in advance !

matplotlib: box plot for each category

My pandas data frame has two columns: category and duration. And
I use the following code to make a box plot of all data points.
import matplotlib.pyplot as plt
plt.boxplot(df.duration)
plt.show()
However, if I want one box fore each category, how do I modify the above code? Thanks!
In addition to Wen's answer, which is spot on, you might want to check out the seaborn library. It was made to do this kind of plot.
Seaborn is a Python visualization library based on matplotlib. It
provides a high-level interface for drawing attractive statistical
graphics.
Check the documentation for boxplots
Draw a box plot to show distributions with respect to categories.
sns.boxplot(data=df, x='category', y='duration')
We can do it with pandas
#df=pd.DataFrame({'category':list('aacde'),'duration':[1,3,2,3,4]}) sample data
df.assign(index=df.groupby('category').cumcount()).pivot('index','category','duration').plot(kind='box')

speed up embedded matplotlib plots

I have a fairly complicated qt4 gui with a number of matplotlib plots as shown in the picture. Each plot plots one channel of data and there are 12 channels in total. The vertical scroll bar on the right adjusts the range of channels to plot. The problem is the gui works pretty sluggishly. When the scroll bar is moved, it takes about 2 seconds to refresh the plots. Is there any way to speed it up?
The entire code is fairly large to post here. But I am using
matplotlib.backends.backend_qt4agg as the backend and use canvas.draw() to refresh each plot. Thanks!

Plots Frame (including axes) blackened in Qtconsole

When I launch qtconsole with the --colors=linux option and plot something the frame of the plot is blackened so I cannot see the axes because the qtconsole background is also black.
I used to launch this before without problem but have this problem after a recent update of pandas. I am not sure about what changed but I thought there might be a setting I can change to fix this anyway without worrying about what the update modified that broke this.
It looks like the axes are set to transparent by default (this was not happening before).
The following plots as desired, showing the white axes on black background:
import pandas as pd
import matplotlib.pylab as plt
fig = plt.figure()
fig.patch.set_alpha(1)
temp = pd.Series(range(100))
temp.plot()
I would also like to set this behavior as the default one. I have not been able to do that yet. This seemed like a good lead,
http://matplotlib.org/users/customizing.html
but I could not find an option for exactly that yet.
Any suggestion is welcome. Thank you.

python odd axis ticks, matplotlib

I'm currently struggeling with an odd displaying error. Seems like my ticks on the axes are only shown right, if they only consist of one number. Even when I manually set the ticks.
I'm using matplotlib. Here is an example figure:
My problem are the rectangles shown after or around the numbers.