当前位置: 首页 > news >正文

网站建设方案预算推广运营

网站建设方案预算,推广运营,信创网站建设,企业网站托管注意事项三轴坐标图 1 函数 MATLAB绘制三轴图函数可见MATLAB帮助-multiplotyyy 基础图形绘制是很简单,但坐标轴及字体设置该如何实现呢? 本文以以下几个例子为例,希望可以解决在利用MATLAB绘制三轴坐标图时常见的疑惑。 2 案例 2.1 案例1&#xf…

三轴坐标图

1 函数

MATLAB绘制三轴图函数可见MATLAB帮助-multiplotyyy
基础图形绘制是很简单,但坐标轴及字体设置该如何实现呢?
本文以以下几个例子为例,希望可以解决在利用MATLAB绘制三轴坐标图时常见的疑惑。

2 案例

2.1 案例1:绘图及基础设置

根据给定案例,添加坐标轴及字体设置,成图如下:
在这里插入图片描述
MATLAB相关代码如下:

clc
close all
clear
%% 导入数据
pathFigure= '.\Figures\' ;
figureUnits = 'centimeters';
figureWidth = 25; 
figureHeight = 15;x1 = (0:0.01:1)'; 
x2 = (0:0.1:1)';
x3 = (0:0.05:1)';
y1 = x1;
y2 = x2.^2;
y3 = x3.^3;
y4 = sin(x1);
y5 = fliplr(2*x1.^2);
y6 = 7*cos(x1);
y7 = 7*log(x1+1.2);%% 开始绘图ylabels{1}='First y-label';
ylabels{2}='Second y-label';
ylabels{3}='Third y-label';
[ax,hlines] = multiplotyyy({x1,y1,x2,y2,x3,y3,x1,y4},{x1,y5},{x1,[y6,y7]},ylabels);
set(gcf, 'Units', figureUnits, 'Position', [0 0 figureWidth figureHeight]);
set(hlines{1}(:),'LineStyle','-','Marker','o','MarkerFaceColor','b','Markersize',3);
set(hlines{2}(:),'LineStyle','--','Marker','o','MarkerFaceColor','g','Markersize',3);
set(hlines{3}(:),'LineStyle','none','Marker','o','MarkerFaceColor','r','Markersize',3);
xlabel(ax(1),"X",'FontName','Times New Roman','FontSize',12);  
ylabel(ax(1),"Y1",'FontName','Times New Roman','FontSize',12);  
ylabel(ax(2),"Y2",'FontName','Times New Roman','FontSize',12);  
ylabel(ax(3),"Y3",'FontName','Times New Roman','FontSize',12);  
set(ax(1),'xlim',[0 1],'xtick',0:0.1:1,'xticklabel', 0:0.1:1 ,'FontSize',12,'FontName','Times New Roman');
set(ax(1),'ylim',[0 1],'ytick',0:0.1:1,'yticklabel',0:0.1:1,'FontSize',12,'FontName','Times New Roman');
set(ax(2),'ylim',[0 2],'ytick',0:0.2:2,'yticklabel',0:0.2:2,'FontSize',12,'FontName','Times New Roman');
set(ax(3),'ylim',[0 7],'ytick',0:1:7,'yticklabel',0:1:7,'FontSize',12,'FontName','Times New Roman');
hl = legend(cat(1,hlines{:}),'a','b','c','d','e','f','g','location','w');
set(hl,'Box','off','location','NorthWest','NumColumns',2,'FontSize',12,'FontName','Times New Roman');    
set(gca,'FontSize',12,'Fontname', 'Times New Roman');str= strcat(pathFigure, "Fig.1", '.tiff');
print(gcf, '-dtiff', '-r600', str);

2.2 案例2:更改坐标轴颜色

此外,可根据需要更改坐标轴颜色,成图如下:
在这里插入图片描述
MATLAB相关代码如下:

