MATLAB Answers

how to plot data with small values

14 views (last 30 days)
Niki
Niki on 14 May 2014
Commented: Star Strider on 15 May 2014
I want to plot some result which shows how different is the model A from model B etc. My error is something zero. do you have any idea how I can show that the interpretation would be easy too?
Err 1 Err2 Err3 Err4 Err5
A 0.0142 0 0.0410 0 0
B 0 0 0.0138 0 0
C 0 0 0 0 0
D 0 0 0 0 0
E 0.0142 0 0 0 0
F 0 0 0 0 0
G 0 0 0 0 0
H 0.0135 0 0.0416667 0 0.0138889

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 14 May 2014
I have no idea what you are doing, but the bar3 function might be what you want.
For example:
Xt = [{'Err1'} {'Err2'} {'Err3'} {'Err4'} {'Err5'}];
Yt = [{'A'} {'B'} {'C'} {'D'} {'E'} {'F'} {'G'} {'H'}];
M = [ 0.0142 0 0.0410 0 0
0 0 0.0138 0 0
0 0 0 0 0
0 0 0 0 0
0.0142 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0.0135 0 0.0416667 0 0.0138889];
figure(1)
bar3(M)
set(gca, 'XTickLabel', Xt)
set(gca, 'YTickLabel', Yt)
produces:

  9 Comments

Show 6 older comments
Star Strider
Star Strider on 15 May 2014
What doesn’t work? It looks good to me.
Niki
Niki on 15 May 2014
You are right.I made mistake I used the previous "set" and then over right the last one. anyway I found the same figure as you did. I have one question before I accept your solution. can you please let me know whether you know how to plot it like following figure? because if you see your plot does not show for the last one (one columns before the last is dominating the other) . do you know how to plot it like attached file ?
Star Strider
Star Strider on 15 May 2014
The ribbon plot is about as close as we can get. You can change the width of the ribbons and rotate the plot to get the result you want:
[X,Y] = meshgrid(1:8, 1:36);
figure(1)
ribbon(Y, M, 0.1)
set(gca, 'Xtick', 1:8, 'XtickLabel', Xt, 'FontSize',6)
set (gca, 'YTick', 1:36, 'YtickLabel', Yt, 'FontSize',6)
view([50 50])
The Xt and Yt cell arrays stay the same. The meshgrid call is new, and the 0.1 is the ribbon width. Otherwise the data are the same.

Sign in to comment.

More Answers (0)


Translated by