import numpy
import pylab
if __name__ == "__main__":
xvals = numpy.arange (-10.0, 10.1, 0.1)
yvals = numpy.sinc (xvals)
pylab.plot (xvals, yvals)
pylab.text (0.1, 1.1, u'color="blue"', color="blue")
pylab.text (0.4, 1.0, u'color="r"', color="r")
pylab.text (0.7, 0.9, u'color="#11aa55"', color="#11aa55")
pylab.text (1.0, 0.8, u'color=(0.4, 0.5, 0.3)', color=(0.4, 0.5, 0.3))
pylab.text (1.3, 0.7, u'color="0.7"', color="0.7")
pylab.show()
Ёзув фори рангини ўрнатиш. Параметр backgroundcolor
Belgilangan fon rang rangi parametri yozuvning fon rangini belgilaydigan rang parametrlari bilan bir xil ishlaydi, quyidagi misolda ko'rsatilgandek.
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy
import pylab
if __name__ == "__main__":
xvals = numpy.arange (-10.0, 10.1, 0.1)
yvals = numpy.sinc (xvals)
pylab.plot (xvals, yvals)
pylab.text (0.1, 1.1, u'backgroundcolor="yellow"', backgroundcolor="yellow")
pylab.text (0.4, 1.0, u'backgroundcolor="r"', backgroundcolor="r")
pylab.text (0.7, 0.9, u'backgroundcolor="#11aa55"', backgroundcolor="#11aa55")
pylab.text (1.0, 0.8, u'backgroundcolor=(0.4, 0.5, 0.3)', backgroundcolor=(0.4, 0.5, 0.3))
pylab.text (1.3, 0.7, u'backgroundcolor="0.7"', backgroundcolor="0.7")
pylab.show()
Ёзув шаффофлигини ўрнатиш. Параметр alpha
Nomlangan parametr alfa yorliqning shaffofligini belgilaydi. Qiymat 0 (to'liq shaffof matn) va 1 (to'liq shaffof bo'lmagan matn) o'rtasida bo'lishi kerak.
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy
import pylab
if __name__ == "__main__":
xvals = numpy.arange (-10.0, 10.1, 0.1)
yvals = numpy.sinc (xvals)
pylab.plot (xvals, yvals)
pylab.text (4.0, 1.1, u"Transparent text. alpha = 0.1", alpha=0.1)
pylab.text (4.0, 1.02, u"Transparent text. alpha = 0.3", alpha=0.3)
pylab.text (4.0, 0.94, u"Transparent text. alpha = 0.5", alpha=0.5)
pylab.text (4.0, 0.86, u"Transparent text. alpha = 0.7", alpha=0.7)
pylab.text (4.0, 0.78, u"Transparent text. alpha = 0.9", alpha=0.9)
pylab.show()
Матнни буриш. Параметр rotation
Matnni ma'lum bir burchakka burish uchun ekranning burchagi parametridan foydalaniladi, u burchakning butun sonini olishi mumkin (burchakning kasr qismi o'chiriladi) yoki mumkin bo'lgan satr qiymatlaridan biri: matnni gorizontal ravishda ko'rsatish uchun "gorizontal", "vertikal" uchun. matnni vertikal ravishda chiqarish.
#!/usr/bin/python
# -*- coding: UTF-8 -*-
Do'stlaringiz bilan baham: |