Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[matlab] bar3 --- 3-D graph again (Please discard the precious one)

43 views
Skip to first unread message

Jing Zhang

unread,
Nov 8, 2003, 12:27:39 AM11/8/03
to
Hi, I am preparing the graphs for a paper. Does anybody know how to
fix the following problems for the attached graph.
1. The string "Interarrival time" should be parellel to the labels 1,
2, 3, 4, 5.
2. How to specify different colors for the groups of data bars. For
example, if I want the front row of bars in green and the rear row of
bars in red or yellow, how can I do it by using some command silimar
to plot(x, y, 'r')?
3. Similarly, how can I choose different textures for different rows
of bars?
4. How can I put the legend to the left-top corner with edges
paralell to the background lines?


I will appreciate your help.


Jing


P.S. I just found out that I could nothing. Therefore, I am appending
my m file codes below.
----------------------------------------
N = [5 2; 8 7; 9 5; 5 1; 4 3];
bar3(N);


legend('Packet string','Packet pair');
ylabel('Interarrival time (ms)');
zlabel('Occurring frequencies')
%colormap(cool);


grid on;

Someone

unread,
Nov 8, 2003, 2:17:28 AM11/8/03
to

"Jing Zhang" <jin...@hotmail.com> schreef in bericht
news:eec6e...@WebX.raydaftYaTP...

| Hi, I am preparing the graphs for a paper. Does anybody know how to
| fix the following problems for the attached graph.
| 1. The string "Interarrival time" should be parellel to the labels 1,
| 2, 3, 4, 5.

Rightclick on the label. From the menu select "Properties..." On the Style tab
change the "Rotation" setting to -37.5 degrees

| 2. How to specify different colors for the groups of data bars. For
| example, if I want the front row of bars in green and the rear row of
| bars in red or yellow, how can I do it by using some command silimar
| to plot(x, y, 'r')?
| 3. Similarly, how can I choose different textures for different rows
| of bars?

Rightclick the object that you want to change then slect properties and see
what properties can or can't be changed.

| 4. How can I put the legend to the left-top corner with edges
| paralell to the background lines?

Try: help legend

You can't rotate the legend

Jing Zhang

unread,
Nov 8, 2003, 12:20:14 PM11/8/03
to
I tried to rightclick the legend or the object I wanted to change its
properties, but there was no dialog box popped out with a "property"
choice. Is this version oriented? My matlab version is 5.3 for
windows.


Thanks very much.


Jing

Dave Jones

unread,
Nov 8, 2003, 3:03:38 PM11/8/03
to
You have to select the pick tool...looks like an arrow, but not the
arrow tool in the Figure toolbar. Then select something and
double-click or right-click.

Dave

On Sat, 8 Nov 2003 12:20:14 -0500, "Jing Zhang" <jin...@hotmail.com>
wrote:

Jing Zhang

unread,
Nov 8, 2003, 7:30:31 PM11/8/03
to
I am sorry that I created a new thread for this topic. Could anybody
delete it for me?


Here is my new message:


There are totally two lines in a figure. The top line:
File/edit/Tools/Window/Help. The bottom line includes Plot Editing /
Add Arrow / Rotate 3-D ... etc. If it is a graph only consisting 2-D
curves, I click the plot editing arrow, and right click the line
(curve) I want to edit. Then a pop-up window appears with property
selection. By choosing the property selection, I can change all the
properties of the selected line (curve) including color, line style,
and marker, etc. However, for the figure produced by bar3, I can only
select and rotate the whole graph, or to select some lines or text I
put into the graph later. I am unable to select the bars or the
legend produced by bar3 command.


I am really stuck. Could anybody give me more instructions? I really
need these techniques.


I appreciate your help.


Jing

Jing Zhang

unread,
Nov 9, 2003, 2:59:51 AM11/9/03
to
I got the following from matlab help:
---------------------------------------------

BAR(...,'grouped') produces the default vertical grouped bar
chart.
BAR(...,'stacked') produces a vertical stacked bar chart.
BAR(...,LINESPEC) uses the line color specified (one of
'rgbymckw').
---------------------------------------------Then I tried the
following codes:
N = [2 5; 7 8 ; 5 9 ; 1 5 ; 3 4];


bar(N, 'r', 'g');


but it doesn't work. When I change bar(N, 'r', 'g') to bar(N, 'r'),
it works with all the two rows of bars change to red. Does anybody
used this funciton before?


Jing

ross woods

unread,
Nov 9, 2003, 7:22:52 AM11/9/03
to


Perhaps that approach will only let you change all the colors at
once.


Try this instead: change the colormap.


N = [2 5; 7 8 ; 5 9 ; 1 5 ; 3 4];

bar3(N)
colormap([1 0 0; 0 1 0])


Cheers,
Ross

Jing Zhang

unread,
Nov 9, 2003, 7:35:32 PM11/9/03
to
This method is great! It solved my problem. BTW, what are the other
vector values for the standard 7 colors? Or, Where can I find these
values?

Ross Woods

unread,
Nov 9, 2003, 9:14:35 PM11/9/03
to
Jing Zhang wrote:
>
>
> This method is great! It solved my problem. BTW, what are the other
> vector values for the standard 7 colors? Or, Where can I find these
> values?


Hi,


get(gca,'colororder')


ans =


0 0 1.0000
0 0.5000 0
1.0000 0 0
0 0.7500 0.7500
0.7500 0 0.7500
0.7500 0.7500 0
0.2500 0.2500 0.2500


Cheers,
Ross

0 new messages