Matlab如何下载安装科研绘图工具Gramm并绘图

Matlab如何下载安装科研绘图工具Gramm并绘图

1.Gramm简介

Gramm是一个强大的绘图工具箱,允许在Matlab中快速创建复杂的,出版质量的数字,并受到R的ggplot2库Hadley Wickham的启发。作为这一灵感的参考,gramm代表Matlab中的图形语法。用作科研绘图Gramm是一个不错的选择。

Gramm是Matlab的一个数据可视化工具箱,允许从分组数据轻松灵活地生成发布质量的图。Matlab可以使用高级接口用于复杂数据分析:它通过表支持混合类型的表格数据,提供接受这些表格作为参数的统计函数。

2.下载安装

下载地址
https://github.com/piermorel/gramm

打开下载页面之后,点击“克隆”下载gramm-master文件压缩包。

之后,将这个压缩包解压,把里边的文件复制到matlab/toolbox路径下。

然后,打开matlab,使用addpath()函数将文件位置添加到搜索路径当中,比如addpath(‘D:\SOFTWARE\matlab\toolbox\gramm-master’)。之后就可以使用了。

3.运行样例

路径配置完毕以后,我们运行下载界面的这样一个样例。

clc
clear
load carbig.mat %Load example dataset about cars
origin_region=num2cell(org,2); %Convert origin data to a cellstr

% Create a gramm object, provide x (year of production) and y (fuel economy) data,
% color grouping data (number of cylinders) and select a subset of the data
g=gramm('x',Model_Year,'y',MPG,'color',Cylinders,'subset',Cylinders~=3 & Cylinders~=5)
% Subdivide the data in subplots horizontally by region of origin
g.facet_grid([],origin_region)
% Plot raw data as points
g.geom_point()
% Plot linear fits of the data with associated confidence intervals
g.stat_glm()
% Set appropriate names for legends
g.set_names('column','Origin','x','Year of production','y','Fuel economy (MPG)','color','# Cylinders')
%Set figure title
g.set_title('Fuel economy of new cars between 1970 and 1982')
% Do the actual drawing
g.draw()

运行时间可能稍微有点长,感觉10s才出来完整的图像。
像下面这样,不过以后绘图会方便很多。

在这里插入图片描述
可以看出,图像绘图质量确实很好,比matlab自带的绘图功能好太多了,跟python matplotlib绘图有的一拼。

  • 3
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Carifee.

您的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值