clc
close all
clear
%% 导入数据
pathFigure= '.\Figures\' ;
load('Streamflow.mat');
ylabels{1}='干旱历时/月';
ylabels{2}='干旱烈度';
ylabels{3}='干旱强度';
x1 = 1:nYear;
mycolor = [0 0 0;77,133,189;237,119,69;80 80 80]/255;figureUnits = 'centimeters';
figureWidth = 25; 
figureHeight = 15;% 站点1:安宁渡
% ---------------------------------------------------------------------------------
[ax,hlines] = multiplotyyy({x1,droughtCharacter{1,1}(:,3)},{x1,droughtCharacter{1,1}(:,4)},{x1,droughtCharacter{1,1}(:,5)},ylabels);
set(gcf, 'Units', figureUnits, 'Position', [0 0 figureWidth figureHeight]);
set(hlines{1}(:),'LineStyle','-','linewidth',1.5,'color',mycolor(4,:),'Marker','o','MarkerFaceColor',mycolor(4,:),'Markersize',3);
set(hlines{2}(:),'LineStyle','--','linewidth',1.5,'color',mycolor(2,:),'Marker','^','MarkerFaceColor',mycolor(2,:),'Markersize',3);
set(hlines{3}(:),'LineStyle','none','linewidth',1.5,'color',mycolor(3,:),'Marker','.','MarkerFaceColor',mycolor(3,:),'Markersize',12);
set(ax(1),'xlim',[0  nYear+1],'xtick',1:5:nYear+1,'xticklabel', yearStart:5:yearEnd ,'FontSize',12,'FontName','Times New Roman','XColor',mycolor(1,:));
set(ax(1),'ylim',[0 33],'YAxisLocation','left','ytick',0:6:33,'yticklabel',0:6:33,'FontSize',12,'FontName','Times New Roman','YColor',mycolor(1,:));
set(ax(2),'ylim',[0 36],'ytick',0:5:36,'yticklabel',0:5:36,'FontSize',12,'FontName','Times New Roman','YColor',mycolor(2,:));
set(ax(3),'ylim',[0 1.8],'ytick',0:0.3:1.8,'yticklabel',0:0.3:1.8,'FontSize',12,'FontName','Times New Roman','YColor',mycolor(3,:));
xlabel(ax(1),"年份",'FontName','宋体','FontSize',12);  
ylabel(ax(1),ylabels{1},'FontName','宋体','FontSize',12,'Fontweight','bold');  
ylabel(ax(2),ylabels{2},'FontName','宋体','FontSize',12,'Fontweight','bold');  
ylabel(ax(3),ylabels{3},'FontName','宋体','FontSize',12,'Fontweight','bold');  str= strcat(pathFigure, "Fig. ", '.tiff');
print(gcf, '-dtiff', '-r600', str);

根据此案例可以发现,当坐标轴1和坐标轴2刻度不一致时,图1右侧刻度会与坐标轴2刻度同时出现,那么,此问题应该如何解决呢?

2.3 案例3:解决坐标轴1和2刻度不一致问题

成图如下:
在这里插入图片描述
对比案例2,修改代码如下:

