How can I plot circular colormap for 0-24 hour phase?
33 次查看(过去 30 天)
显示 更早的评论
I am plotting 24 hour phase figure where I want a circular colormap i.e. 0th hour and 24th hour should have same same but with smooth transition of color.
I was using following lines to generate the plot:
jet_wrap = vertcat(jet,flipud(jet));
colormap(jet_wrap);
In the figure the main problem is I can differentiate between the area shade 6th hour and 18th hour viz.
Also, whenever i am running my code "jet_wrap" sizes doubles every single time and even if I clear it's value before running it. Why it's happening?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/724179/image.png)
3 个评论
DGM
2021-8-30
编辑:DGM
2021-8-30
When called without any arguments, jet() will return a color table with either 64 or 256 entries (depending on version). If the size of jet_wrap grows beyond length 128 (or 512), then either you have a variable called "jet", or you have some other thing changing the size of jet_wrap that you're not showing.
jet_wrap = vertcat(jet,flipud(jet));
size(jet_wrap,1)
jet_wrap = vertcat(jet,flipud(jet));
size(jet_wrap,1)
jet_wrap = vertcat(jet,flipud(jet));
size(jet_wrap,1)
采纳的回答
DGM
2021-8-29
编辑:DGM
2021-8-29
If you want a circular colormap, why are you using jet?
Just use hsv().
imshow(repmat(permute(hsv(64),[1 3 2]),[1 64 1]))
Or you could concoct your own map using any closed path that does not intersect itself. Those are really the only two requirements.
% a similar constant-luma sweep in HSYn
cc = [0.9612 0.4459 0.4459;0.9475 0.4615 0.4019;0.9305 0.4783 0.3598;0.9102 0.4963 0.3201;0.887 0.5154 0.283;0.8611 0.5352 0.2489;0.8326 0.5557 0.2183;0.8019 0.5765 0.1913;0.7692 0.5977 0.1683;0.7349 0.6188 0.1494;0.6993 0.6397 0.1348;0.6628 0.6603 0.1248;0.6256 0.6803 0.1193;0.5882 0.6995 0.1184;0.5509 0.7178 0.1222;0.5141 0.7349 0.1306;0.4781 0.7507 0.1435;0.4433 0.7651 0.1608;0.41 0.7779 0.1823;0.3785 0.789 0.2079;0.3492 0.7982 0.2372;0.3222 0.8056 0.27;0.298 0.8109 0.306;0.2766 0.8143 0.3449;0.2584 0.8155 0.3861;0.2435 0.8147 0.4295;0.232 0.8118 0.4745;0.224 0.8069 0.5207;0.2197 0.8 0.5676;0.219 0.7912 0.6149;0.222 0.7805 0.662;0.2286 0.7681 0.7086;0.2388 0.7541 0.7541;0.2525 0.7385 0.7981;0.2695 0.7217 0.8402;0.2898 0.7037 0.8799;0.313 0.6846 0.917;0.3389 0.6648 0.9511;0.3674 0.6443 0.9817;0.4024 0.623 1;0.4432 0.6022 1;0.4802 0.5833 1;0.5146 0.5658 1;0.5472 0.5492 1;0.5787 0.5332 1;0.6098 0.5173 1;0.6411 0.5014 1;0.6732 0.485 1;0.7068 0.4679 1;0.7427 0.4496 1;0.782 0.4296 1;0.8215 0.411 0.9921;0.8508 0.4018 0.9628;0.8778 0.3944 0.93;0.902 0.3891 0.894;0.9234 0.3857 0.8551;0.9416 0.3845 0.8139;0.9565 0.3853 0.7705;0.968 0.3882 0.7255;0.976 0.3931 0.6793;0.9803 0.4 0.6324;0.981 0.4088 0.5851;0.978 0.4195 0.538;0.9714 0.4319 0.4914];
imshow(repmat(permute(cc,[1 3 2]),[1 64 1]))
% another HSYn sweep with PWL hue and luma
cc = [0.006539 0.4252 0.4252;0.02025 0.427 0.4844;0.03879 0.4261 0.5446;0.06235 0.4227 0.605;0.09104 0.4167 0.6648;0.1249 0.4084 0.723;0.1638 0.398 0.7789;0.2077 0.3858 0.8316;0.2562 0.3719 0.8801;0.3091 0.3568 0.9237;0.3658 0.3408 0.9617;0.426 0.3243 0.9933;0.4876 0.3119 1;0.5482 0.3013 1;0.6091 0.2906 1;0.6716 0.279 1;0.7376 0.2657 1;0.8093 0.2494 1;0.8622 0.2498 0.9639;0.9023 0.2593 0.914;0.9359 0.2726 0.8619;0.9631 0.2894 0.8086;0.9838 0.3095 0.7552;0.9983 0.3326 0.7026;1 0.3621 0.6506;1 0.3916 0.6033;1 0.4203 0.5595;1 0.4487 0.5178;0.9892 0.4815 0.4815;0.9744 0.5154 0.4506;0.9566 0.5497 0.4252;0.9364 0.584 0.4056;0.9146 0.618 0.3921;0.8917 0.6514 0.3847;0.8685 0.6838 0.3834;0.8455 0.7149 0.388;0.8233 0.7445 0.3982;0.8025 0.7723 0.4137;0.7836 0.7983 0.4342;0.767 0.8222 0.4591;0.7531 0.844 0.4879;0.7422 0.8636 0.52;0.7345 0.881 0.5547;0.7345 0.881 0.5547;0.6844 0.8732 0.5071;0.6312 0.8662 0.4633;0.5751 0.8599 0.4235;0.5166 0.854 0.3884;0.4559 0.8481 0.3581;0.3936 0.8421 0.3332;0.3301 0.8356 0.3139;0.2658 0.8284 0.3004;0.2012 0.8202 0.2928;0.1369 0.8106 0.2914;0.07338 0.7995 0.2961;0.01112 0.7865 0.3069;0 0.7436 0.338;0 0.6954 0.3665;0 0.6485 0.3888;0 0.6026 0.4057;0 0.5577 0.4177;0 0.5137 0.4252;0 0.4704 0.4285;0.006539 0.4252 0.4252];
imshow(repmat(permute(cc,[1 3 2]),[1 64 1]))
I'm sure there are countless other colormaps on the File Exchange if you want something different.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!