Plot with x-axis limits going from [180:360] then [0:180] contiguously
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Here is a sample plot of my data:
I've searched through the community looking for ideas but I may be struggling with how to search for this particular issue.
I've come across several cases that would solve my issue "visually" using "unwrap" or "wrapTo360", but these both would alter my data set.
I want to keep the integrity of my data, but I'd like to have my plot be contigous from 250 degrees at the origin to 360 degrees, then continue to 0 degrees to 250 degrees similar to the second sample plot. (I've set the summary to be 180:360 to aid others searching as those are typical angles and mine are more specific).
I would like to do this programmatically as I am able to do it manually, but I have thousands of these to run through.
2 Kommentare
the cyclist
am 15 Jun. 2023
It's difficult to infer the fully general "rule" here, from just one example. Can you post two or three examples of the data? You can upload it using the paper clip icon in the INSERT section of the toolbar.
Antworten (2)
Les Beckham
am 15 Jun. 2023
It seems extremely odd that your data would "wrap" at 250 degrees. Nevertheless...
elevation = [26:80 0:25];
azimuth = linspace(0, 360, numel(elevation));
delta_az = unique(diff(azimuth));
plot(azimuth, elevation, '.')
grid on
xlabel('Azimuth (deg)')
ylabel('Elevation (deg)')
idx = azimuth >= 250;
figure
offset = azimuth(find(azimuth <= 250, 1, 'last'));
plot([azimuth(idx) (azimuth(~idx) + 360 + delta_az)] - offset, [elevation(idx) elevation(~idx)], '.')
grid on
xticklabels(string([250:50:350 0:50:250]))
xlabel('Azimuth (deg)')
ylabel('Elevation (deg)')
0 Kommentare
the cyclist
am 15 Jun. 2023
You only give one example, and this will do what you want for this one example. It does not touch your data, just what is plotted.
I am guessing this is not robust enough for your data in general. But, since you have not given us more examples, it is not possible to know how general this needs to be.
Maybe you can figure out the rest. (Also, I notice a couple rogue points. I did not inspect the reason for those.)
tbl = readtable("sampleData.xlsx");
figure
scatter(tbl.Var1 + 360*(tbl.Var1<250),tbl.Var2)
set(gca,"XTickLabel",[250:50:350 0:50:360])
0 Kommentare
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!