What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-08 05:13:03
trends in yearly data python
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 -
Python 2021-10-06 10:59:02
annotate diagonal python
import matplotlib.pyplot as plt import numpy as np def addtext(ax, props): ax.text(0.5, 0.5, 'text 0', props, rotation=0) ax.text(1.5, 0.5, 'text 45', props, rotation=45) ax.text(2.5, 0.5, 'text 135', props, rotation=135) ax.text(3.5, 0.... Add solution -
Python 2021-10-05 07:34:04
how to change the colour of axes in matplotlin
import matplotlib.pyplot as plt with plt.rc_context({'axes.edgecolor':'orange', 'xtick.color':'red', 'ytick.color':'green', 'figure.facecolor':'white'}): # Temporary rc parameters in effect fig, (ax1, ax2) = plt.subplots(1,2) ax1.plot(range(10... Add solution -
Python 2021-10-05 03:19:02
python decrease gap between subplot rows
# Short answer: # If you have too much white space between rows (or columns) of a figure # with subplots, you can either shrink the vertical (or horizontal) # dimensions of the figure with figsize so that they get more "squished" # together, or... Add solution -
Other 2021-10-04 05:27:02
multiple bars barchart matplotlib
ax = plt.subplot(111) w = 0.3 ax.bar(x-w, y, width=w, color='b', align='center') ax.bar(x, z, width=w, color='g', align='center') ax.bar(x+w, k, width=w, color='r', align='center') ax.xaxis_date() ax.autoscale(tight=True) plt.show() Add solution -
Python 2021-10-04 03:09:02
logarithmic scale fitting python
fig=plt.figure() ax = fig.add_subplot(111) z=np.arange(1, len(x)+1) #start at 1, to avoid error from log(0) logA = np.log(z) #no need for list comprehension since all z values >= 1 logB = np.log(y) m, c = np.polyfit(logA, logB, 1, w=np.sqrt(y)) # fi... Add solution -
Other 2021-10-03 21:09:05
show multiple matplotlib images
import numpy as np import matplotlib.pyplot as plt w = 10 h = 10 fig = plt.figure(figsize=(8, 8)) columns = 4 rows = 5 for i in range(1, columns*rows +1): img = np.random.randint(10, size=(h,w)) fig.add_subplot(rows, columns, i) plt.imshow(im... Add solution -
Python 2021-10-03 02:51:02
plot data python
names = ['group_a', 'group_b', 'group_c'] values = [1, 10, 100] plt.figure(figsize=(9, 3)) plt.subplot(131) plt.bar(names, values) plt.subplot(132) plt.scatter(names, values) plt.subplot(133) plt.plot(names, values) plt.suptitle('Categorical Plotting') ... Add solution -
Python 2021-10-02 15:03:04
how to place a plot in a tkinter frame
from tkinter import * from pandas import * from math import sin import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg # Data for plot df = DataFrame({'A': range(20), 'B': [sin(i) for i in range(20... Add solution