axis color disappear when using the white_jet color map

Hello everyone and Happy New Year
I am trying to draw a slip distribution graph and want to show the parts with no slip White
I found a Function in File Exchange "colormap jet_white", it is almost what I need except that by using this function my axis disappear!
Is there any way to superpose axis on top ,or any other way to have my color map from White Zero

6 Comments

@Samaneh Arzpeima: in your title you mention "white_jet", which I cannot find anywhere. In your question you mention "jet_white", which is available on FEX, and is presumably the function you meant to write in the title.
Hi Samenah,
The help on jet_white states
"Since the "jet" colormap matrix can vary in size depending on the plot that it will be applied to, this function should be executed after any plot commands."
I wonder if moving the jet_white execution code below all of your plot commands will solve your issue? Please let me know. Thanks.
jet_white appears to have been removed from the File Exchange. I do see jetwhite though, at https://www.mathworks.com/matlabcentral/fileexchange/48419-jetwhite-colours
Thank you Sir. Now I am stuck! how can I make my color bar start at zero with color white ? I appriceate any tips.
colormap(flipud(jetwhite(256)))
thank you it gaves me a plot with white color at Zero,almost the same as jet_white(I attached it ).But still my first problem remain, how can I display the axes, like a black line or what ever(like https://jp.mathworks.com/help/matlab/ref/contourf.html).Now I just have slipdis.png ticks label

Sign in to comment.

Answers (3)

Hi Samenah,
The help on jet_white states
"Since the "jet" colormap matrix can vary in size depending on the plot that it will be applied to, this function should be executed after any plot commands."
I wonder if moving the jet_white execution code below all of your plot commands will solve your issue? Please let me know. Thanks.

1 Comment

Thank you Jim
I am not sure if i did understand your advice or not,but I moved the colormap command to the very end part of my script(sorry its not a very neat script )
I attached what I've got !!slipdis.png

Sign in to comment.

clear ;
clc
load d.mat
d.X = d.X+150;
%% Slip distribution
scatter(d.Y,d.X,5,d.Dz);
grid on
axis equal
xlim([-200 200])
ylim([0 300])
axis ij
set(gca, 'XDir','reverse')
ylabel('Down dip (km)','FontSize',12)
xlabel('Along Strike (km)','FontSize',12)
c = colorbar;
set(get(c,'title'),'string','(m)'); %write the title on the top
caxis([0 10])
% colormap jet_white
map = jet_white();
colormap(map)
axis on
hold on
%% drow asp
rectangle('Position',[-17.5 75 35 34.468],'EdgeColor',[0 0 0])
%% drow con
% %find max slip on surface
SurfaceDmax=max(d.Dz(find(d.Z>=0))) %m
%%
maxslip=max(d.Dz);
slipTH=max(d.Dz)*0.1;
id_DZ=d.Dz>=slipTH;
d.Dz=d.Dz(id_DZ);
d.X=d.X(id_DZ);
d.Y=d.Y(id_DZ);
d.Trup=d.Trup(id_DZ);
[X,Y] = meshgrid(linspace(min(d.Y),max(d.Y)), linspace(min(d.X),max(d.X)));
[C,h]=contour(X,Y,griddata(d.Y,d.X,d.Trup,X,Y),[ 70 60 50 45 40 30 25 20 15 10 5 2],'EdgeColor',[0 0 0]);
set(gca, 'XDir','reverse')
clabel(C,h,'FontSize',10,'LabelSpacing',200,'Color','k')
%%
fig.Color = 'gray';
saveas(gcf,'slipdis.png')
saveas(gcf,'slipdis.epsc')
@Stephen Cobeldick it gaves me the graph without the axis slipdis.png

4 Comments

@Samaneh Arzpeima: use the debugging tools: set a breakpoint at the start of your code, step through until you find the line where the axes disappear. Then tell us exactly which line it is.
If you want someone to run your code then you will need to upload the following:
  • the d.mat file
  • the colormap the you are using.
I couldn't know how to debug and find the problem line! Also couldn't attach the d.mat. it seems to be larger that 5MB and
zip('d','d.mat')
did not compress it ! helpless :<
thank you anyway
"I couldn't know how to debug and find the problem line!"
You have to learn to use the debugging tools. They are indispensible in any programming language. Start here:
You will also find plenty of (video) tutorials online.
I figuered out how to debug. I think the problem started from scatter command.I attached a pdf file with 4 screenshot of debuffing process with the related command under it.the forth figure has no axes.Is there anyway to fix the problem,please.

Sign in to comment.

Products

Asked:

on 7 Jan 2019

Community Treasure Hunt

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

Start Hunting!