Re: Combined plot

Markus Mützel <[email protected]>
Newsgroups gmane.comp.gnu.octave.general
Message-ID <trinity-bcf573b1-946d-4702-ac0f-071ec42d66e5-1611848294752@3c-app-gmx-bs32>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.