The import numpy as np
The import matplotlib. Pyplot as PLT
The from pylab import *
N=256
X=np. Linspace (0, 2, n)
Y=np. Sin (2 * np. PI * X)
PLT. The plot (X, Y, lw=2, color='violet')
PLT. Xlim (0.2, 2.2), PLT. Xticks ([])
PLT. Ylim (1.2, 1.2), PLT. Yticks ([])
PLT. Text (0.05, 1.05, "Regular Plot \ n",
Horizontalalignment='left',
Verticalalignment='top',
Family='Lint McCree Intl BB',
Size='x - large,
Bbox=dict (facecolor='white', alpha=1.0, width=350, height=60),
Transform=PLT. Gca (.) transAxes)
PLT. Text (0.05, 975, "the Plot lines and/or markers",
Horizontalalignment='left',
Verticalalignment='top',
Family='Lint McCree Intl BB',
Size='medium',
Transform=PLT. Gca (.) transAxes)
PLT. The show ()
The above Settings will be an error
CodePudding user response:
N=256X=np. Linspace (0, 2, n)
Y=np. Sin (2 * np. PI * X)
PLT. The plot (X, Y, lw=2, color='violet')
PLT. Xlim (0.2, 2.2), PLT. Xticks ([])
PLT. Ylim (1.2, 1.2), PLT. Yticks ([])
PLT. Text (0.05, 1.08, "Regular Plot",
Horizontalalignment='left',
Verticalalignment='top',
Family='serif,
Size='x - large,
Bbox=dict (boxstyle='square, pad=0.4, facecolor=' white ', alpha=1.0, lw=2),
Transform=PLT. Gca (.) transAxes)
PLT. Text (0.05, 975, "the Plot lines and/or markers",
Horizontalalignment='left',
Verticalalignment='top',
Family='serif,
Size='medium',
Transform=PLT. Gca (.) transAxes)
PLT. The show ()
Added a boxstyle='square, pad=0.4' parameters, adjust the pad size, the size of the box will be, you try
CodePudding user response:
The width and height is not such as proportion, to be like this