Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: plot: x-ticks and more
Replies: 4   Last Post: Nov 20, 2012 4:45 PM

 Messages: [ Previous | Next ]
 dpb Posts: 9,822 Registered: 6/7/07
Re: plot: x-ticks and more
Posted: Nov 20, 2012 9:52 AM

On 11/19/2012 11:17 PM, Thomas wrote:
> Just learning to script figures and having a difficult time of it. I
> have a few, probably simple, questions. I wouldn't ask if I hadn't spent
> an entire day already with help files and internet forums - I am missing
> something very basic.....
>
> For example, I have this basic script:
>
> boxplot(ABC,[0],'k.',[],[2])
> set(gca,'YLim',[0,10],'YTick',[0:2:10],'YGrid','on')
> ylabel('Tmx')
> set(gca,'findobj(gcf,'Tag','Box'),'Color','k')
>
> (1) How do I work with the x-axis??? (1a) What if I would like the
> x-axis gone (as for a subplot)?
>
> (2) How do I get the ylabel to appear in bold?
>
> (3) The median lines in the boxes are still in red - how do I make them
> black?

...

1) All properties for the axis object are available to set()/get() from
the axis handle which you can get from gca.

set(gca)

from the command line will list all properties for that axis and the
'children' property will have the handles to the objects below it
(lines, text, etc., ...) The x-, y- and z- axis properties are a group
within the axis properties that begin w/ the specific letter while
others are global.

You can also for getting started use the properties editor/inspector to
interactively piddle...

<http://www.mathworks.com/help/matlab/creating_plots/plotting-tools--interactive-plotting.html#f9-43442>

2) Change the font weight for the text object that is the y-label.
Either get() the handle of the label as

hylab=get(get(gca,'ylabel'));

or save it when creat it (and can set the weight when add it then as
well)...

hylab=label('This is Y-LABEL','fontweight','bold');

or, again, you can use the properties editor interactively...

3) Similar as above--find the line objects and change the color for the
desired ones...

Read the sections on handle graphics to get a better feel and follow
along w/ the examples...

--

Date Subject Author
11/20/12 Thomas
11/20/12 dpb
11/20/12 Thomas
11/20/12 dpb
11/20/12 dpb