Invalid Parameter Name: EdgeColor

Hi all,
I'm trying to set the edgecolor parameter to interp for a hist3 plot. But MATLAB keeps giving me an invalid parameter error on edgecolor. It is in the documentation as a valid parameter and as far as I can tell I'm using the latest version of MATLAB: R2024a Update 2. Another strange thing is that even though I get the error message in the Command Window. The figure that is generated does successfully change the edge colors. It seems like MATLAB is doing what I expected but giving an error message for no apparent reason.
I've included my implementation and error message for reference.
hist3(X,[250 250],"EdgeColor","interp","CdataMode","auto");
Error using internal.stats.parseArgs (line 43)
Invalid parameter name: EdgeColor.
Error in hist3 (line 278)
[cdatamode,facecolor,~] = internal.stats.parseArgs(plnames,pldflts,plotArgs{:});
Error in Heatmap_test (line 26)
hist3(X,[250 250],"EdgeColor","interp","CdataMode","auto");

7 Comments

I can't seem to replicate it in R2019b or R2024a
load carbig
X = [MPG,Weight];
hist3(X,[20 20],'edgecolor','g','cdatamode','auto')
Strange but thank you for trying,
I'm still getting the same error message even with the example code you provided.
Do you know if there is a workaround to prevent the error from aborting code execution?
Adam
Adam on 24 Jul 2024
Edited: Adam on 24 Jul 2024
What does:
which hist3 -all
on command line show?
I'm still running R2023a and don't want to update right now, and the function may well have changed since this version, but the line in hist3 where the error is reported does not exist at all in hist3 in my Matlab (the whole line with plnames, etc isn't there).
Given the code it is failing on it seems unlikely you have some other version of hist3 over-riding the main one, though, as that line of code looks very Mathworks-like rather than some 3rd-party version.
C:\Program Files\MATLAB\R2024a\toolbox\stats\stats\hist3.m is what I show in the command line. It's definitly not any 3rd party version. I copied the syntax direct from the Mathworks documentation.
I can’t find that exact example in the documentation, however I did find this one, that I subsequently adapted —
load carbig
X = [MPG,Weight];
figure
hist3(X,'CDataMode','auto','FaceColor','interp')
xlabel('MPG')
ylabel('Weight')
figure
hist3(X,[250 250], 'CDataMode','auto','EdgeColor','interp')
xlabel('MPG')
ylabel('Weight')
figure
hist3(X,[250 250], "CDataMode","auto","EdgeColor","interp")
xlabel('MPG')
ylabel('Weight')
I can’t determine what the problem is in your implementation of it, however it definitely works here. (Although setting "EdgeColor","interp" makes it look a bit strange.)
I suggest re-starting MATLAB, and perhaps reinstalling it.
If that works, I’ll move this Comment to an answer.
.
Thank you, I'll give a re-install a try. Interestingly my MATLAB seems to have no problem with the "facecolor" parameter only edgecolor.
My pleasure!

Sign in to comment.

 Accepted Answer

Thanks for sharing this.
This is a bug that was fixed in MATLAB R2024a Update 5, released on 12 July 2024.
hist3(X,[250 250],"EdgeColor","interp","CdataMode","auto"); no longer throws the error Invalid parameter name: EdgeColor.
Workaround
If you're using a MATLAB release with this issue, you can set the EdgeColor post-creation.
hist3(rand(100,2),[10,10],"CdataMode","auto");
h = findobj(gca,'Type','Surface','Tag','hist3'); % Surface handle
h.EdgeColor ='interp';

1 Comment

Thank you much! The update fixed the issue.

Sign in to comment.

More Answers (0)

Products

Release

R2024a

Asked:

on 24 Jul 2024

Commented:

on 25 Jul 2024

Community Treasure Hunt

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

Start Hunting!