What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-28 15:50:09
how to find the accuracy of linear regression model
# Simple Linear Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Salary_Data.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, 1].values # Sp... Add solution -
Python 2022-02-18 09:15:04
matplotlib change bar color under threshold
import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) N = 5 ind = np.arange(N) width = 0.5 vals = [1,2,3,4,5] colors = ['r','b','b','b','b'] ax.barh(ind, vals, width, color=colors) plt.show() Add solution -
Python 2022-02-16 01:10:02
matplotlib plot two graphs side by side
import matplotlib.pyplot as plt import numpy as np # Simple data to display x = np.linspace(0, 2 * np.pi, 400) y = np.sin(x ** 2) # the container holding the two Axes have already been unpacked # useful if just few Axes have been created f, (ax1, ax2) ... Add solution -
Python 2022-02-15 20:00:08
how to plot side by side bar horizontal bar graph in python
import pandas import matplotlib.pyplot as plt import numpy as np df = pandas.DataFrame(dict(graph=['Item one', 'Item two', 'Item three'], n=[3, 5, 2], m=[6, 1, 3])) ind = np.arange(len(df)) width = 0.4 fig, ax = plt.subplots... Add solution -
Python 2022-02-13 16:05:11
connect a mean value to histogram pandas
import numpy as np import matplotlib.pyplot as plt np.random.seed(6789) x = np.random.gamma(4, 0.5, 1000) result = plt.hist(x, bins=20, color='c', edgecolor='k', alpha=0.65) plt.axvline(x.mean(), color='k', linestyle='dashed', linewidth=1) min_ylim, max_... Add solution