Python Pyx图:用虚线改变点之间的间距

时间:2018-05-31 09:42:04

标签: python plot pyx

我在Pyx模块中用Python绘图:

server-id               = 1
#report_host            = master1
#auto_increment_increment = 2
#auto_increment_offset  = 1
log_bin                 = /var/log/mysql/mariadb-bin
log_bin_index           = /var/log/mysql/mariadb-bin.index
binlog_format           = row
binlog_row_image        = full
# not fab for performance, but safer
#sync_binlog            = 1
expire_logs_days        = 10
max_binlog_size         = 100M
# slaves
#relay_log              = /var/log/mysql/relay-bin
#relay_log_index        = /var/log/mysql/relay-bin.index
#relay_log_info_file    = /var/log/mysql/relay-bin.info
#log_slave_updates
#read_only

如何用虚线更改点之间的间距?

1 个答案:

答案 0 :(得分:0)

只需使用自己的linestyle设置:

c = canvas.canvas()
c.stroke(path.line(0, 0, 10, 0), [style.linestyle(style.linecap.round, style.dash([0, 2]))])
c.stroke(path.line(0, -1, 10, -1), [style.linestyle(style.linecap.round, style.dash([0, 4]))])
c.stroke(path.line(0, -2, 10, -2), [style.linestyle(style.linecap.round, style.dash([0, math.pi])), style.linewidth(0.1)])
c.writePDFfile(page_bboxenlarge=1)

第一行与style.linestyle.dotted相同,第二行使用两次点之间的距离,第三行显示浮点作为距离并更改线宽。请注意,线宽定义了点的大小,并且还更改了点之间的距离,因为短划线的值是通过线宽缩放的。虚线由虚线构成,短划线为零,style.linecap.round为线帽设置。

请注意,首先应用线宽(归因顺序......没有详细记录的内容)。