I'm trying to make my surf plot transparent. This is my input:
surf(A,B,C,...
'EdgeColor', 'none',...
'FaceColor','interp')
colormap jet
alpha(.1);
I do not understand why code above isn't working.
Related
I have this piece of code to generate the below plot:
f1 = figure(1);
patch(X,Y,stress_xx,'FaceColor','interp','LineStyle','none');
title('Distribution of stress xx','FontWeight', 'bold');
colormap jet;
axis equal;
How can I smooth the plot so that I won't see the lines in between? FaceColor interp doesn't seem to be working.
I have the following code and I have plotted a 3D plot for the stft with respect to time, frequency and amplitude. How do I change the black color seen in the plot to white? I do not understand how to change the black color to white in colormap option
[ss,ff,tt,pp]= spectrogram(x_dc,128*2,60,128*2,Fs);
figure,surf(tt,ff,abs(ss))
Spectrogram
figure,surf(tt,ff,abs(ss), 'EdgeColor', 'none')
That 'black colour' you see are probably the borders of each cell. Don't show them using the 'EdgeColor', 'none' name-value pair.
Could you tell me how to plot in Matlab figure such as below (smooth transition of colors)? Function countour allows only to create plot with contour lines which doesn't provide enough information to me.
You can use imagesc with the 'jet' colormap. Here's an example:
x = conv2( randn(600), fspecial('gaussian',200,20), 'valid'); %// example 2D smooth data
imagesc(x)
colormap(jet)
colorbar
grid
That is not a contour plot!
try imagesc, surf and all of their variants:
http://uk.mathworks.com/help/matlab/surface-and-mesh-plots-1.html
http://uk.mathworks.com/help/matlab/image-file-operations.html
I have two things to show in the same figure: a surf plot and a grayscale image. They must be shown in the same figure, and the plot must be in colour. If I show the plot first and step through the code, the plot is displayed in colour just fine, but the moment the grayscale image is shown, everything turns to grascale.
Note: I have tried changing the colour map, but it also changes the grayscale image. Is there any way to just have the plot in colour?
Here's a snippet of my code:
figure;
subplot(1,2,1);
surf(data), shading interp;
subplot(1,2,2);
imshow(grayimg);
The problem is that Matlab supports only one colormap per figure, you are trying to use two: gray for the image and jet for the surfplot.
A workaround is to trick Matlab to believe the image is in color ;)
figure;
subplot(1,2,1); surf(data); shading interp;
subplot(1,2,2); imshow( grayimg(:,:,[1 1 1]) ); % this is the trick: you convert one channel image to RGB image with all pixels shades of gray...
I would like to have a 2D plot along with a 3D surface or mesh plot - shown by the blue line I drew on the surface plot below. How do I get it?
UPDATE: Natan's Solution worked :-) But I now have a new Problem - How do I add 2 Y axis to my MATLAB Plot?
Just add to the surf plot another plot using plot3 where the relevant axis has the limits of the surf plot.
For example:
z=peaks(100);
surface(z, 'EdgeColor', 'none');
colormap(hot)
view(30,30); camlight; axis vis3d
x1=linspace(0,100);
hold on
plot3(x1,0*ones(1,numel(x1)),4*sin(x1))