Why after exporting the top value in colormap bar in binscatter appears "0" and not like a real value '30' ??

1 view (last 30 days)
  5 Comments
Sergii Snegir
Sergii Snegir on 22 Feb 2021
the image is generated in matlab before the export:
The section of the code which generated the plot :
clc
clear figure
figure(1)
binscatter(x,y,250,'FaceAlpha',1)
ax = gca;
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 8 6])
map_pos=[0 .05 .08 .10 .15 .18 1];
map = customcolormap(map_pos, {'#ffffff','#E8E8E8','#FAA73F', '#FA520C','#C70039','#C70039','#000080'}); %redisch color
colormap (ax, flipud(map))
c=colorbar;
c.LineWidth=1.2;
set(get(c,'label'),'string','Bins count (10^4)');
c.TickLabels=c.Ticks./1000;
c.Units='inches';
c.FontSize=FonSize;
ax.YScale="log";
ax.YAxis.TickValues =[1e-6 1e-5 1e-4 1e-3 1e-2 1e-1 1];
ax.YGrid = 'on';
ax.XGrid = 'on';
xlim([-1 20])
ylim([1e-6 1.9])
ax.LineWidth = 1.5;
ax.XAxis.Label.String ="Bending (\mum)";
ax.YAxis.Label.String ="Conductance (G_0)";
ax.FontSize = FonSize;
ax.Layer = 'top';
ax.GridLineStyle = '-';
ax.GridColor='k';
ax.LineWidth = 1;
ax.YMinorGrid = 'off';
box ON;
mp=sprintf('%.2f ', map_pos(:,2:4));
leg_prop = line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
infor=sprintf('traces %s\n%s,\nmap: %s',num2str(numTraces),strjoin(timestamps,'\n'),mp);
lg=legend(leg_prop,infor);
lg.FontSize=14;
lg.Box='off';
lg.Color='white';
title(sprintf('2D-histogram (laser %s, %s)',state2find,direc2find),'FontWeight','bold', 'FontSize',FonSize)
exportPath=sprintf('figures\\1111_%s_2D-histo',strjoin(timestamps,'_'))
print(exportPath,Imagformat,'-r300');
Sergii Snegir
Sergii Snegir on 25 Feb 2021
Edited: Sergii Snegir on 25 Feb 2021
The solution was found unexpectidely.
The solution: before ploting the histogram using binscatter function I have cut-off the data set according to the X and Y limits I was intended to have in my plot. After plotting the data i have UNEXPECTELY discovered that the Bins couns in the new plot is about one order of magnitude smaller than in the initial plot with the error (compare fig on top of the post - 15K; and below this text - 8K). This was not very clear written in description of binscatter function.

Sign in to comment.

Answers (0)

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!