策划polarplot 2个月从12个月在每个数据集

3视图(30天)
嗨,伙计们,
我一直想实现一个for循环从一组数据绘制图表每个情节都有2个月,所以第一个情节将所有值从1月到2月,从3月到4月2日将所有的值。
我也一直试图使数据集分为两行,第一个是1月到6月的数据constiting情节和第二行数据从7月到12月。
谢谢你,任何指导,我们将不胜感激
1评论
Stephen23
Stephen23 2021年12月10日
编辑:Stephen23 2021年12月10日
原始问题通过Sebastion阳光从谷歌检索缓存:
策划polarplot 2个月从12个月在每个数据集
嗨,伙计们,
我一直想实现一个for循环从一组数据绘制图表每个情节都有2个月,所以第一个情节将所有值从1月到2月,从3月到4月2日将所有的值。
我也一直试图使数据集分为两行,第一个是1月到6月的数据constiting情节和第二行数据从7月到12月。
谢谢你,任何指导,我们将不胜感激
我有附一的数据和我的情节应该是什么样子的照片
对不起,如果我的代码有点混乱:
t =月(windTurbineData.disc_TimeStamp);
函数R = (windTurbineData.mean_NacelleOrientation_Deg);
i = 1:2:12
(1)= 1;
plotIndex1 = t = =我;
plotIndex2 = t = = (i + 1);
持有
次要情节(2、3、1)
polarplot (R (plotIndex1) windTurbineData.mean_Power_kW (plotIndex1),“。”);
polarplot (R (plotIndex2) windTurbineData.mean_Power_kW (plotIndex2),“。”);
持有
次要情节(2、3、2)
polarplot (R (plotIndex1) windTurbineData.mean_Power_kW (plotIndex1),“。”);
polarplot (R (plotIndex2) windTurbineData.mean_Power_kW (plotIndex2),“。”);
持有
次要情节(2、3、3)
polarplot (R (plotIndex1) windTurbineData.mean_Power_kW (plotIndex1),“。”);
polarplot (R (plotIndex2) windTurbineData.mean_Power_kW (plotIndex2),“。”);
持有
次要情节(2、3、4)
polarplot (R (plotIndex1) windTurbineData.mean_Power_kW (plotIndex1),“。”);
polarplot (R (plotIndex2) windTurbineData.mean_Power_kW (plotIndex2),“。”);
持有
次要情节(2、3、5)
polarplot (R (plotIndex1) invalidDataIndex (plotIndex1),“。”);
polarplot (R (plotIndex2) invalidDataIndex (plotIndex2),“。”);
持有
次要情节(2、3、6)
polarplot (R (plotIndex1) invalidDataIndex (plotIndex1),“。”);
polarplot (R (plotIndex2) invalidDataIndex (plotIndex2),“。”);
结束
次要情节(2、3、1)
thetaticks (gca, [0 45 90 135 180 225 270])
thetaticklabels (gca, {“E”,“不”,“N”,“西北”,' W ',“西南”,“年代”});
集(gca),“ColorOrder”提出)
网格
次要情节(2、3、2)
thetaticks (gca, [0 45 90 135 180 225 270])
thetaticklabels (gca, {“E”,“不”,“N”,“西北”,' W ',“西南”,“年代”});
集(gca),“ColorOrder”提出)
次要情节(2、3、3)
thetaticks (gca, [0 45 90 135 180 225 270])
thetaticklabels (gca, {“E”,“不”,“N”,“西北”,' W ',“西南”,“年代”});
集(gca),“ColorOrder”提出)
次要情节(2、3、4)
thetaticks (gca, [0 45 90 135 180 225 270])
thetaticklabels (gca, {“E”,“不”,“N”,“西北”,' W ',“西南”,“年代”});
集(gca),“ColorOrder”提出)
次要情节(2、3、5)
thetaticks (gca, [0 45 90 135 180 225 270])
thetaticklabels (gca, {“E”,“不”,“N”,“西北”,' W ',“西南”,“年代”});
集(gca),“ColorOrder”提出)
次要情节(2、3、6)
thetaticks (gca, [0 45 90 135 180 225 270])
thetaticklabels (gca, {“E”,“不”,“N”,“西北”,' W ',“西南”,“年代”});
集(gca),“ColorOrder”提出)

