Answered
How to overlap plots from different scripts?
Look up the documentation for copyobj. Not only is a new figure generated with the code you shared but a very important error...

6 years ago | 0

| accepted

Answered
Different results using mesh and surf
> The problem is the two graphs are different. The surf function seems to have gotten it correct, but the mesh function looks li...

6 years ago | 0

| accepted

Answered
How do I repeat a number based on a criteria?
Try out F = fillmissing(A,method) where method is set to "previous". To apply that to your table, it will look something like,...

6 years ago | 0

Answered
A function to set common properties for all open figures
h = findall(0, '-property', 'TickLabelInterpreter'); set(h, 'TickLabelInterpreter', 'Latex')

6 years ago | 0

| accepted

Answered
How can I add a drop-down menu for a certain column in a UItable in App Designer?
Refer to Matlabs documentation on the uitable's ColumnFormat property which demonstrates how to set up pop-up menus within a col...

6 years ago | 0

| accepted

Answered
How to create a Lambertian (diffuse) sphere
There are probably official definitions and methods for a Lambertian diffuse sphere but here's something that looks like it. ...

6 years ago | 1

| accepted

Answered
how can I fix Warning: Imaginary parts of complex X and/or Y arguments ignored.
Your data contain complex numbers. If this is unexpected, it indicates that there's a problem somewhere along your pipeline a...

6 years ago | 0

Answered
Code for Counting and Lookup
Here's a demo. v is the input vector of 1s and 0s (or Trues and Falses) r is the output vector of row numbers in v that star...

6 years ago | 1

| accepted

Answered
How to display plot and rectangle at the same time?
" I have tried 'hold on' , but that didn't work" My guess is that hold on was applied to the wrong axes. This can happen when ...

6 years ago | 0

| accepted

Answered
How can I use ginput in app designer?
ginput is now supported in AppDesigner starting in r2020b We still don't have an option to specify the target figure handle in ...

6 years ago | 8

| accepted

Answered
How we can plot Indian flag ploting
Download an image of the flag. use imread and imshow to read/plot the flag. Here's an example https://www.mathworks.com/...

6 years ago | 0

Answered
How to unpack a table with a column of structs while preserving other columns?
Tnew is the input table (attached). gtTbl = cellfun(@struct2table, Tnew.groundtruth2DBB, 'Unif', false); T = [repelem(Tnew(:...

6 years ago | 0

| accepted

Answered
naming file with count
sprintf('circle_cropped_%03d.jpg',count) % ^^

6 years ago | 0

Answered
Show mouse position in another subplot
Here's a full demo that tracks mouse movement in axis #1 and replicates it in axis #2. The windowbuttondownfcn function updates ...

6 years ago | 3

Answered
Legend error. What did I do wrong here?
The "width" figures contain multiple lines on top of each other just like in your last question. To demonstrate, open the wid...

6 years ago | 0

| accepted

Answered
Legend error. How to fix?
Move this line to end, after copying the line objects. legend('\alpha=0','\alpha=1/9','\alpha=1/10','location', 'northeast') A...

6 years ago | 0

| accepted

Answered
Icon for legend not showing in graphs
This annoying problem has popped up for me too, recently. If you're experiencing the same problem I have, you can fix it a fe...

6 years ago | 1

Answered
Can I add 95% confidence ellipses around groups of data in a pca plot (biplot)?
If you know the center of the clusters and the CI's along the x and y axes for each cluster, you can use this function to plot t...

6 years ago | 1

| accepted

Answered
Adding label to axis ticks
Set the XTickLabel propery of the axis. Use newline to break apart a string into multiple lines. Quick demo: ax = cla(); ax...

6 years ago | 0

| accepted

Answered
Issue with cvpartition warning message
The warning message indicates that at least one of your group values is not represented within the test set. Stratified samplin...

6 years ago | 0

Discussion


New in R2020b: Two new marker symbols
' The Matlab r2020b release introduces the new horizontal ('_') and vertical (' | ') line marker symbols that are centered ar...

6 years ago | 13

Answered
legend in subplot
Update Since this thread continues to get 500+ views per month 9 years later, here's an updated solution for Matlab r2020b or l...

6 years ago | 3

Answered
Multiple plots with same Legend
Update The graphics handles vector h in legend(h) can contain objects from any axes (created by axes(), subplot(), or tiledlayo...

6 years ago | 1

Answered
global legend in tiledlayout
Global legends can be created by specifying the object handles that exist in any subplot (created by subplot or nexttile) within...

6 years ago | 5

Answered
Adding a global legend to a tiledlayout
Update As of Matlab r2020b, legend location can be specified relative to axes created within an TiledLayout. This demo below p...

6 years ago | 7

Answered
Adding legend for subplot when none of the subplots include all legend entries
All you need are the handles to each object you want to include in the legend and the handles can come from different subplots w...

6 years ago | 4

| accepted

Answered
Can you plot polarplots so that theta zero location is at any arbitrary angle or are top left bottom right the only options?
Here's a demo showing how to rotate line objects and theta ticks on polar axes. The orientation of the polar axes is controlled...

6 years ago | 3

| accepted

Answered
Plots every datapoint instead of a line
The problem occurs when yyaxis is used (remove yyaxis and example provided by OP behaves as expected). The full linespec is n...

6 years ago | 1

Answered
Add legend to mutiple figures in a loop with conditional
I agree with Mario that you just have to provide the axis handle to specify where each legend goes. But there's some other stuf...

6 years ago | 2

| accepted

Answered
Percentage values in scatterhist histogram
The histograms are normalized which means their bar heights are already a percentage. The percentage of each bar can be found ...

6 years ago | 2

| accepted

Load more