how to add axes x and y in the middle of figure 2D then i rotate x with an angle theta?

2 views (last 30 days)
i want to add axes x and y in the middle of figure 2D then i rotate x with angle theta .Please help
  6 Comments
yasmine zamni
yasmine zamni on 16 Jun 2017
Edited: dpb on 16 Jun 2017
thx for your answer, i will explain more. I have Gaussian data displayed in 2D means when i plot the data i see the data in orthonormal marker (which is axe Y Perpendicular to axe X ) this is the data
mu =[1 1 ];
sigma = [0.001,0;0,50000];
r = mvnrnd(mu,sigma,2000);
plot(r(:,1),r(:,2),'+',v(:,1),v(:,2),'*');
Then, i want to rotate the axe x but not the current axes. So, i want to add anther axe x in the middle of the data and then i rotate this axes. What i did found in the internet is the object that rotated not the axes I hope that I have explained.
dpb
dpb on 16 Jun 2017
>> mu =[1 1 ];
sigma = [0.001,0;0,50000];
r = mvnrnd(mu,sigma,2000);
plot(r(:,1),r(:,2),'+',v(:,1),v(:,2),'*');
Undefined variable v.
>>
So what's v? Was going to try to visualize what your plot actually is...
" want to add another axe x in the middle of the data and then i rotate this axes."
Well, I didn't try it, but the camera properties are on each axes; don't see why you couldn't create the second axes and mess with it on the top but the plotted data has to be on that axes to have any affect on it.
I'm still not positive what it is you're trying to get to, sorry...

Sign in to comment.

Answers (1)

dpb
dpb on 15 Jun 2017
Well, may not be what looking for but it was hot out and I didn't feel like battling 100F for a while here...
axes
camroll(30)
xlabel('X'), ylabel('Y')
set(gca,'dataaspectratiomode','manual')
hold all
plot(1:10,1:10)
xlim([1 10]), ylim([1 10])
set(gca,'xtick',1:10,'ytick',1:10)
hTxt=text(1,10,num2str(30,'Angle %3d'));
results in
I don't understand all I know yet, you'll have to really delve into the section on camera positioning terminology to really get to the bottom of it, but that is the result of a 30 degree rotation--the data is on the underlying axes and you're just modifying the location from which viewing by rotating around the z-axis. The camera position is at data coordinates [0.5,0.5] in the x-y plane; I don't have HG2 so don't have the facility to draw the axes at the midpoint but by inference that is default here should be [0,0] for HG2 when do center axes locations.
plot on its own will reset the properties so either do the drawing before the rotation stuff or as above use hold all to keep what you worked so hard to get first.
NB: to help understand what happens, the camera orientation after the rotation is
get(gca,'cameraupvector')
ans =
0.5000 0.8660 0
>>
which you note is [sind(30) cosd(30) 0]; in fact, just setting those values accomplishes what camroll does.
I don't know why the Y axis labels move to the RH side; that's one of the things in the "I don't yet understand all I know" categories; the 'YAxisLocation' property is still 'Left' and switching it to _'Right' made no visible difference so there's something going on in the rendering behind the scenes...
Mayhaps with that you can render the effect desired, anyway, without having to draw it all from basic geometrical constructions, I dunno' ...

Categories

Find more on Interactions, Camera Views, and Lighting in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!