登录置评。

接受的答案

戴夫B
戴夫B 2021年12月3日
你没有说什么是错误的,但是我注意到的一件事是,你的语句是在错误的地方。你有:
次要情节()
polarplot ();
polarplot ();
抓住
但,说:
  1. 新建一个次要情节
  2. 叫polarplot(清除轴因为持有)
  3. 叫polarplot(清除轴因为持有)
  4. 把抓住
相反,尝试:
次要情节()
polarplot ();
抓住
polarplot ();
其他一些小贴士:
  • 我建议tiledlayout/nexttile而不是次要情节。循环之前调用tiledlayout (2、3)然后替换次要情节年代nexttile(我认为你不需要任何参数)。这些函数被引入R2019b。
  • 我建议polarscatter而不是polarplot情节是伟大的,因为它是一切,但散射在散射要好。
2的评论
戴夫B
戴夫B 2021年12月4日
编辑:戴夫B 2021年12月4日
给你,我错过了你在个月循环然后调用 次要情节 很多次在循环。你的原始代码需要一个调用 次要情节 循环中 在里面。这个工作对我来说(抱歉不能运行它,因为文件太大,但我显示输出基于以下 exportgraphics (gcf foo.png)
  • 我猜颜色,你当然可以使用任何colormap你已经拥有的。
  • 有几个方法得到这种跨着色在MATLAB工作好,你肯定能做到colormap而不是colororder,但后者使得好易读的代码(IMO)。
  • 如果你需要传说中的“19”你可以添加+“19”结束的时候DisplayName(收盘后括号字符串函数)
  • 你可以考虑一些透明度,这有点令人沮丧,掩盖了一个月。你可以设置透明度“MarkerFaceAlpha”,和一个值在0和1之间。有一些更复杂的解决方案将堆叠的顺序,但他们需要一些努力所以我只穿过它如万博 尤文图斯果它很重要。
windTurbineData = readtable (“Levenmouth7MWTurbineData2019.csv”);
t =月(windTurbineData.disc_TimeStamp);
函数R = (windTurbineData.mean_NacelleOrientation_Deg);
tiledlayout (2、3)
i = 1:2:12
nexttile
polarscatter (R (t = =我)windTurbineData.mean_Power_kW (t = =我),“填充”,
“DisplayName的”字符串(月(windTurbineData.disc_TimeStamp(找到(t = =我,1)),“短”)),%挑选名字的传奇
“SeriesIndex”,我)%这将用于颜色
持有
polarscatter (R (t = = i + 1) windTurbineData.mean_Power_kW (t = = i + 1) 10,“填充”,
“DisplayName的”字符串(月(windTurbineData.disc_TimeStamp(找到(t = = i + 1, - 1)),“短”)),%挑选名字的传奇
“SeriesIndex”,我+ 1)%这将用于颜色
thetaticks ([0 45 90 135 180 225 270])
thetaticklabels ({“E”,“不”,“N”,“西北”,' W ',“西南”,“年代”});
传奇(“位置”,“northoutside”,“定位”,“水平”)
结束
clr = [“# D74523”“# FEBF15 # C1FB13”“# 41 fb17”“# 0 bf944”“# 17 fdbe”“# 17 bdfd”“# 183 bf4”“# 2 a1cdc”“# BE35FD”“# FE28BB”“# FE1341”];
clr = validatecolor (clr,“多”);
colororder (clr)

登录置评。

更多的答案(0)

类别

找到更多的在极地的情节帮助中心文件交换

s manbetx 845

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!