一个冗长但直观的绘图库。

plotxel的Python项目详细描述


绘图素

控制绘图到像素!
在右移图表时遇到困难吗?移动你的轴心?去除虱子?那就试试plotxel!

99%的时间是冗长、缓慢和不必要的。但那1%,你会很高兴你有普罗泰克。

安装

pip3 install plotxel

示例

Example Image

fromplotxelimportPlotxel,Axisx=Plotxel()# our main drawing canvas in x, y# add some data as a series. The series name, the x data, and y dataseries1=[iforiinrange(10)]x.add_data('series1',series1,series1)x.add_data('series2',[1,2,3,4,5,10],[5,2,1,4,3,10])x.add_data('series3',[10,5,4,3,2,1],[5,2,1,4,3,10])# left plot -- its name, type, and data it's linked toplot1=x.add_drawable("plot1","Scatter",["series1",'series2','series3'])plot1.title='Analysis of Goose Encounters'plot1.pos=[60,50]plot1.title_offset=23plot1.marker_opacity={.5}# this must be a set so it can iterate through data. Will make this more intuitive# right plot and its position. Same data as plot1plot2=x.add_drawable("plot2","Scatter","series1")# set a bunch of attributes at once!plot2.setattrs(ylim=[-1,10],xlim=[-1,10],pos=[450,50],marker_shape='square',marker_fill_color=(255,0,0),title='Analysis of Goose Encounters (red)',line_width=0)# add some axes, and link them to our plots. It will copy the size, position, scale, and limits of whichever plot it is linked toax1=x.add_drawable("ax1",'YAxis',link_to="plot1")ax1.axis_offset=10ax1.title_offset=25# distance from the ticks. Will have an auto feature in the future!ax1.title="Near Death Experiences With Geese"# all other axes, let's put them flush with the graph by changing the default# defaults are copied at the time the object is initialized, so this won't affect ax1Axis.defaults['axis_offset']=-1ax1b=x.add_drawable('ax1b','XAxis',link_to='plot1')# you can keep setting attributes in bulkax1r=x.add_drawable('ax1r','YAxis',link_to='plot1',title_offset=20)ax1r.setattrs(side='right',title_offset=20,title='Ax1 Right Title')ax1t=x.add_drawable('ax1t','XAxis',link_to='plot1')ax1t.setattrs(side='top',title='')# or use the constructor!x.add_drawable("ax2",'YAxis',link_to="plot2",title_offset=20,side='right',axis_offset=10)ax3=x.add_drawable("ax3",'XAxis',link_to="plot2")ax3.setattrs(side='bottom',axis_offset=10,title="Number of Freaking Geese",)# I think I would prefer axes to be blue!Axis.defaults['color']=(0,0,255)# let's add some bar chart data. Since it's a vertical bar chart, we will pull Y data# the labels aren't implemented quite yetx.add_data('bar_data',['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],[1,9,4,5,3,6,2])x.add_data('bar_data2',['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],[1,7,4,3,4,5,1])x.add_data('bar_data3',['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],[-3,14,2,1,2,7,9])plot3=x.add_drawable('bar1','Bar',['bar_data','bar_data2','bar_data3'])# or unpack a dictplot3_attrs={'pos':(150,300),'dim':(500,150),'ylim':[-5,15],'group_spacing':30,'bar_spacing':0,'title':'Safely Navigating Geese'}plot3.setattrs(**plot3_attrs)x.add_drawable('ax4','YAxis',link_to="bar1",title='Likelihood of Goose Attack',title_offset=25)# x.add_drawable('ax5', 'XAxis', link_to='bar1', title='Day of Week', title_offset=5)# coming soon, Jupyter magic!# x.anti_aliasing=Falsex.show()# or for SVG# svg_html = x.draw()# or for image  in BytesIO / save to filename# x.render(filename='example2.png')

这个程序是根据我自己的需要开发的,不幸的是我今天没有做很多绘图工作,所以我不需要很多功能。

在任何情况下,我将优先考虑功能,下一个是条形图和直方图!

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Spring MVC@ExceptionHandler未能捕获异常   Java存储过程的内部类不可见   java使用ImageIO从具有alpha透明度的图像中保存具有索引透明度的GIF   java如何在Android中通过编程获得自己的电话号码?   文本使用Java在文件中的每行开头和结尾追加一个字符   使用JDK8生成时发生java语法异常   java为每个平台获得正确的斜杠   jvm Java OutOfMemory错误   C++ java加载一个DLL,从JNI中导出另一个DLL的方法   java如何在特定位置将字符串列表添加到另一个列表中?   groovy如何在jmeter的_groovy()函数中执行java方法/函数?   在Java中寻找素数   java如何向JavaFX图表添加辅助图例?   java JButton在使用时不会更改更新映像。设置图标(图标);   java IllegalArgumentException:错误消息没有意义   java正则表达式检测<code></代码>代码块   定义单击按钮的java   java在subversion中合并两个本地文件   java线程的用途是什么。netsocket中的sleep()。伊奥?