What do you want to save?
Add Code snippet
New code examples
-
Python 2021-09-25 13:01:03
animate time series python
import numpy as np import matplotlib.pyplot as plt from matplotlib import animation dt = 0.01 tfinal = 1 x0 = 0 sqrtdt = np.sqrt(dt) n = int(tfinal/dt) xtraj = np.zeros(n+1, float) trange = np.linspace(start=0,stop=tfinal ,num=n+1) xtraj[0] = x0 for i ... Add solution -
Python 2021-09-24 23:31:02
matplotlib label axis
# Basic syntax: plt.xlabel("X axis label") # Add ", fontsize = #" to control fontsize plt.ylabel("Y axis label") # Example usage: plt.plot(range(5)) plt.xlabel("X axis label") plt.ylabel("Y axis label") p... Add solution -
Python 2021-09-22 14:23:04
how to plot a linear equation in matplotlib
import matplotlib.pyplot as plt import numpy as np x = np.linspace(-5,5,100) y = 2*x+1 plt.plot(x, y, '-r', label='y=2x+1') plt.title('Graph of y=2x+1') plt.xlabel('x', color='#1C2833') plt.ylabel('y', color='#1C2833') plt.legend(loc='upper left') plt.gri... Add solution -
Python 2021-09-21 12:42:03
ego vehicle coord system parallel to world z plane nuscenes
""" This code is to sort out a reply to https://github.com/nutonomy/nuscenes-devkit/issues/122 """ import numpy as np import matplotlib.pyplot as plt from pyquaternion import Quaternion from nuscenes import NuScenes GLOBA... Add solution -
Python 2021-09-21 03:02:02
how to make a scatter plot matrix iris flower dataset
import matplotlib.pyplot as plt from sklearn.datasets import load_iris import numpy as np #setting the shape of the figure in one line as opposed to creating 12 variables fig, subs = plt.subplots(4,3) #code given in Hyperion notes iris = load_iris() d... 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-17 20:58:01
multiple plot in one figure python
import matplotlib.pyplot as plt plt.plot(<X AXIS VALUES HERE>, <Y AXIS VALUES HERE>, 'line type', label='label here') plt.plot(<X AXIS VALUES HERE>, <Y AXIS VALUES HERE>, 'line type', label='label here') plt.legend(loc='best') plt... Add solution -
Python 2021-09-17 20:52:02
how to import matplotlib.pyplo in python
import matplotlib.pylot as plt Add solution -
Python 2021-09-17 14:02:03
pandas plot histogram
import matplotlib.pyplot as plt data = [1.7,1.8,2.0,2.2,2.2,2.3,2.4,2.5,2.5,2.5,2.6,2.6,2.8, 2.9,3.0,3.1,3.1,3.2,3.3,3.5,3.6,3.7,4.1,4.1,4.2,4.3] #this histogram has a range from 1 to 4 #and 8 different bins plt.hist(data, range=(1,4), bins=8) plt... Add solution