[ax,hlines] = multiplotyyy({x1,droughtCharacter{1,1}(:,3)},{x1,droughtCharacter{1,1}(:,4)},{x1,droughtCharacter{1,1}(:,5)},ylabels);
set(gcf, 'Units', figureUnits, 'Position', [0 0 figureWidth figureHeight]);
set(hlines{3}(:),'LineStyle','none','linewidth',1.5,'color',mycolor(3,:),'Marker','.','MarkerFaceColor',mycolor(3,:),'Markersize',14);
set(hlines{1}(:),'LineStyle','-','linewidth',1.5,'color',mycolor(4,:));%,'Marker','o','MarkerFaceColor',mycolor(4,:),'Markersize',3);
set(hlines{2}(:),'LineStyle',':','linewidth',1.5,'color',mycolor(2,:));%,'Marker','^','MarkerFaceColor',mycolor(2,:),'Markersize',3);
set(ax(1),'xlim',[0  nYear+1],'xtick',1:5:nYear+1,'xticklabel', yearStart:5:yearEnd ,'FontSize',12,'FontName','Times New Roman','XColor',mycolor(1,:));
set(ax(1),'ylim',[0 33],'YAxisLocation','left','ytick',0:6:33,'yticklabel',0:6:33,'FontSize',12,'FontName','Times New Roman','YColor',mycolor(1,:),'LineWidth',0.5,'box', 'off');
ax1 = axes('Position',get(ax(1),'Position'),...'XAxisLocation','top',...'YAxisLocation','left',...'Color','none',...'YColor','k');
set(ax1,'XTick', [],'YTick', []);
set(ax(2),'ylim',[0 36],'ytick',0:5:36,'yticklabel',0:5:36,'FontSize',12,'FontName','Times New Roman','YColor',mycolor(2,:),'LineWidth',1);
set(ax(3),'ylim',[0 1.8],'ytick',0:0.3:1.8,'yticklabel',0:0.3:1.8,'FontSize',12,'FontName','Times New Roman','YColor',mycolor(3,:),'LineWidth',1);
xlabel(ax(1),"年份",'FontName','宋体','FontSize',14);  
ylabel(ax(1),ylabels{1},'FontName','宋体','FontSize',14,'Fontweight','bold');  
ylabel(ax(2),ylabels{2},'FontName','宋体','FontSize',14,'Fontweight','bold');  
ylabel(ax(3),ylabels{3},'FontName','宋体','FontSize',14,'Fontweight','bold');  str= strcat(pathFigure, "Fig. 站点1:安宁渡", '.tiff');
print(gcf, '-dtiff', '-r600', str);

2.4 案例4:设置右侧俩坐标轴间距

根据案例3,发现右侧两坐标轴间距过大,通过修改原函数代码可调整其间距,成图如下所示:
在这里插入图片描述
具体修改multiplotyyy函数,代码修改参数如下:

% Set the axes position and size
pos = [0.1  0.1  0.8  0.8];
offset = pos(3)/10;
pos(3) = pos(3) - offset/2;
ax(1).Position = pos;
ax(2).Position = pos;

参考

1.MATLAB帮助-multiplotyyy
引用格式:
Laura Proctor (2023). multiplotyyy (https://www.mathworks.com/matlabcentral/fileexchange/39595-multiplotyyy), MATLAB Central File Exchange.

http://www.15wanjia.com/news/16548.html

相关文章:

  • 广州市网站制作服务公司自助建站系统哪个好
  • 企业网站的类型有哪些引擎seo优
  • 重庆沙坪坝区疫情最新消息枫树seo网
  • 重庆网站建设报价打开百度搜索
  • 什么是网站接入商安卓aso优化排名
  • 延边有没有做网站的seo基础知识包括什么
  • 哪个网站做网站好营销型网站的类型有哪些
  • 做网站建设一年能赚多少钱百度普通下载
  • 有网站做淘宝天猫优惠券代理站长统计app网站
  • 潍坊专业做网站今日郑州头条最新新闻
  • 电脑网站推荐武汉做网络推广的公司
  • vue 做双语版网站大连最好的做网站的公司
  • 商务网站建设规划自助建站系统破解版
  • 搭建平台舞台网站seo报价
  • 外贸企业网站建设哪家好谷歌seo排名工具
  • 建新闻网站关键词优化哪家强
  • 企业网站怎么搜索优化职业培训机构排名前十
  • 网站建设1000字合肥网站优化seo
  • 武汉seo网站优化运营网络舆情案例分析
  • 做幼儿园成长册的素材网站如何刷关键词指数
  • 可视化网站建设平台免费b2b网站大全免费
  • 做ppt高手 一定要常去这八个网站营销型网站有哪些
  • 网站建设redu磁力搜索器下载
  • 做电商网站用什么技术营销网站制作公司
  • 中国商标注册网seo搜索引擎优化试题
  • 高埗做网站公司谷歌seo网站排名优化
  • 如何做网站关键词平台怎么推广技巧
  • b2b网站推广方法百度推广工具
  • 网站建设需要哪些功能站长工具忘忧草
  • 制度建设对网站管理的重要性网站宣传方法