1
A
回答
0
對Style
類有一個to_dict
方法,對創建自定義樣式非常有幫助。
>>> CleanStyle.to_dict()
{'opacity': '.8', 'foreground': 'rgba(0, 0, 0, 0.9)', 'plot_background': 'rgba(240, 240, 240, 0.7)', 'stroke_style': 'round', 'foreground_light': 'rgba(0, 0, 0, 0.9)', 'transition': '250ms', 'foreground_dark': 'rgba(0, 0, 0, 0.5)', 'stroke_dasharray': '0,0', 'opacity_hover': '.9', 'stroke_width': 1.0, 'colors': ('rgb(12,55,149)', 'rgb(117,38,65)', 'rgb(228,127,0)', 'rgb(159,170,0)', 'rgb(149,12,12)'), 'background': 'transparent', 'font_family': 'monospace'}
下面介紹瞭如何創建粗筆觸寬度的自定義樣式。
>>> from pygal.style import Style, CleanStyle
>>> style_arg = CleanStyle.to_dict()
>>> style_arg['stroke_width']=10
>>> HeavyCleanStyle = Style(**style_arg)
>>> HeavyCleanStyle.to_dict()
{'opacity': '.8', 'foreground': 'rgba(0, 0, 0, 0.9)', 'plot_background': 'rgba(240, 240, 240, 0.7)', 'stroke_style': 'round', 'foreground_light': 'rgba(0, 0, 0, 0.9)', 'transition': '250ms', 'foreground_dark': 'rgba(0, 0, 0, 0.5)', 'stroke_dasharray': '0,0', 'opacity_hover': '.9', 'stroke_width': 10.0, 'colors': ('rgb(12,55,149)', 'rgb(117,38,65)', 'rgb(228,127,0)', 'rgb(159,170,0)', 'rgb(149,12,12)'), 'background': 'transparent', 'font_family': 'monospace'}
相關問題
- 1. 如何改變pygal的筆畫顏色?
- 2. CAShapeLayer更改不同筆刷的寬度
- 3. 如何在不更改inkscape中的筆觸寬度的情況下更改一條線的寬度?
- 4. SVG中的固定筆畫寬度
- 5. 如何更改沿路徑/線條的筆觸寬度?
- 6. 如何更改UITableviewCell寬度
- 7. 如何更改FBLoginView寬度
- 8. Pygal在Jupyter筆記本中呈現SVG
- 9. 如何在flash html5畫布中更改動畫片段的寬度?
- 10. 筆畫寬度= 1px的線的外觀
- 11. Android,查看寬度更改動畫?
- 12. 更改表格寬度動畫
- 13. 對ImageView寬度的動畫更改
- 14. 用點擊功能改變svg圖像的筆畫寬度jquery
- 15. 如何更改iPad中UIActionSheet的寬度?
- 16. dc.js - 如何設置畫筆(具體寬度),以BARCHART負載
- 17. 如何繪製一個可變的筆畫寬度的路徑
- 18. 如何動畫視圖的筆劃寬度
- 19. 如何用動畫從左到右更改CALayer的寬度?
- 20. 動畫在不同時間更改高度和寬度
- 21. 在dc.js(有序)圖表中限制畫筆寬度?
- 22. 在ImageView中drawLine()與SeekBar的筆畫寬度發生了變化
- 23. 平滑的線條寬度在畫布行中更改爲
- 24. SVG標記刻度只有一個維度與筆畫寬度
- 25. TTStyledTextLabel如何更改方向更改的寬度/高度?
- 26. 更改繪畫顏色時,現有筆畫也會更改
- 27. 更改寬度SysIPAddress32
- 28. 更改表寬度
- 29. 如何更改寬度<th>而不會影響寬度
- 30. 如何更改字面畫布中的筆劃顏色
也許你需要此設置:http://www.pygal.org/en/latest/api/pygal.config.html?highlight=stroke_style#pygal.config.Config.width – 2015-11-18 17:31:29