With matplotlib I could do this:
import numpy as np
import matplotlib.pyplot as plt
fig, axs = plt.subplots(1, 2, figsize=(10, 5))
fig.patch.set_facecolor('white')
axs[0].bar(x=[0,1,2], height=[1,2,3])
axs[1].plot(np.random.randint(1, 10, 50))
axs[0].set_title('BARPLOT')
axs[1].set_title('WOLOLO')
With plotly I know only one way to set subplot titles -- at the creation:
fig = make_subplots(rows=1, cols=2, subplot_titles=('title1', 'title2'))
Is it possible to set subplots title after creation?
Maybe, through getting access to original Axes
class of matplotlib (I read that plotly.python based on seaborn which is based on matplotlib)?
Or through fig.layout
?
Please use this code:
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(rows=1, cols=2)
fig.add_trace(go.Bar(y=[1, 2, 3]), row=1, col=1)
fig.add_trace(go.Scatter(y=np.random.randint(1, 10, 50)), row=1, col=2)