SpinW / spinw

SpinW Matlab library for spin wave calculation
http://www.spinw.org
GNU General Public License v3.0
35 stars 15 forks source link

fitspec: data points in final graph moves when graph is rescaled #159

Open mducle opened 9 months ago

mducle commented 9 months ago

fitspec can be given a plot parameter to generate a plot. When used and first plotted it looks ok, but if you resize the figure, then the points (seems to be plotted with a function sw_circle (code here)) move relative position w.r.t. the underlying color dispersion.

mducle commented 4 months ago

I can't reproduce this bug anymore (tried on R2020a, R2021a and R2024a), using this script (from tutorial 35):

luvo = spinw;
luvo.genlattice('lat_const',[5.2821 5.6144 7.5283],...
    'spgr','x+1/2,-y+1/2,-z; -x,-y,z+1/2; -x,-y,-z','label','P n m a')

% Lu atom
luvo.addatom('r',[0.003 0.031 1/4],'label','Lu1 Lu3+','color',[0 171 36])
% V atom
luvo.addatom('r',[1/2 0 0],'label','V1 V3+','S',1,'color',[166 166 171])
% O(1) atom
luvo.addatom('r',[0.082 0.487 1/4],'label','O1 O2-','color',[255 13 13])
% O(2) atom
luvo.addatom('r',[0.223 0.216 0.534],'label','O2 O2-','color',[255 13 13])

luvo.gencoupling

% Parameters the describe the experimental data in the low T phase.
Jab   =  4.24;
Jc    =  5.95;
K     =  diag([0 -0.42 -0.48]);

luvo.addmatrix('value',Jab,'label','Jab','color','b')
luvo.addmatrix('value',Jc,'label','Jc','color','g')
luvo.addmatrix('value',K,'label','K','color','orange')

% The assigned the easy plane
luvo.addcoupling('mat','Jab','bond',2)
luvo.addcoupling('mat','Jc','bond',1)
luvo.addaniso('K')

luvo.genmagstr('mode','helical','S',[0 0 1]','n',[0 1 0],'k',[0 1 1]);

perf = swpref;
pref.tid = 0;

par_fit          = struct;
par_fit.datapath = 'LuVO3_fitted_modes.txt';

par_fit.Evect    = linspace(0,45,71);
par_fit.func     = @(obj,p)matparser(obj,'param',p,...
                    'mat',{'Jab' 'Jc' 'K(1,1)' 'K(2,2)'},'init',true);

par_fit.xmin      = [ 3   1  0   0    ];
par_fit.xmax      = [ 9  10  1   1    ];
par_fit.x0        = [ 6   4  0.1 0.04 ];
par_fit.plot      = true;
par_fit.hermit    = false;
par_fit.optimizer = 'simplex';
par_fit.maxiter   = 10;
par_fit.optmem    = 1;
par_fit.nrun      = 5;

fitStr = luvo.fitspec(par_fit);

@RichardWaiteSTFC - I don't quite remember the exact case to reproduce this - do you?