Skip to content
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

Export_fig ignores demcmap() and defaults to parula colormap for 2D plots(contourf for example) #389

Open
mahendraK96 opened this issue May 2, 2024 · 2 comments

Comments

@mahendraK96
Copy link

mahendraK96 commented May 2, 2024

When exporting a 2D plot (contourf plot for example) in vector form (PDF) or as a bitmap(PNG), demcmap is completely ignored and export reverts to "parula". This does not happen with other inbuilt colormaps ("hot" for example). Issue present in R2024a release with export_fig v3.44
MWE below.

Z = peaks;
F=figure();
ax=axes(F);
contourf(ax,Z);
%colormap(ax,"hot");
demcmap(Z,10);
cb=contourcbar;
export_fig(F,'test','-png','-pdf');
@altmany
Copy link
Owner

altmany commented May 2, 2024

unfortunately, I do not have access to the Mapping Toolbox, so I cannot reproduce/debug this issue...

@mahendraK96
Copy link
Author

mahendraK96 commented Oct 1, 2024

Getting back to this issue after a long time.
I am still not sure how demcmap() modifies the figure exactly in the above example, but I have a workaround which works.

[CMAP, CLIM] = DEMCMAP(...) option allows use of colormap() which behaves nicely with export_fig().

Modified MWE

Z = peaks;
F=figure();
ax=axes(F);
contourf(ax,Z);
C=demcmap(Z,10);   % use the colormap returned by demcmap() function
colormap(ax,C);
cb=contourcbar;
export_fig(F,'test','-png','-pdf');

@altmany maybe this issue can be closed if this workaround satisfactory. Looks like a niche scenario in any case.

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

No branches or pull requests

2 participants