Scatterplot with value-mapped colors?

2 views (last 30 days)
ZANE FREY
ZANE FREY on 11 Apr 2023
Commented: ZANE FREY on 11 Apr 2023
Hi, I'm looking to create a scatterplot mapping wind turbines and display each turbine as a different color depending on how much power it produces. Given three vectors: turbineX (x-coordinates of turbines), turbineY (y-coordinates of turbines), and turbinePowers (power produced for each turbine in kW). I would like to have the turbines producing the most power in red and the least in blue, likely using the "jet" colormap. Is there a way to do this?
turbineX = [387.5912409 1425.547445 2368.248175 3337.226277 4191.240876 607.6642336 1573.357664 2545.620438 3488.321168 4417.883212 725.9124088 1589.781022 2621.167883 3557.29927 4631.386861 5219.343066 -75.54744526 811.3138686 1842.70073 2736.131387 3691.970803 4506.569343 5350.729927 6037.226277 6851.824818 7554.744526 8461.313869 9453.284672 -49.27007299 847.4452555 1763.868613 2814.963504 3823.357664 4532.846715 5357.29927 6116.058394 6970.072993 7663.138686 8546.715328 9404.014599 6838.686131 7653.284672 8628.832117 9361.313869 45.98540146 926.2773723 2000.364964 2906.934307 4572.262774 6148.905109 6855.109489 7758.394161 8290.510949];
turbineY = [29.5620438 52.55474453 141.2408759 164.2335766 200.3649635 601.0948905 551.8248175 647.080292 771.8978102 804.7445255 1402.554745 1507.664234 1448.540146 1530.656934 1392.70073 1809.854015 1836.131387 1934.671533 2000.364964 2151.459854 2243.430657 2364.963504 2555.474453 2128.467153 2364.963504 2381.386861 2407.664234 2351.824818 2529.19708 2736.131387 2870.80292 2874.087591 2946.350365 3140.145985 3379.927007 3534.306569 2841.240876 2962.773723 3077.737226 3238.686131 3682.116788 3813.50365 3787.226277 4092.70073 3281.386861 3462.043796 3501.459854 3590.145985 3754.379562 4247.080292 4483.576642 4575.547445 5078.10219];
turbinePowers = [3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05843493 3860.05850652 2874.77305982 2451.51407845 2406.524981 3406.60667667 3860.05850652 3860.05850652 2372.16689334 2552.8275582 2853.58761836 2591.59408558 3144.6419463 3860.05849828 3860.05850651 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3030.71466836 2577.61210924 2747.89309893 2763.43291837 3038.10540046 2880.06509172 2473.28063375 2618.65152199 3860.05724647 3860.05850652 3860.05850646 3860.05850652 2471.05297825 2488.61980328 2518.88322773 3860.05850651 2628.87789759 2906.03243624 2715.98886348 2674.18508113 2929.76679648 2507.17693873 2865.87406977 2907.88737863 2970.97316656];

Answers (1)

Walter Roberson
Walter Roberson on 11 Apr 2023
Edited: Walter Roberson on 11 Apr 2023
turbineX = [387.5912409 1425.547445 2368.248175 3337.226277 4191.240876 607.6642336 1573.357664 2545.620438 3488.321168 4417.883212 725.9124088 1589.781022 2621.167883 3557.29927 4631.386861 5219.343066 -75.54744526 811.3138686 1842.70073 2736.131387 3691.970803 4506.569343 5350.729927 6037.226277 6851.824818 7554.744526 8461.313869 9453.284672 -49.27007299 847.4452555 1763.868613 2814.963504 3823.357664 4532.846715 5357.29927 6116.058394 6970.072993 7663.138686 8546.715328 9404.014599 6838.686131 7653.284672 8628.832117 9361.313869 45.98540146 926.2773723 2000.364964 2906.934307 4572.262774 6148.905109 6855.109489 7758.394161 8290.510949];
turbineY = [29.5620438 52.55474453 141.2408759 164.2335766 200.3649635 601.0948905 551.8248175 647.080292 771.8978102 804.7445255 1402.554745 1507.664234 1448.540146 1530.656934 1392.70073 1809.854015 1836.131387 1934.671533 2000.364964 2151.459854 2243.430657 2364.963504 2555.474453 2128.467153 2364.963504 2381.386861 2407.664234 2351.824818 2529.19708 2736.131387 2870.80292 2874.087591 2946.350365 3140.145985 3379.927007 3534.306569 2841.240876 2962.773723 3077.737226 3238.686131 3682.116788 3813.50365 3787.226277 4092.70073 3281.386861 3462.043796 3501.459854 3590.145985 3754.379562 4247.080292 4483.576642 4575.547445 5078.10219];
turbinePowers = [3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05843493 3860.05850652 2874.77305982 2451.51407845 2406.524981 3406.60667667 3860.05850652 3860.05850652 2372.16689334 2552.8275582 2853.58761836 2591.59408558 3144.6419463 3860.05849828 3860.05850651 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3860.05850652 3030.71466836 2577.61210924 2747.89309893 2763.43291837 3038.10540046 2880.06509172 2473.28063375 2618.65152199 3860.05724647 3860.05850652 3860.05850646 3860.05850652 2471.05297825 2488.61980328 2518.88322773 3860.05850651 2628.87789759 2906.03243624 2715.98886348 2674.18508113 2929.76679648 2507.17693873 2865.87406977 2907.88737863 2970.97316656];
pointsize = 15;
color = turbinePowers;
scatter(turbineX, turbineY, pointsize, color, 'filled');
colormap(jet)

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!