Pythonpychart画图几种常见的形式

更新时间:2023-06-21 21:16:11 阅读: 评论:0

Pythonpychart画图⼏种常见的形式
在讲述之前先看⼀个图的基本元素:
1 线状图:
代码:(⾮⾃⼰创作,解析来⾃⾃带例⼦)
屏保时间在哪里设置from pychart import *
<_options()
data = [(10, 20, 30), (20, 65, 33), (1)
(30, 55, 30), (40, 45, 51),
(50, 25, 27), (60, 75, 30),
(70, 80, 42), (80, 62, 32),
(90, 42, 39), (100, 32, 39)]
xaxis = axis.X(format="/a-60/hL%d", tic_interval = 20, label="Stuff") (2)
yaxis = axis.Y(tic_interval = 20, label="Value") (3)
ar = area.T(x_axis=xaxis, y_axis=yaxis, y_range=(0,None)) (4)
plot = line_plot.T(label="foo", data=data, ycol=1, tick_mark=tick_mark.star) (5)
plot2 = line_plot.T(label="bar", data=data, ycol=2, tick_mark=tick_mark.square)
ar.add_plot(plot, plot2) (6)
ar.draw() (7)
1 对于(1),数据的第⼀个列表⽰横坐标,后⾯两列表⽰两条线对应的纵坐标;
2 (2)和(3)表⽰坐标,主要⽤来定义坐标的式样,间隔等,分别有x,y两类,xy对应的参数基本相同。处理draw_tics_above属于X⽽  draw_tics_right属于Y的属性。
label表⽰X或者Y轴的名称,label_offt表⽰显⽰的地⽅,默认为x轴的下⽅后者Y轴的左⽅,居中放置;tic_interval表⽰坐标轴的间隔,类型为数字或者函数,如果是函数的话返回值必须是能表⽰坐标
轻柔的反义词
点如何话的list,tic_label_offt 表⽰坐标轴上点下的label表⽰的位置,默认为0,0,tic_len表⽰画轴上坐标的时候的长度,如果是正直,则位于坐标轴下⽅开始画,如果是上⽅,则需要⽤负值表⽰;
format表⽰坐标轴上数字或者标签的式样,具体的样式可以参见:
追寻红色足迹
附: Label式样
Restrictions: /h, /v, and /a must appear in the beginning of a string.
/add
Specifies the angle of the text. Parameter dd is a number between -360 to 360. Value 0 means left-to-right text, 90 means bottom-to-up, etc. If you want to print numbers right after an angle specification, put { between the angle and the number. For example, the below code shows string ""100"" at a 60-degree angle.
"/a60{}100"
/hA:
Specifies horizontal alignment of the text. A is one of "L" (left alignment), "R" (right alignment), or "C" (center alignment).
/vA:
Specifies vertical alignment of the text. A is one of "B" (bottom), "T" (top), or "M" (middle).
/T
: Switch to Times font family.
/H:
Switch to Helvetica font family.
/C:
Switch to Courier font family.
/B:
Switch to Bookman-Demi font family.
/A:
Switch to AvantGarde-Book font family.
逻辑哲学论/P:
Switch to Palatino font family.
/S:
Switch to Symbol font family.
/
F{family}:
Switch to family font family. The below example draws string "Funny" using ZapfDingbat font (which produces some meaningless output).
canvas.show(100, 200, "/F{ZapfDingbat}Funny")
扬尼斯阿德托昆博
The list of available fonts are the following:
Bookman-Demi Bookman-Light Courier AvantGarde-Book AvantGarde-Demi Helvetica Helvetica-Narrow Palatino NewCenturySchlbk Times Symbol ZapfChancery-MediumItalic ZapfChancery-Medium-Italic ZapfDingbats
/b:Switch to bold typeface.
新学期新目标作文/i:Switch to italic typeface.
/o:Switch to oblique typeface.
/dd: Set font size to dd points.
"/20{}2001 space odysy!"
/cdd:
Set gray-scale to 0.dd. Gray-scale of 0 means black, 1 means white.
//, /{, /}:
意字开头的成语Display `/', `}', or `{'.
{ ... }:
Limit the scope of escape quences. For example, "{/10{/20Big text} and small text}" will display "Big Text" using a 20-point font, and "and small text" using a 10-point font.
$\backslash$n:

本文发布于:2023-06-21 21:16:11,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1008571.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:数据   位置   设置   式样   图形
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图