(App Designer/geoplot ) How can I plot multiple outputs on the same graph from the same function?

10 ビュー (過去 30 日間)
I want to plot multiple points with Input values. What I have is to take in the user inputs ( variable are northing and easting )
conversion is a function that takes in 2 arguments and give out the latitude and longitude that are used by geoscatter.
What i want to do is to take in another set of user inputs and still display the longitude and latidude of both plots. There is only one graph to be shown in the interface. The problem i am facing is when I click the plot button again, my previous plot disappear and my new plot is shown. I want to show both values.
I have tried checkbox, if i checked it, I want to store the values and still plot it. Is there a way to store the values everytime i click plot?
northing = str2double(app.NorthingEditField.Value);
easting = str2double(app.EastingEditField.Value);
% conversion(easting,northing) arrangement;
testdata= [easting,northing];
[testdatax,testdatay]= conversion(testdata(1),testdata(2)) ;
gx = geoaxes(app.Panel);
app.plotdata = geoscatter(gx,testdatax,testdatay,'ro','filled');
geolimits([1.345 1.35],[103.6 104.04])
hold on
% if app.CheckBox.Value
% testdata1= [easting,northing];
% [testdatax1,testdatay1]= EN2LatLon(testdata1(1),testdata1(2)) ;
% gx = geoaxes(app.Panel);
% app.plotdata = geoscatter(gx,testdatax1,testdatay1,'blue','filled');
% geolimits([1.345 1.35],[103.6 104.04]) ;
% geobasemap(gx,"streets");
% end

回答 (1 件)

Anshika Chourasia
Anshika Chourasia 2021 年 12 月 28 日
“hold” function is useful for retaining current plot when adding new plots. Instead of using hold on command, specify the geoaxes as an input argument to the “hold” function to resolve the issue.
Please refer this link for more information on specifying hold state for a particular axis.
  2 件のコメント
Anshika Chourasia
Anshika Chourasia 2022 年 1 月 7 日
One possible workaround could be to use global vectors for storing northing-easting values and every time "Plot" button is pressed append the current northing/easting values to the respective global vector. In this way previous values will be retained along with newer values in the vectors, and then plot them using "geoplot" with all the avaliable data entries. Following links may prove helpful to understand the procedure in detail:
  1. Creating, Concatenating, and Expanding Matrices
  2. Plot line in geographic coordinates



Find more on Graphics Performance in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by