xsticklabel_rotate parameter/value pair arguments
1 view (last 30 days)
Show older comments
aine gormley
on 17 Oct 2018
Commented: aine gormley
on 20 Oct 2018
Hi, Im trying to plot the following figure, but keep getting the error about xsticklabel.
if true
>> figure;
h = bar(1:7,QIRR_srex,'hist'); hold on;
g(1) = plot(1,1, 'b', 'LineWidth',2.5); hold on;
g(2) = plot(1,1, 'g', 'LineWidth',2.5); hold on;
set(h(1),'facecolor',[0.5 0.5 1])
set(h(2),'facecolor',[0.5 1 0.5])
set(h(3),'facecolor',[1 0.5 0.5])
set(h,'edgecolor','none')
axis([0 8 0 160]);
mf_xticklabel_rotate([1:7],45,[srex_reg],'interpreter','none','Fontsize', 11, 'Fontweight', 'Bold','color', axcolor); %#ok<NBRAK>
ylabel('Q_i_r_r [mm yr^-^1]', 'Fontsize', 14, 'Fontweight', 'Bold');
legend(g, 'OBS', 'IRR', 'Location', 'SouthWest');
set(legend,'YColor','w','XColor','w', 'Fontweight', 'Bold', 'Fontsize', 11,'textcolor', axcolor);
set(gca, 'Fontsize', 14, 'Fontweight', 'Bold','Xcolor', axcolor,'Ycolor', axcolor);
export_fig text/figures_paper/figure_02 -transparent;
Error using matlab.graphics.primitive.Text/set
Invalid parameter/value pair arguments.
Error in mf_xticklabel_rotate (line 154)
set(hText,'HorizontalAlignment','right',varargin{:})
Here is also the part of xsticklabel the error refers to: xAxisLocation = get(gca, 'XAxisLocation');
xAxisLocation = get(gca, 'XAxisLocation');
if strcmp(xAxisLocation,'bottom')
set(hText,'Rotation', rot, 'HorizontalAlignment','right',varargin{:})
else
set(hText,'Rotation', rot, 'HorizontalAlignment','left',varargin{:})
end if true
I have tried multiple things like different putting in rot value directly (ie 90), but it doesnt seem to help. Please can someone help?
3 Comments
Accepted Answer
Steven Lord
on 17 Oct 2018
Which release of MATLAB are you using? If you're using release R2014b or later there are properties that support rotated axis tick labels. If you're using release R2016b or later there are convenience functions that will make it easier to rotate the labels.
3 Comments
More Answers (0)
See Also
Categories
Find more on Geographic Plots 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!