## Problem : Relationship between the length of a film that lasts between 60 and 200 minutes and its average rating

I want to display, with a curve, the relationship between the length of a film that lasts between 60 and 200 minutes and its average rating on IMDb : movies[‘duree’] = movies[(movies.duree<200) | (...

## Plot a histogram where the bars are coloured based on a second list of values

I can plot a histogram in Python for example with matplotlib: from matplotlib import pyplot as plt x = [3,5,12,7,8,6,4,6] plt.hist(x) However I have a second array y = [4,6,8,2,4,5,8,7] where each …

## Matplotlib allign uneven number of subplots

I want to plot 11 figures using subplots. My idea is to have 2 rows: 6 plots on the first, 5 on the second. I use the following code. import matplotlib.pyplot as plt import pandas as pd fig, axes = …

## Python count of words by word length

I was given a .txt file with a text. I have already cleaned the text (removed punctuation, uppercase, symbols), and now I have a string with the words. I am now trying to get the count of characters …

## Adding suffix to labels on x-axis

I need to plot some values referred to time, with specific labels. You can think of my data like the sample below: ID Time Clock 260 21 hours 20:30 # this should be referred to yesterday …

## Plotting x axis with unequally spaced ticks using matplot

I am building ML models and have plotted the recall values at different % of complete data, like so: The y axis represents the recall values, and the x axis shows the percentage of data completeness (…

## def subplot(plt, (Y, X), (sz_y, sz_x) = (10, 10)): throws invalid syntax in Python 3

I am trying to run a code that was originally written for Python 2 for Python 3. The code block is: def draw_bbox(plt, ax, rois, fill=False, linewidth=2, edgecolor=[1.0, 0.0, 0.0], **kwargs): for …

## Matplotlib plot function output differs from seaborn’s lineplot

I want to plot a PDF function given data which follows a normal distribution. Mainly I followed this link. Now, if I am working on the data created like on that website (x=np.linspace()) and I plot it …

## Matplotlib: How to plot sub plots from a table?

I have a code from a dataframe Y = df[‘label’] for col in categorical_cols: tab = pd.crosstab(df[col],Y) annot = x.div(x.sum(axis=1).astype(‘float64′),axis=0) annot.plot(kind=’bar’,stacked=…

## Shrink/adjust the colorbar inside the plot

I am trying to shrink a colorbar, which is positioned inside the plot. When I position it outside of the plot (i. e. pad=0.05), it works just fine. Here’s a MWE: import numpy as np import matplotlib….