Thread Subject: Datetickzoom.m and 1) 2 y-axes 2)rotate Xticklabels

Subject: Datetickzoom.m and 1) 2 y-axes 2)rotate Xticklabels

From: D Bay

Date: 24 Sep, 2008 04:56:01

Message: 1 of 5

I am rather new to MATLAB and am slowly learning my way around it.

I have been using the datetickzoom.m file for my data and it works great when I have an x-y plot (temperature or flow rate etc vs time) and need the date to adjust when I zoom in and out. I have now run into a few (2) limitations of the file and would like to know how to circumvent these problems in as easy a way as possible.

1. I would like to rotate the Xticklabels. I have tried implementing xticklabel_rotate90.m and rotateticklabel.m, but can't seem to get either of them to work when using datetickzoom.m. I would really prefer to use rotateticklabel.m because I would like the freedom to rotate my Xticklabels less than 90 degrees. Any ideas???

2. Graphing 2 y-axes and one x-axis using:
[AX,H1,H2] = plotyy (x1,y1,x2,y2)
When I use datetickzoom and this function, the dates for x1 are changed, but not x2 and it looks bad. Can I link x1 and x2 Xticklabels together? They should be the same datenum (date) value. If so, what would be a (SIMPLE??) way to do this?

Cheers
Danny
UBC

Subject: Datetickzoom.m and 1) 2 y-axes 2)rotate Xticklabels

From: Walter Roberson

Date: 24 Sep, 2008 05:09:43

Message: 2 of 5

D Bay wrote:
> 2. Graphing 2 y-axes and one x-axis using:
> [AX,H1,H2] = plotyy (x1,y1,x2,y2)
> When I use datetickzoom and this function, the dates for x1 are changed, but not
> x2 and it looks bad. Can I link x1 and x2 Xticklabels together? They should be the
> same datenum (date) value.

In theory, you should be able to use linkprop() to do that, if you have a
new enough version to support linkprop().

Subject: Datetickzoom.m and 1) 2 y-axes 2)rotate Xticklabels

From: Carlos Adrian Vargas Aguilera

Date: 24 Sep, 2008 21:32:01

Message: 3 of 5

> Can I link x1 and x2 Xticklabels together?

You may try TLABEL:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=19314

it uses datetickzoom and links axes (I have a new version but I hadn't updated yet).



> 1. I would like to rotate the Xticklabels

Change the following lines in datetickzoom or tlabel:

set(zoom(axh),'ActionPostCallback',@datetickzoom) set(pan(get(axh,'parent')),'ActionPostCallback',@datetickzoom)
or
set(zoom(axh),'ActionPostCallback',@tlabel) set(pan(get(axh,'parent')),'ActionPostCallback',@tlabel)

For:
set(zoom(axh),'ActionPostCallback',@tlabelrot) set(pan(get(axh,'parent')),'ActionPostCallback',@tlabelrot)

And you need to create and save the function:

function datetickzoomrot
tlabel
rotateticklabel


Get the idea? Hope it works...



Carlos





>
> Cheers
> Danny
> UBC

Subject: Datetickzoom.m and 1) 2 y-axes 2)rotate Xticklabels

From: D Bay

Date: 29 Sep, 2008 22:49:02

Message: 4 of 5


Change the following lines in datetickzoom or tlabel:

set(zoom(axh),'ActionPostCallback',@datetickzoom) set(pan(get(axh,'parent')),'ActionPostCallback',@datetickzoom)
or
set(zoom(axh),'ActionPostCallback',@tlabel) set(pan(get(axh,'parent')),'ActionPostCallback',@tlabel)

For:
set(zoom(axh),'ActionPostCallback',@tlabelrot) set(pan(get(axh,'parent')),'ActionPostCallback',@tlabelrot)

%%%%%%
OK Carlos, thank you!

I followed your instructions but im still not getting it. Renamed tlabel.m to tlabelrot.m, and followed your instructions above. How do i input the rotation angle? Still unclear. Does tlabel link my axes as well??

Subject: Datetickzoom.m and 1) 2 y-axes 2)rotate Xticklabels

From: Carlos Adrian Vargas Aguilera

Date: 29 Sep, 2008 23:31:02

Message: 5 of 5

Oh yes, you are right, one should check the inputs of the rotations functions. But the idea is that you need to create a function CALLBACK (at least 2 entries HANDLE + EVENT) and put its handle in those lines (do not rename tlabel!).

Inside that function you may put rotate, tlabel etc etc, with arguments you like.

Well, think about it...

Carlos

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
datetick Carlos Adrian Vargas Aguilera 24 Sep, 2008 17:35:05
rotate xticklabel D Bay 24 Sep, 2008 01:00:06
2 yaxes D Bay 24 Sep, 2008 01:00:06
datetickzoom D Bay 24 Sep, 2008 01:00:06
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com