Multiple lines in one figure
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm plotting some data on top of a map, and I'm trying to add the Dutch Exclusive Economic Zone to the figure but it doesn't want to show.
figure('Color','w');
load NL_region_coast_RD.mat % contains x- and y-coordinates of the Dutch coastline (xRDc and yRDc)
line(xRDc/1000,yRDc/1000,'LineWidth',1.0,'Color','k');
hold on
line(rijksx/1000,rijksy/1000,'LineWidth',1.0,'Color','r'); % x- and y-coordinates of EEZ (rijksx and rijksy)
axis equal
xlim(rdxlim')
ylim(rdylim')
fsize=12;
set(gca,'FontSize',fsize);
set(gca,'YAxisLocation','left')
After this piece of code, I use imagesc to layer my data on top of it (as a colormap). This works on top of the Dutch coastline, but the EEZ just won't show. Does anyone know why, and how to fix it?
3 Commenti
Simon Chan
il 21 Giu 2023
Is there any possibility that the values of the variables rijksx/1000 and rijksy/1000 is outside the axis limit? Noticed that you already divide EEZx and EEZy in the for loop by 1000 already.
Risposte (2)
Joe Vinciguerra
il 21 Giu 2023
The is nothing innately wrong with your code.
Check that the values within rdxlim and rdylim are appropriate for the dataset.
If you can, move imagesc before the lines so it layers the lines on top. If you can't relocate imagesc in your code:
Change the transparency: https://www.mathworks.com/help/matlab/ref/imagesc.html?s_tid=doc_ta#buxkjup_sep_shared-AlphaData
Or change the plotting order like this:
figure("Color", "w")
line([0:1:10], [0:1:10],'LineWidth',1.0,'Color','k');
hold on
line([0:1:10], [0:10:100],'LineWidth',1.0,'Color','r');
imagesc
g=get(gca,'Children');
g=g([3 2 1]);
set(gca,'children',g);
2 Commenti
Joe Vinciguerra
il 21 Giu 2023
It's there. It's just outside of your limits. And I would guess that it's not scaled correctly. Here is a screenshot of the figure file you provided, zoomed in on the region where your missing data can be found:
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!