Issue with contour plot due to different size
Hello,
As cited above I want to have a contour plot, but the problem is the size of X and Z are different. as given below:
x0 = x;
t0 = Time(1:9:100);
[t1, x1] = meshgrid(t0, x0);
contourf(t1,x1,H0I0_Turbulence_cen2,1000,’edgecolor’,’none’)
colormap(jet);
colorbar;
X = min(t0):(max(t0)-min(t0))/9:max(t0);
set(gca, ‘xlim’, [min(t0) max(t0)]);
set(gca, ‘xtick’, X);
xtickformat(‘%.2f’);
xlabel(‘t’,’FontSize’,24,’fontweight’,’bold’);
Y = min(x0):(max(x0)-min(x0))/9:max(x0);
set(gca, ‘ylim’, [min(x0) max(x0)]);
set(gca, ‘ytick’, Y);
ytickformat(‘%.1f’);
ytickformat(‘%.2f’);
ylabel(‘x’,’FontSize’,24,’fontweight’,’bold’)
set(gca,’ycolor’,’k’);
set(gcf,’color’,’w’);
hold on
contour(t1,x1,H0I0_Turbulence_cen2,’k’,’ShowText’,’on’)
grid on
hold off
ct = 0:(max(max(H0I0_Turbulence_cen2))-0)/10:max(max(H0I0_Turbulence_cen2));
c=colorbar(‘Ticks’,ct);
clim([0 max(max(H0I0_Turbulence_cen2))]);
c.TickLabels = compose(‘%.2f’,ct);
ylabel(c,’itI_{cen}’,’FontSize’,24, ‘fontweight’, ‘bold’);
Here, size(t1) = 100 x 12, size(x1) = 100×12,
and size(H0I0_Turbulence_cen2)=6×12
So size is differing by a large amount.
Thus I get the error as "Error using contourf
The size of X must match the size of Z or the number of columns of Z."
Is there any way to solve this issue and plot the contour?Hello,
As cited above I want to have a contour plot, but the problem is the size of X and Z are different. as given below:
x0 = x;
t0 = Time(1:9:100);
[t1, x1] = meshgrid(t0, x0);
contourf(t1,x1,H0I0_Turbulence_cen2,1000,’edgecolor’,’none’)
colormap(jet);
colorbar;
X = min(t0):(max(t0)-min(t0))/9:max(t0);
set(gca, ‘xlim’, [min(t0) max(t0)]);
set(gca, ‘xtick’, X);
xtickformat(‘%.2f’);
xlabel(‘t’,’FontSize’,24,’fontweight’,’bold’);
Y = min(x0):(max(x0)-min(x0))/9:max(x0);
set(gca, ‘ylim’, [min(x0) max(x0)]);
set(gca, ‘ytick’, Y);
ytickformat(‘%.1f’);
ytickformat(‘%.2f’);
ylabel(‘x’,’FontSize’,24,’fontweight’,’bold’)
set(gca,’ycolor’,’k’);
set(gcf,’color’,’w’);
hold on
contour(t1,x1,H0I0_Turbulence_cen2,’k’,’ShowText’,’on’)
grid on
hold off
ct = 0:(max(max(H0I0_Turbulence_cen2))-0)/10:max(max(H0I0_Turbulence_cen2));
c=colorbar(‘Ticks’,ct);
clim([0 max(max(H0I0_Turbulence_cen2))]);
c.TickLabels = compose(‘%.2f’,ct);
ylabel(c,’itI_{cen}’,’FontSize’,24, ‘fontweight’, ‘bold’);
Here, size(t1) = 100 x 12, size(x1) = 100×12,
and size(H0I0_Turbulence_cen2)=6×12
So size is differing by a large amount.
Thus I get the error as "Error using contourf
The size of X must match the size of Z or the number of columns of Z."
Is there any way to solve this issue and plot the contour? Hello,
As cited above I want to have a contour plot, but the problem is the size of X and Z are different. as given below:
x0 = x;
t0 = Time(1:9:100);
[t1, x1] = meshgrid(t0, x0);
contourf(t1,x1,H0I0_Turbulence_cen2,1000,’edgecolor’,’none’)
colormap(jet);
colorbar;
X = min(t0):(max(t0)-min(t0))/9:max(t0);
set(gca, ‘xlim’, [min(t0) max(t0)]);
set(gca, ‘xtick’, X);
xtickformat(‘%.2f’);
xlabel(‘t’,’FontSize’,24,’fontweight’,’bold’);
Y = min(x0):(max(x0)-min(x0))/9:max(x0);
set(gca, ‘ylim’, [min(x0) max(x0)]);
set(gca, ‘ytick’, Y);
ytickformat(‘%.1f’);
ytickformat(‘%.2f’);
ylabel(‘x’,’FontSize’,24,’fontweight’,’bold’)
set(gca,’ycolor’,’k’);
set(gcf,’color’,’w’);
hold on
contour(t1,x1,H0I0_Turbulence_cen2,’k’,’ShowText’,’on’)
grid on
hold off
ct = 0:(max(max(H0I0_Turbulence_cen2))-0)/10:max(max(H0I0_Turbulence_cen2));
c=colorbar(‘Ticks’,ct);
clim([0 max(max(H0I0_Turbulence_cen2))]);
c.TickLabels = compose(‘%.2f’,ct);
ylabel(c,’itI_{cen}’,’FontSize’,24, ‘fontweight’, ‘bold’);
Here, size(t1) = 100 x 12, size(x1) = 100×12,
and size(H0I0_Turbulence_cen2)=6×12
So size is differing by a large amount.
Thus I get the error as "Error using contourf
The size of X must match the size of Z or the number of columns of Z."
Is there any way to solve this issue and plot the contour? contour MATLAB Answers — New Questions