Is it possible to use gscatter within app designer?

13 views (last 30 days)
I am trying to write package an application for my team to run principal component analysis on commonly produced data sets in the lab. Within Matlab, I use gscatter for this, and it works perfectly. I can produce the plots with an app designer app, however, the plot opens as a new window. I would like to project the plot onto the UIAxes. I need to do this so I can add a UI interface to use the gname function to identify data points. I know how to do this with scatter, or plot, but I cannot find a functional way to project gscatter onto the UIAxes. I have tried several methods. Anyone have an idea?
  2 Comments
Muazma Ali
Muazma Ali on 29 Jul 2022
@Jeremy Primus Can you tell me how you coded so that it opened up in a new window..?
I have problems using gscatter me too in my app., :(
thanks

Sign in to comment.

Answers (1)

Benjamin Kraus
Benjamin Kraus on 1 Aug 2022
What release of MATLAB are you using?
Starting in R2019b, gscatter should work just find within App Designer, but you need to make sure that you are passing the UIAxes handle as a first-input when you call the gscatter command. The ability to pass a parent as a first input was added in R2019b.
By default the figure used for your App Designer apps have the HandleVisibility set to 'off'. This means that the UIAxes (and regular axes) within the app will never be the "current axes". If you fail to specify the axes handle when calling commands like plot, scatter, or gscatter, this will often open a new figure, or reuse another figure that happens to be open at the time.
  2 Comments
Benjamin Kraus
Benjamin Kraus on 2 Aug 2022
You can use gscatter in R2018b, but it will open a new figure instead of working within your app.
Alternatively, you can just use regular scatter and specify the CData manually to cause it to group by colors.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by