help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Combined plot


From: Markus Mützel
Subject: Re: Combined plot
Date: Thu, 28 Jan 2021 16:38:14 +0100

Am 27. Januar 2021 um 17:38 Uhr schrieb "Blaz":
> Hello Markus
>
> Yes, I have tried /quiver/, but the result is not what I wanted. Probably I
> am using it wrong. I have managed to do something similar with /bar/, but I
> would like to replace bars with arrows.
>
> odev.png <https://octave.1599824.n4.nabble.com/file/t373917/odev.png>

It's not easy to get esthetically pleasing results using `quiver` with your 
data. IIUC that is because the scale in x and y direction is very different.
This might come close to what you might want:
t = [0:0.001:0.03];
x = sin(2*pi*50*t);
clf;
plot(t, x);
hold on
teven = t(2:2:end);
xeven = x(2:2:end);
quiver(teven, zeros(size(teven)), zeros(size(xeven)), xeven, 0, 'maxheadsize', 
0.002);

The arrow heads look "nicer" if the scale in x and y is approximately equal:
t = [0:0.001:0.03]*100;  % use different scale in x direction
x = sin(2*pi*50*t);
clf;
plot(t, x);
hold on
teven = t(2:2:end);
xeven = x(2:2:end);
quiver(teven, zeros(size(teven)), zeros(size(xeven)), xeven, 0, 'maxheadsize', 
0.05);

Maybe you could work with that and manually adjust the "xticklabel" property of 
the axes.


Or manually place `annotation` objects at the positions you need. See e.g. 
`demo annotation 6`.

HTH,
Markus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]