How to make contour plot with two y axes.

5 views (last 30 days)
ref
ref on 8 Feb 2013
Hello, I am running the code shown bellow to create contour plots. What I do not get is what to change in order to create a contour plot with two y axes.
% Determine the minimum and the maximum x and y values:
xVarMin = min(dataByColumn.(colheaders{1}));
xVarMax = max(dataByColumn.(colheaders{1}));
yVarMin = min(dataByColumn.(colheaders{2}));
yVarMax = max(dataByColumn.(colheaders{2}));
% Define the resolution of the grid:
xVarRes=200;
yVarRes=200;
gx=xVarMin:0.1:xVarMax;
gy=yVarMin:1:yVarMax;
Zinterp=gridfit(dataByColumn.(colheaders{1}),dataByColumn.(colheaders{2}),dataByColumn.(colheaders{i}),gx,gy);
% Generate the mesh plot :
fig(j) = figure('name',vars{i});
contour(gx,gy,Zinterp,50)
colormap(jet(100));
xlabel(vars(1)); ylabel(vars(2)); zlabel(vars(i));
% Generate data point on the same axes with specified properties:
figure(fig(j));
hold on
plot3(dataByColumn.(colheaders{1}),dataByColumn.(colheaders{2}),dataByColumn.(colheaders{i}),'marker','o','markerfacecolor','r','linestyle','none');
hidden off
colorbar('EastOutSide')%North, NorthOutSide,East, EastOutSide etc
If I insert the 2nd y axis values how the gridfit or a meshgrid command is been manipulated?
  1 Comment
ref
ref on 13 Feb 2013
The example of the link creates two different contour plots and combines them, which is not correct if you have the same z values for the two y axes.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!