How to plot grouped data

1 view (last 30 days)
Abdullah Danyal Saeed
Abdullah Danyal Saeed on 11 Mar 2017
Answered: Gillian Rosen on 14 Mar 2017
I want to plot a scatter plot of four different features like this:
I used a command gplotmatrix and plot a data as i want, but i also want that in Row#1 and Column#1 there is a name of feauture as in the iris data set.
  1 Comment
Chad Greene
Chad Greene on 11 Mar 2017
Can you provide a sample dataset and a picture of what you want to do?

Sign in to comment.

Answers (1)

Gillian Rosen
Gillian Rosen on 14 Mar 2017
Hi Abdullah, 
To add text to a plot interactively, you can use the 'gtext' function. Input your desired text with the 'gtext' function, and a cursor will appear in your figure window. Click where you would like the text to be placed, and it will appear. See the following documentation link for examples and more information: 
If you would like to add text programmatically, you can use the 'text' function instead. With this function, simply specify your desired X and Y coordinate for the location of your text along with the text itself. See the following documentation for more information: 
If you would like the sub-plots with text to have no data points, as in the image you provided of the iris data, you can turn the Visibility property of the points in those plot sections to 'off'. You can do this interactively with the following steps: 
1. Open the 'Plot Tools' window by clicking the corresponding icon in the figure window toolbar. 
2. Select the data that you would like to remove by clicking on it.
3. In the Property Editor at the bottom of the window, click 'More Properties...'
4. In the small 'Inspector' window that appears, scroll down to the 'Visibility' property and click the checkbox to toggle visibility.
Using these steps, you should be able to produce a plot very similar to your desired iris plot.  

Community Treasure Hunt

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

Start Hunting!