Plotting images in Matlab 2026a

I frequently work with large matrices and usually I can use pcolor to plot these - but since I updated Matlab to 2026a I get an error everytime I use the same code to do something which worked in Matlab 2024a.
I can't share my data, but my code is as follows - where t is a 1713x1 datetime array; f is a 1x24001 double array and psd_dat is 1713*24001 double matrix.
I tried to use imagesc instead, and this works, but doesn't allow me to shift the y axis to a log scale, which I need to do. In the past, pcolor allowed me to do this easily.
Thanks for your help and please let me know if I can provide any further detail!
The Warning message (whether using pcolor or surf) is:
Warning: An error occurred while drawing the scene: Error in web draw traversal: RangeError: Array buffer allocation failed
pcolor(t,f,psd_dat,'edgecolor','none');
%imagesc(t,f,psd_dat);
%axis xy;
set(gca,'tickdir','out') %set tick marks to point outwards
xtickformat('dd-MM HH:mm');
xticks(t(1):0.5:t(end))
set(gca,'YScale','log');
[Removed extra quote on psd_dat variable in two places--dpb]

3 Comments

but since I updated Matlab to 2026a I get an error everytime I use the same code to do something which worked in Matlab 2024a.
Please show us the full and exact text of the error message, all the text displayed in red in the Command Window (and if there are any warning messages displayed in orange, please show us those too.) The exact text may be useful and/or necessary to determine what's going on and how to avoid the warning and/or error.
Thanks - I have provided that now.
dpb
dpb 39 minutes ago
Edited: dpb 9 minutes ago
"I can't share my data, ..."
"The Warning message (whether using pcolor or surf) is:"
Warning: An error occurred while drawing the scene: Error in web draw traversal: RangeError: Array buffer allocation failed
Just to prove it's a memory-related issue, try
M = 1713; N = 24001;
psd_dat = rand(M,N);
and see if the same error doesn't occur.
One could do some binary searching and see at what point/size the error begins to occur...alternatively, one could check that it is an indexing issue or an actual allocation issue by
pcolor(single(t),single(f),single(psd_dat),'edgecolor','none');

Sign in to comment.

Answers (2)

I am not certain what you want, however one option is to use surf and then rotate it with the view function. Also, 'interp' might be a better choice for EdgeColor.
I can't get this to run here, however MATLAB Online produces this result using a calculated Gaussian as the 'image' --
clear all
close all
tic
t = datetime('now') + hours(0:1712).';
f = linspace(0, 100, 24001);
psd_dat = exp(-((0:numel(t)-1).'-800).^2/2E+5) * exp(-(f - 50).^2/1000) * 1000;
[mindat,maxdat] = bounds(psd_dat(:))
% figure
% contour(psd_dat')
%
% toc
%
% return
% figure
% surf(psd_dat.', EdgeColor='interp')
% colormap(turbo)
% title('Surface Plot')
figure
% surf(t,f,psd_dat','edgecolor','none');
surf(t,f,psd_dat','edgecolor','interp') % <-- ChANGED
%imagesc(t,f,psd_dat');
%axis xy;
set(gca,'tickdir','out') %set tick marks to point outwards
xtickformat('dd-MM HH:mm');
xticks(t(1):0.5:t(end))
set(gca,'YScale','log');
view(0,90) % <-- ADDED
toc
The image was copied and pasted.
.

2 Comments

Thanks! Unfortunately I also get this warning message with surf().
Star Strider
Star Strider about 17 hours ago
Edited: Star Strider 26 minutes ago
My pleasure!
The error indicates to me that you may be having memory problems. You should have access to MATLAB Online, so try it there as well.
It worked for me without any warning messages or errors, however I don't have your data.
EDIT -- (21 Sep 2026 at 20:42)
In order to upload your data to use with MATLAB Online, you will need to use MATLAB Drive.
.

Sign in to comment.

dpb
dpb about 2 hours ago
Edited: dpb 7 minutes ago
R2025+ shifted away from OpenGL to the Chromium browser-based WebGL renderer which is limited to a 2GB memory footprint. pcolor will try to generate some 40+M polygons and exceeds that allowable memory. Probably the simplest workaround is to log transform the y axes values directly for imagesc and then write the ticklabels to match depending upon the actual frequency scaling/range. You'll want to set YDir to 'Normal' to keep the same orientation as pcolor
The alternative to still be able to use pcolor() would be to downscale sufficiently to not exceed the 2GB memory limit.

Products

Release

R2026a

Asked:

on 16 Sep 2026 at 22:01

Edited:

dpb
on 21 Sep 2026 at 21:52

Community Treasure Hunt

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

Start Hunting!