'Octave graphic xticklabel fixing and rotation
I'am using Octave 5.2.0. to create a double axed plot with plotyy (in a subplot)
I created xticklabels with text() function, giving me an object with ypositions and xtick (rotated).
My problem is that when I move the curves of the subplot 1 (e.g. down) using the 'pan', the xticklabels move also in the same direction until they are hidden after the second plot and I have to move the curve in the opposite direction to see them again.
Second question. Is there no xticklabelrotation possible without using the text() function because this is very slow (5 min for 4000 dates). I include a part of the code. and 2 pictures (1 after moving the curve UP).
Thanks for helping.
function plotKoersIndicSub(varargin)
[labelsVrX,labelsVrXNrs,xDateEpoch]=prepXVrPlot(varargin(dateKol)); [dateKol,P1Y1Kol,P1Y2Kol,P2Y1Kol,P2Y2Kol,labP1Y1,labP1Y2,labP2Y1,labP2Y2]=splitVarargin(varargin,nargin);
clf
hax1 =subplot (2, 1, 1);
[ax,hCurve1,hCurve2] = plotyy (xDateEpoch,varargin(P1Y1Kol(1)){:},xDateEpoch,varargin(P1Y2Kol(1)){:}, @plot, @plot);
fig=gcf();
set(fig,'units','centimeters'); set(fig,'position',[19,2.8,15,15]);
set(hCurve1, "linestyle", ":"); set(hCurve1,'LineWidth',2); set(hCurve1,'Color','blue');
set(hCurve2, "linestyle", "-"); set(hCurve2,'LineWidth',2); set(hCurve2,'Color','red');
hYlab1=ylabel(ax(1), labP1Y1); set (hYlab1, "fontsize", 14);
hYlab2=ylabel(ax(2), labP1Y2); set (hYlab2, "fontsize", 14);
k1Mx=max(varargin(P1Y1Kol(1)){:});k2Mx=max(varargin(P1Y2Kol(1)){:});
k1Min=min(varargin(P1Y1Kol(1)){:});k2Min=min(varargin(P1Y2Kol(1)){:});
ylim(ax(1),[k1Min k1Mx]);ylim(ax(2),[k2Min k2Mx]);
linkaxes(ax,'x');
set(gca,'xticklabel',labelsVrXNrs);
h = get(gca,'xlabel');
xlabelposition = get(h,'position');
yposition = xlabelposition(2); % yposition = 0.80090
yposition = repmat(yposition,columns(xDateEpoch),1);
set(gca,'xtick',[]);
hnew = text(xDateEpoch, yposition, labelsVrX);% 5 minutes!! / 4000 dates
set(hnew,'fontsize',14);
set(hnew,'rotation',90,'horizontalalignment','right');
endfunction
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
