Skip to content
Snippets Groups Projects
Commit ae73bf9e authored by reyesc's avatar reyesc
Browse files

added "single size" ability for x-section

plus minor bug fixes.
I think I’m now ready to move on to really getting the deeper analysis
functions to play nice with the new window.
parent 7243f909
No related branches found
No related tags found
No related merge requests found
...@@ -38,9 +38,11 @@ classdef CatalogExplorationPlot < handle ...@@ -38,9 +38,11 @@ classdef CatalogExplorationPlot < handle
cl=c.(obj.color_by); cl=c.(obj.color_by);
cl=obj.colorFcn(cl); cl=obj.colorFcn(cl);
obj.ax obj.ax
obj.myscatter=scatter3(obj.ax,[], [], [], [], []); %obj.myscatter=scatter3(obj.ax,[], [], [], [], []);
drawnow hold off;
%drawnow
obj.myscatter=scatter3(obj.ax,x, y, z, s, cl); obj.myscatter=scatter3(obj.ax,x, y, z, s, cl);
obj.myscatter.DisplayName=sprintf('size:%s\ncolor:%s',obj.size_by,obj.color_by);
if isempty(obj.curview) if isempty(obj.curview)
view(obj.ax,2); view(obj.ax,2);
else else
...@@ -78,14 +80,19 @@ classdef CatalogExplorationPlot < handle ...@@ -78,14 +80,19 @@ classdef CatalogExplorationPlot < handle
case 'z_by' case 'z_by'
doit('ZAxis','ZData', obj.z_by); doit('ZAxis','ZData', obj.z_by);
case 'size_by' case 'size_by'
set(obj.myscatter,'SizeData',obj.sizeFcn(c.(obj.size_by))); switch obj.size_by
case 'Single Size'
set(obj.myscatter,'SizeData',obj.sizeFcn(1));
otherwise
set(obj.myscatter,'SizeData',obj.sizeFcn(c.(obj.size_by)));
end
case 'color_by' case 'color_by'
switch obj.color_by switch obj.color_by
case 'Single Color' case 'Single Color'
set(obj.myscatter,'CData',obj.colorFcn(1)); set(obj.myscatter,'CData',obj.colorFcn(1));
otherwise otherwise
set(obj.myscatter,'CData',obj.colorFcn(c.(obj.color_by))); set(obj.myscatter,'CData',obj.colorFcn(c.(obj.color_by)));
end end
end end
end end
...@@ -119,9 +126,12 @@ classdef CatalogExplorationPlot < handle ...@@ -119,9 +126,12 @@ classdef CatalogExplorationPlot < handle
else else
obj.myscatter.(where) = seconds(c.(fld)); obj.myscatter.(where) = seconds(c.(fld));
end end
enforce_linear_scale_if_necessary();
elseif islogical(c.(fld)) elseif islogical(c.(fld))
obj.myscatter.(where) = double(c.(fld)); obj.myscatter.(where) = double(c.(fld));
else else
% if any value is less than 0, cannot use a log scale plot.
enforce_linear_scale_if_necessary();
obj.myscatter.(where) = c.(fld); obj.myscatter.(where) = c.(fld);
switch(where(1)) switch(where(1))
case 'X' case 'X'
...@@ -131,8 +141,15 @@ classdef CatalogExplorationPlot < handle ...@@ -131,8 +141,15 @@ classdef CatalogExplorationPlot < handle
case 'Z' case 'Z'
zlabel(obj.ax, cur_name, 'uicontextmenu', cur_context,'interpreter','none'); zlabel(obj.ax, cur_name, 'uicontextmenu', cur_context,'interpreter','none');
end end
end end
end function enforce_linear_scale_if_necessary()
if any(c.(fld)<=0) && strcmp(obj.ax.([where(1) 'Scale']),'log')
beep;
disp(['enforcing linear ' where(1) 'Scale because of negative values']);
obj.ax.([where(1) 'Scale'])='linear';
end
end
end % DOIT
end end
end end
methods(Hidden) methods(Hidden)
...@@ -215,12 +232,13 @@ classdef CatalogExplorationPlot < handle ...@@ -215,12 +232,13 @@ classdef CatalogExplorationPlot < handle
uimenu(h,'Label',obj.axes_choices{i},'Checked',tf2onoff(checkmask(i)),... uimenu(h,'Label',obj.axes_choices{i},'Checked',tf2onoff(checkmask(i)),...
'Callback',{@obj.changeSize,sc}); 'Callback',{@obj.changeSize,sc});
end end
uimenu(h,'Separator','on','Label','Single Size',...
'Callback',{@obj.changeSize,sc});
end end
function colorContextMenu(obj,h,sc) function colorContextMenu(obj,h,sc)
checkmask = strcmp(obj.axes_choices, obj.size_by); checkmask = strcmp(obj.axes_choices, obj.color_by);
for i=1:numel(obj.axes_choices) for i=1:numel(obj.axes_choices)
%label = obj.axes_choices{i}; %label = obj.axes_choices{i};
uimenu(h,'Label',obj.axes_choices{i},'Checked',tf2onoff(checkmask(i)),... uimenu(h,'Label',obj.axes_choices{i},'Checked',tf2onoff(checkmask(i)),...
...@@ -246,8 +264,17 @@ classdef CatalogExplorationPlot < handle ...@@ -246,8 +264,17 @@ classdef CatalogExplorationPlot < handle
function cb_axisscale(letter) function cb_axisscale(letter)
scales={'linear','log'}; scales={'linear','log'};
prop=[letter 'Scale']; prop=[letter 'Scale'];
scales(strcmp(obj.ax.(prop),scales))=[]; scales(strcmp(obj.ax.(prop),scales))=[];
obj.ax.(prop) = scales{1};
% if any data is non-positive, axes must remain linear
if any(obj.myscatter.([letter 'Data']) <=0) && strcmp(scales{1},'log')
beep
disp(['enforcing linear ' prop ' because of negative values'])
obj.ax.(prop) = 'linear';
else
obj.ax.(prop) = scales{1};
end
end end
end end
function change(obj,src,~,whatby) function change(obj,src,~,whatby)
...@@ -288,6 +315,12 @@ classdef CatalogExplorationPlot < handle ...@@ -288,6 +315,12 @@ classdef CatalogExplorationPlot < handle
obj.sizeFcn=@(x) normalize(x,2,8,@(x)x.^2 ); obj.sizeFcn=@(x) normalize(x,2,8,@(x)x.^2 );
case 'Magnitude' case 'Magnitude'
obj.sizeFcn=@mag2dotsize; obj.sizeFcn=@mag2dotsize;
case 'Single Size'
sz=num2str(round(mode(obj.myscatter.SizeData)));
val = str2double(inputdlg('Choose Marker Size','',1,{sz}));
if ~isempty(val) && ~isnan(val)
obj.sizeFcn=@(x)val;
end
otherwise otherwise
obj.sizeFcn=@(x) normalize(x,2,8,@(x)x.^2); obj.sizeFcn=@(x) normalize(x,2,8,@(x)x.^2);
end end
......
...@@ -7,7 +7,10 @@ function plot_base_events(obj) ...@@ -7,7 +7,10 @@ function plot_base_events(obj)
end end
alleq = findobj(obj.fig,'Tag','all events'); alleq = findobj(obj.fig,'Tag','all events');
if isempty(alleq) if isempty(alleq)
alleq=scatter(axm, obj.rawcatalog.Longitude, obj.rawcatalog.Latitude,'.','CData',[.76 .75 .8],'Tag','all events'); alleq=scatter(axm, obj.rawcatalog.Longitude, obj.rawcatalog.Latitude,'.',...
'CData',[.76 .75 .8],...
'DisplayName','unselected events',...
'Tag','all events');
alleq.ZData=obj.rawcatalog.Depth; alleq.ZData=obj.rawcatalog.Depth;
alleq.HitTest='off'; alleq.HitTest='off';
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment