Skip to content

colorbar subplot legends problem #392

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

Closed
danton267 opened this issue Sep 20, 2021 · 1 comment
Closed

colorbar subplot legends problem #392

danton267 opened this issue Sep 20, 2021 · 1 comment
Assignees

Comments

@danton267
Copy link
Member

Discretization of colorbars is not properly reflected in the legend.

results in: https://chart-studio.plotly.com/~danton267/1394/using-parula256/#/
supposed to be: https://www.mathworks.com/matlabcentral/answers/uploaded_files/692629/image.png
code:

clc;    % Clear the command window.
fprintf('Beginning to run %s.m ...\n', mfilename);
close all;  % Close all figures (except those of imtool.)
clearvars;
workspace;  % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
% Read in input gray scale image.
grayImage = imread('cameraman.tif');
% Using parula with 256 colors.
subplot(2, 2, 1);
imshow(grayImage);
hold on;
cmap = parula(256);
imshow(grayImage, 'Colormap', cmap);
title('Using parula(256)', 'FontSize', fontSize);
colorbar
% Using parula with 256 colors but with every 16'th color black
% to better demarcate intensity ranges.
subplot(2, 2, 2);
imshow(grayImage);
hold on;
cmap2 = parula(256);
cmap2(1:16:end,:) = 0;
imshow(grayImage, 'Colormap', cmap2);
title('Using parula(256)', 'FontSize', fontSize);
colorbar
% Using parula with 256 colors but with only 8 ranges of 32 gray levels
% to better demarcate intensity ranges.
subplot(2, 2, 3);
imshow(grayImage);
hold on;
cmap3 = parula(8);
imshow(grayImage, 'Colormap', cmap3);
title('Using parula(8)', 'FontSize', fontSize);
colorbar
% Using parula with 256 colors but contours
% every 32 gray levels overlaid (this is 8 ranges).
subplot(2, 2, 4);
imshow(grayImage);
hold on;
cmap4 = parula(256);
imshow(grayImage, 'Colormap', cmap4);
title('Using contourf(grayImage, 32)', 'FontSize', fontSize);
colorbar
contourf(grayImage, 16)
g = gcf;
g.WindowState = 'maximized'
@gilbertogalvis gilbertogalvis self-assigned this Sep 20, 2021
@gilbertogalvis
Copy link
Contributor

This issue was fixed with PR #404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants