0

I was wondering if I can manipulate properties of variable {count} after string in suptitle to change variable's color, location(by printing in next line center) and font size.

So far I can print it out like this in middle above of picture:

Analysis of data in cycle Nr.:0000

 plt.suptitle(f'Analysis of data in cycle Nr.: {count}', color='yellow', backgroundcolor='black', fontsize=48, fontweight='bold')

Any ideas or trick to access to variable properties? I expect output would be like below :

Analysis of data in cycle Nr.:
0000 (diffrenet color and font size)

Mario
  • 1,631
  • 2
  • 21
  • 51
  • Possible duplicate of [Figure title with several colors in matplotlib](https://stackoverflow.com/questions/9350171/figure-title-with-several-colors-in-matplotlib) – Diziet Asahi Jan 07 '19 at 19:26

1 Answers1

0

Don't use suptitle for that. use fig.text(x,y,"Text", args)

# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt

fig = plt.figure()
fig.text(0,0, 'Some Text', color='red')
fig.text(0.2,0.95, 'superDuperCool:', fontsize=12, fontweight='bold')
fig.text(0.45,0.95,'9001', fontsize=14, fontweight='bold', color='green')
ax = fig.add_subplot(111)
fig.subplots_adjust(top=0.85)
ax.set_title('axes title')
ax.set_xlabel('xlabel')
ax.set_ylabel('ylabel')    
ax.plot([2], [1], 'o')
ax.annotate('annotate', xy=(2, 1), xytext=(3, 4),
        arrowprops=dict(facecolor='black', shrink=0.05))
ax.axis([0, 10, 0, 10])

plt.show()
RobH83
  • 1