Turning an figure into a plot

2 visualizaciones (últimos 30 días)
Joanna Walker
Joanna Walker el 24 de Mzo. de 2020
Comentada: Joanna Walker el 24 de Mzo. de 2020
Hello,
I'm struggling with turning a figure I have into a plot.
I need the X axis to be fracture density and the Y access to be logarithmic scale .1:1000
I've struggled with writing most of the code, so I included all of it, in case I've done something wrong to begin with. The first 3 plots work for each dataset.
The last string (bold letters) is the one I can't get to plot.
Clearly, this is user error and google searching hasn't been of any help (probably user error again0
Any help, is greatly appreciated.
%%
clear;
close all;
clc;
set(0,'defaultAxesFontSize',16)
% choose which dataset you want to use, 1 for Dataset A ; 2 for the other
% one
dataset = 1; % or =2
hf_well = figure;
for dataset = 1:2
if dataset == 1, % AG Hill
aaa = csvread('C:\Users\user\Desktop\Matlab\DatasetA\WellA_Survey_Data.csv',2,2);
bbb = csvread('C:\Users\user\Desktop\Matlab\DatasetA\Combo_Survey_Dip_DFC.csv',91456,2);
wellheadUTM_E = 665563;
wellheadUTM_N = 3536764;
elseif dataset ==2, % Hippo
aaa = csvread('C:\Users\user\Desktop\Matlab\DatasetB\DatasetB_Survey_Data.csv',2,2);
bbb = csvread('C:\Users\user\Desktop\Matlab\DatasetB\Compo_Dip_DFC_Survey_Data.csv',2,2);
wellheadUTM_E = 662892;
wellheadUTM_N = 3537641;
else
disp('wrong choice');
return;
end
% map the columns
mdep= aaa(:,1);
azi = aaa(:,2);
dip = aaa(:,3);
% % find the -9999 values ; are these bad values ?
% indx1 = find(azi == -9999);
% indx2 = find(dip == -9999);
% indx = union( indx1, indx2);
% map (measured depth, azi, dip ) to global X, Y, Z coordinates
[ns,ew,tvd]=func_wellm_to_trajectory(mdep,azi,dip);
%% plot well trajectories
figure(hf_well);
hold on;
plot3(ew+wellheadUTM_E,ns+wellheadUTM_N, tvd,'b-','linewidth',2);
text(wellheadUTM_E,wellheadUTM_N,tvd(1),sprintf('Well: %d',dataset));
xlabel('Easting');
ylabel('Northing');
zlabel('True Depth') ;
set(gca,'zdir','rev');
ax = gca;
grid on;
ax.BoxStyle = 'full';
%% plot and process fractures
frac_md = bbb(:,1);
frac_ew = interp1( mdep, ew, frac_md);
frac_ns = interp1( mdep, ns, frac_md);
frac_tvd = interp1( mdep, tvd, frac_md);
count_sum_smooth_3ft = bbb(:,3);
frac_density = bbb(:,3);
% find non-zero index
indx_frac = find( count_sum_smooth_3ft > 0);
indx_frac2 = find( count_sum_smooth_3ft > 0);
% plot fracture locations on the trajectory
plot3( frac_ew(indx_frac)+wellheadUTM_E, frac_ns(indx_frac)+wellheadUTM_N, frac_tvd(indx_frac), 'rx');
% bird eye view angle
view(-30, 20);
%% map view of the fractures
fracxi = frac_ew(indx_frac2);
fracyi = frac_density(indx_frac2);
edges = 200: 3: 1800; % ft
nedges = numel(edges);
nbin = nedges -1;
Y(1:nbin) =0;
X(1:nbin) = 0;
for j =1: nbin
xe1 = edges(j);
xe2 = edges(j+1);
X(j) = (xe1 + xe2)/2;
bin_size = xe2-xe1;
ii = find( fracxi < xe2 & fracxi>= xe1);
if isempty (ii)
Y(j) = 0;
else
Y(j) = mean( fracyi(ii)) *bin_size ;
end
end
figure;
% plot ( frac_ew(indx_frac2), frac_density(indx_frac2) ,'k-');
plot(X, Y, 'k-');
xlabel('Easting (ft)');
ylabel('count sum smooth 3 ft');
title(sprintf('Well : %d',dataset));
%% different smoothing again
smoothing_length = .1:100;
nsmooth = numel(smoothing_length);
yy(1: nsmooth, 1:nbin) = 0;
for jj = 1: nsmooth
disp(jj)
yy(jj,:) = smooth(Y', smoothing_length(jj));
end
figure;
imagesc( X, smoothing_length, yy);
colorbar;
colormap(jet);
xlabel('Line of Section (ft)');
ylabel('Window Length');
title( sprintf('Fracture Denstiy vs Window Length, Well:%d',dataset));
end
(I would like to have the above figure also shown in a linear vs logarithmic plot with fracture density on the x and window length on the y and to remove the line of section completely)
%%Log plots
%% different smoothing again
smoothing_length = .01:100;
nsmooth = numel(smoothing_length);
yy(1: nsmooth, 1:nbin) = 0;
figure;
semilogy(smoothing_length,nsmooth)
xlabel('Fracture Density');
ylabel('Window Length');
title( sprintf('Fracture Denstiy vs Window Length, Well:%d',dataset));
  2 comentarios
Sindar
Sindar el 24 de Mzo. de 2020
In what way is it not working?
But, first guess: the y-axis is log scale, while you want the x-axis to be log. Use semilogx
Joanna Walker
Joanna Walker el 24 de Mzo. de 2020
I keep getting the vector lengths cannot be different sizes error message and instead of a single point for each window length (.1,10,100,1000) I'm getting multiple line graphs in the plot window

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by