What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-01 01:54:02
python add a point to a plot
# Basic syntax plt.plot(x, y, 'marker') # Example usage: import matplotlib.pyplot as plt import numpy as np # Data to plot x = np.linspace(0, 10, 100) # Plot figure fig = plt.figure() plt.plot(x, np.sin(x), '-') # Add point plt.plot(5, 0, 'ro') # Not... Add solution -
Python 2021-09-30 18:21:04
bar chart in python
import numpy as np import matplotlib.pyplot as plt data = [[30, 25, 50, 20], [40, 23, 51, 17], [35, 22, 45, 19]] X = np.arange(4) fig = plt.figure() ax = fig.add_axes([0,0,1,1]) ax.bar(X + 0.00, data[0], color = 'b', width = 0.25) ax.bar(X + 0.25, data[1]... Add solution -
Python 2021-09-30 02:00:07
set axis labels python
# 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-29 11:58:05
cmap perlin noise python
import random from perlin_noise import PerlinNoise import matplotlib.pyplot as plt noise = PerlinNoise(octaves=10, seed=random.randrange(1,1000000000000000)) xpix, ypix = 100, 100 pic = [[noise([i/xpix, j/ypix]) for j in range(xpix)] for i in range(ypix)... Add solution -
Python 2021-09-28 23:00:03
y =mx+c trend analysis in for a column of dataframe
import matplotlib.pyplot as pltimport matplotlib.dates as mdatesfig, ax = plt.subplots()ax.grid(True)year = mdates.YearLocator(month=1)month = mdates.MonthLocator(interval=3)year_format = mdates.DateFormatter('%Y')month_format = mdates.DateFormatter('%m')... Add solution -
TypeScript 2021-09-28 22:04:04
dist subplots in seaborn python
import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set(style="white", palette="muted", color_codes=True) rs = np.random.RandomState(10) # Set up the matplotlib figure f, axes = plt.subplots(2, 2, figsize=(7,... Add solution -
Python 2021-09-28 21:03:03
matplotlib multiple plots with different size
import numpy as np import matplotlib.pyplot as plt # generate some data x = np.arange(0, 10, 0.2) y = np.sin(x) # plot it f, (a0, a1) = plt.subplots(1, 2, gridspec_kw={'width_ratios': [3, 1]}) a0.plot(x, y) a1.plot(y, x) f.tight_layout() f.savefig('gr... Add solution