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

Categorical data (and BarWidth Name-Value Argument) not supported in histogram() #198

Closed
xarico10 opened this issue Jul 27, 2021 · 1 comment
Assignees
Labels
⭐⭐⭐ multiplier Issues that could close multiple related issues at once

Comments

@xarico10
Copy link
Contributor

When using categorical data on histogram an error is being printed.

A = [0 0 1 1 1 0 0 0 0 NaN NaN 1 0 0 0 1 0 1 0 1 0 0 0 1 1 1 1];
C = categorical(A,[1 0 NaN],{'yes','no','undecided'});

histogram(C,'BarWidth',0.2);

fig2plotly();

The previous code prints the following error:

Error using response_handler (line 31)
Expecting (x, y) pairs

Error in makecall (line 32)
    response_handler(resp);

Error in plotly (line 28)
response = makecall(args, origin,
structargs);

Error in plotlyfig/plotly (line 437)
            args.layout = obj.layout;

Error in fig2plotly (line 49)
p.plotly;

Error in A_histogram (line 49)
fig2plotly();

Expected plot:
Captura de Pantalla 2021-07-26 a la(s) 11 19 07 p  m

As the Name-Value argument 'BarWidth' only works for categorical histograms, this also leads to a disfunction with this argument.

Examples on using categorical data with histogram() can be found on:
https://www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.histogram.html#buy5k3l

@xarico10 xarico10 pinned this issue Aug 2, 2021
@xarico10 xarico10 unpinned this issue Aug 2, 2021
@xarico10 xarico10 added the ⭐⭐⭐ multiplier Issues that could close multiple related issues at once label Aug 2, 2021
@gilbertogalvis gilbertogalvis self-assigned this Aug 6, 2021
gilbertogalvis pushed a commit that referenced this issue Aug 7, 2021
@gilbertogalvis gilbertogalvis mentioned this issue Aug 7, 2021
@gilbertogalvis
Copy link
Contributor

This issue have now a Pull Request that fix it

Screen Shot 2021-08-06 at 9 18 48 PM

Screen Shot 2021-08-06 at 9 19 10 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐⭐⭐ multiplier Issues that could close multiple related issues at once
Projects
None yet
Development

No branches or pull requests

4 participants