What do you want to save?
Add Code snippet
New code examples
-
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 2021-10-19 12:50:14
seaborn create horizontal bar graph
import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="whitegrid") # Initialize the matplotlib figure f, ax = plt.subplots(figsize=(6, 15)) # Load the example car crash dataset crashes = sns.load_dataset("car_crashes&q... Add solution -
Python 2021-10-09 16:14:09
matplotlib twinx legend
import numpy as np import matplotlib.pyplot as plt from matplotlib import rc rc('mathtext', default='regular') time = np.arange(10) temp = np.random.random(10)*30 Swdown = np.random.random(10)*100-10 Rn = np.random.random(10)*100-10 fig = plt.figure() a... Add solution -
Python 2021-09-19 22:23:03
ax.legend place legend outside plot
import numpy as np import matplotlib.pyplot as plt #Define arrays x, y1, y2, y3 fig = plt.figure() ax = fig.add_axes((0.1,0.4,0.5,0.5)) ax.plot(x1,y1,linestyle='-',label='one') ax.plot(x1,y2,linestyle='--',label='two') ax.plot(x1,y3,linestyle='dotted',... Add solution -
Python 2021-09-08 04:23:03
matplotlib add legend axis x
fig = plt.figure(figsize=(10,5)) ax = fig.add_subplot(111) ax.set_title('ADR vs Rating (CS:GO)') ax.scatter(x=data[:,0],y=data[:,1],label='Data') plt.plot(data[:,0], m*data[:,0] + b,color='red',label='Our Fitting Line') ax.set_xlabel('ADR') ax.set_ylabel... Add solution