Contentsthis book. This tool allows for plotting and statistics based on grouping data.
g = gramm('x',CarData.RatedHP','y',CarData.MPG,... 'Color',CarData.City_Highway,... 'Marker',CarData.Car_Truck); facet_grid(g,CarData.City_Highway,CarData.Car_Truck,'scale','fixed'); geom_point(g); stat_fit(g,'fun',@(a,b,c,x)a.*x.^b+c,'disp_fit',true,'StartPoint',[1 1 21]); set_names(g,'x','Horsepower','y','MPG','column','Vehicle class','color','Driving condition','column','','row',''); draw(g);We can now look at the model results of the separate fits:
ans = General model: ans(x) = a.*x.^b+c Coefficients (with 95% confidence bounds): a = -331.9 (-2840, 2177) b = 0.03341 (-0.1808, 0.2476) c = 419.4 (-2125, 2964) ans = General model: ans(x) = a.*x.^b+c Coefficients (with 95% confidence bounds): a = -82.91 (-684.2, 518.4) b = 0.08624 (-0.3401, 0.5125) c = 150.1 (-503.6, 803.8) ans = General model: ans(x) = a.*x.^b+c Coefficients (with 95% confidence bounds): a = -219.4 (-1350, 911.2) b = 0.05282 (-0.1593, 0.265) c = 326.3 (-842.9, 1496) ans = General model: ans(x) = a.*x.^b+c Coefficients (with 95% confidence bounds): a = -65.33 (-1142, 1011) b = 0.08805 (-0.8959, 1.072) c = 131.9 (-1041, 1305)Rather than trying to come up with a bunch of examples on my own, I went ahead and opened Pierre's example script as a Live Script and exported it to html. His example script provides a lot of different examples for the comprehensive range of capabilities. In additon to the examples, there is also a PDF "cheat sheet" to learn the common parameters you can add. While working with gramm, I kept it open the entire time.
- gramm should work with the categorical data type so that you do not need to cast back to cell strings in order to group.
- In R2014b or newer, the axes handles returned by g.facet_axes_handles could return the handle, not the numeric version of it like in older releases. This allows for tab complete and viewing all properties.
- It would be nice to be able to specify an axes or collection of existing axes as a 'Parent' so that you can use gramm within a user interface. I don't see any simple way to do this right now other than using copyobj a bunch of times on an invisible figure gramm creates.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.