Skip to content

Select colormap for slope colors, and select line widths #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions easyspin/levelsplot.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
% value).
% StickSpectrum true/false (default false). Plot stick spectrum underneath
% Zeeman diagram. Default is false.
% ColorMap Name of colormap for slope colors. E.g.: jet (Default = jet)
% LineWidth Line width for the Zeeman lines
% TransLineWidth Line width for the transition lines
%
% If mwFreq is given, resonances are drawn. Red lines indicate allowed
% transitions, gray lines forbidden ones. Hovering with the cursor over
Expand Down Expand Up @@ -192,11 +195,14 @@ function levelsplot(Sys,varargin)
if Opt.SlopeColor
for iLevel = nLevels:-1:1
col = abs(deriv(E(:,iLevel)));
hLevels(iLevel) = patch([Bvec(:)*Bscale; NaN],[E(:,iLevel); NaN],[col; NaN],'EdgeColor','interp');
hLevels(iLevel) = patch([Bvec(:)*Bscale; NaN],[E(:,iLevel); NaN],[col; NaN],'EdgeColor','interp','LineWidth',Opt.LineWidth);
end
colormap(flipud(parula));
if ~isfield(Opt,'ColorMap')
Opt.ColorMap = parula;
end
colormap(flipud(Opt.ColorMap));
else
hLevels = plot(Bvec*Bscale,E*Escale,'b');
hLevels = plot(Bvec*Bscale,E*Escale,'b','LineWidth',Opt.LineWidth);
set(hLevels,'Color',linecolor);
end
for iLevel = 1:nLevels
Expand Down Expand Up @@ -252,7 +258,7 @@ function levelsplot(Sys,varargin)
E_MHz = sort(eig(H));
E = unit_convert(E_MHz,Opt.Units);

h = line(resonFields(iF)*[1 1]*Bscale,Escale*E(Transitions(iF,:)),'Tag','transition','LineWidth',1);
h = line(resonFields(iF)*[1 1]*Bscale,Escale*E(Transitions(iF,:)),'Tag','transition','LineWidth',Opt.TransLineWidth);
h.UserData = [Transitions(iF,:) resonFields(iF) absintensity(iF)];
transitionColor = absintensity(iF)*Opt.AllowedColor + (1-absintensity(iF))*Opt.ForbiddenColor;
h.Color = transitionColor;
Expand All @@ -266,7 +272,7 @@ function levelsplot(Sys,varargin)
cla
yline(0);
for iF = 1:numel(resonFields)
hLine = line([1 1]*resonFields(iF)*Bscale,[0 intensity(iF)],'Color',linecolor,'LineWidth',2,'Tag','line');
hLine = line([1 1]*resonFields(iF)*Bscale,[0 intensity(iF)],'Color',linecolor,'LineWidth',Opt.TransLineWidth,'Tag','line');
hLine.UserData = [Transitions(iF,:) resonFields(iF) absintensity(iF)];
end
if any(intensity<0)
Expand Down Expand Up @@ -351,7 +357,7 @@ function levelsplot(Sys,varargin)
end

%-------------------------------------------------------------------------------
function windowButtonMotionFcn(~,~,~)
function windowButtonMotionFcn(Opt,~,~,~)

persistent hPrevLine

Expand Down