一个简单的csv导入/导出器,具有matplotlib的绘图功能

csv-manager的Python项目详细描述


CSV_管理器

这是一个python模块,它有两个简单的类,分别用于使用python和matplotlib(启用乳胶渲染)读取(类Reader)和绘制(类Plotter)csv,避免了使用csvpython库编写csv读取器的繁琐重复,然后使数据在可读结构中用于plt.plot(...)。示例用example/csv_plot_example.py

编写
fromcsv_manager.plotterimportPlotterplotter=Plotter(num_rows=1,num_columns=2)file1='test_file.csv'plotter.load(file1,alias='test file')######################################################plotter.plot('test file','time','position',0,0,label='position $x(t)$',color='red',linestyle=':')# Starting from " label='save' [...]" the arguments are the **kwargs in https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.htmlplotter.plot('test file','time','10 * sqrt(2/10 * position)',0,1,label='speed $v(t)$')plotter.plot_data(0,0,[0,1,2],[0,1,2],label='dummy data')plotter.set(0,0,xlabel='Time ',ylabel='Position')# Starting from " xlabel='time' [...]" the options that can be set are the **kwargs in https://matplotlib.org/api/axes_api.htmlplotter.set(0,1,xlabel='Time ',ylabel='Speed')plotter.show()

其中文件example/test_file.csv如下所示:

time position
0 0
1 5
2 20
3 45
4 80
5 125
6 180
7 245
8 320
9 405
10 500

依赖关系:

  • python matplotlib
  • pythonpy_expression_eval,可以与pip install py_expression_eval
  • 一起安装
  • 安装在计算机中的LaTex Distribution,可以通过将下面的行plt.rcParams['text.usetex'] = True更改为plt.rcParams['text.usetex'] = False,在csv撸u plotter.py中停用

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

推荐PyPI第三方库


热门话题
java Jsonify使用Jackson来定义嵌套对象   在Swing中禁用java图形调试   java Selenium Webdriver拖放在Jenkins上不起作用   java我对一个显示器的问题有一个非常不切实际的询问   java增强的“for”循环导致ArrayIndexOutOfBoundsException   ArrayAdapter适用于Java中的安卓编程,字符串数组   linux在Ubuntu上通过PulseAudio播放Java音频文件时出错   java在Spring应用程序中加载内部(类路径)和外部属性文件   java使用Maven连接到mySQL   Java应用程序的设计   websocket在电报api java中与dc的连接   java XMLStreamException,因为xml中的(&N)   java从控制台输出到JTextArea   Java导出文本文件   java实现parseInt方法   java为什么servlet容器会同步对特定资源/servlet的多个请求的访问?   循环中的Java“while”变量   用Java编程一个国际象棋游戏,gameOver布尔不起作用   java如何获得真正的JPanel大小?