Browse all latest questions tagged Matplotlib
I want to plot a 5 x 4 plots. The code for the same is below fig, axis = plt.subplots(5, 4,figsize=[25,10]) i = 0 for channel in np.unique(data_recent['channel_id']): for year in np.unique(data_r...
train_class = train_df['Class'].value_counts().sortlevel() my_colors = 'rgbkymc' #red, green, blue, black, etc. train_class.plot(kind='bar', color=my_colors) plt.grid() plt.show() I'm getting: Val...
I am plotting some data and I want to automatically generate a report. I can save the plot and then add it to my document. However, I prefer to do it directly, without saving step. Going through the p...
I want to plot a heatmap in seaborn. My code is following: plt.rcParams['font.size'] = 13 plt.rcParams['font.weight'] = 'bold' my_dpi=96 fig, ax = plt.subplots(figsize=(800/my_dpi, 600/my_dpi), dpi=m...
When I plot the feature importance, I get this messy plot. I have more than 7000 variables. I understand the built-in function only selects the most important, although the final graph is unreadable....
How can I label each boxplot in a seaborn plot with the median value? E.g. import seaborn as sns sns.set_style("whitegrid") tips = sns.load_dataset("tips") ax = sns.boxplot(x="day", y="total_bill",...
I know about plot_date() but is there a bar_date() out there? The general method would be to use set_xticks and set_xticklabels, but I'd like something that can handle time scales from a few hours ou...
I have a sequence of line plots for two variables (x,y) for a number of different values of a variable z. I would normally add the line plots with legends like this: import matplotlib.pyplot as plt...
I want to plot a histogram with points and error bars. I do not want bar or step histograms. Is this possible? Google has not helped me, I hope you can. Also it should not be normalized. Thanks!
I try to generate a movie using the matplotlib movie writer. If I do that, I always get a white margin around the video. Has anyone an idea how to remove that margin? Adjusted example from http://ma...
I am trying to make a profile plot for two columns of a pandas.DataFrame. I would not expect this to be in pandas directly but it seems there is nothing in matplotlib either. I have searched around an...
I have a set of points, all together they create a track, where the sequence is crucial. I can plot the track using lines, how could I smooth it after or while new points are fetching? Track might loo...
I am trying to compare wind roses in python, but it is difficult because I cannot figure out how to make the same scale across all of the plots. Someone else asked the same question here Custom perce...
I have a 3d plot of lines generated by matplotlib. I want to overlay an image at a specific xy (or yz, xz) slice. How do I do that using python? Thanks. I have a simple 3d plot code as: fig = plt.fi...
Suppose my data is organized in the following way: x_values = [6.2, 3.6, 7.3, 3.2, 2.7] y_values = [1.5, 3.2, 5.4, 3.1, 2.8] colours = [1, 1, 0, 1, -1] labels = ["a", "a", "b", "a", "c"] I want to...