I want to show upto 3 plots(using gscatter) at a time where the user will select an item from pop-up menu or listbox

4 views (last 30 days)
this code UI('Item_name',option) generates my gscatter image in command window,(problem is the 3 plots are same, only difference of colours based on option; so "hold on" does not work in my case) i want to build a GUI for this.

Answers (1)

Sudhanshu Bhatt
Sudhanshu Bhatt on 23 Jul 2015
Hi Baibhav Vishal,
I am assuming that the data sets are to be represented in the same axis. In this case you could use color and symbol properties of "gscatter" function:
Example:
Figure;
gscatter(xData,yData,group,'rb','+x')
hold on;
gscatter(xData,yData,group,'yg','o.')
In this example: 'rb' and 'yg' correspond to Red, Blue, Yellow and Green colors for the graphs '+x' and 'o.' correspond to the symbols or markers which will represent the data sets.
More information on "gscatter" function can be found in the documentation link below:
If the data sets are to be represented in different axis on the figure then you can make use of "subplot" function:
Example:
figure;
subplot(2,1,1);
gscatter(xData,yData,group);
subplot(2,1,2);
gscatter(xData,yData,group);
This code will create a figure with axis in tiled positions, and datasets plotted in different axis.
More information on "subplot" function can be found in the documentation link below:
Hope this helps.
Thanks
Sudhanshu Bhatt

Categories

Find more on Graphics Object Programming 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!