set title matplotlib
import matplotlib.pyplot as plt
fig, axs = plt.subplots(1, 2)
axs[0].set_title('TITLE1')
set title matplotlib
import matplotlib.pyplot as plt
fig, axs = plt.subplots(1, 2)
axs[0].set_title('TITLE1')
plt title color
import matplotlib.pyplot as plt
import numpy as np
from numpy.random import randn
fig = plt.figure()
data = np.clip(randn(250,250),-1,1)
cax = plt.imshow(data, interpolation='nearest')
title_obj = plt.title('my random fig') #get the title property handler
plt.getp(title_obj) #print out the properties of title
plt.getp(title_obj, 'text') #print out the 'text' property for title
plt.setp(title_obj, color='r') #set the color of title to red
axes_obj = plt.getp(cax,'axes') #get the axes' property handler
ytl_obj = plt.getp(axes_obj, 'yticklabels') #get the properties for
# yticklabels
plt.getp(ytl_obj) #print out a list of properties
# for yticklabels
plt.setp(ytl_obj, color="r") #set the color of yticks to red
plt.setp(plt.getp(axes_obj, 'xticklabels'), color='r') #xticklabels: same
color_bar = plt.colorbar() #this one is a little bit
cbytick_obj = plt.getp(color_bar.ax.axes, 'yticklabels') #tricky
plt.setp(cbytick_obj, color='r')
plt.savefig('temp.png')
plt.savefig('temp2.png', facecolor="black", edgecolor="none")
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us