What do you want to save?
Add Code snippet
New code examples
-
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-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-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 -
Python 2021-09-26 01:33:04
matplotlib get and chan values of tick labels
import matplotlib.pyplot as plt fig, ax = plt.subplots() # We need to draw the canvas, otherwise the labels won't be positioned and # won't have values yet. fig.canvas.draw() labels = [item.get_text() for item in ax.get_xticklabels()] labels[1] = 'Tes... Add solution