plotly / plotly/plotly_matlab

Categorical data not supported

Open
#183 0 comments 0 reactions 1 assignee View on GitHub

@gilbertogalvis is already working on this.

Since Oct 16, 2021.

Dominant language
MATLAB
Stars
413
Forks
166
PR merge metrics
No merged PRs in 30d

Description

When using categorical data on different types of plots, an error is being printed.

For example,

tbl = readtable(fullfile(matlabroot,'examples','matlab','data','BicycleCounts.csv'));
daynames = ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"];
x = categorical(tbl.Day,daynames);
y = tbl.Total;
c = hour(tbl.Timestamp);
swarmchart(x,y,20,c,'filled');

fig2plotly();

Prints the following warning message:

Index in position 2 exceeds array bounds (must not exceed 1).
We had trouble parsing the scatter object.
This trace might not render properly.

Then, prints the following error:

Error using response_handler (line 31)
Hm... Plotly had some trouble decoding your
'args'. Are you sure your data or styling object
is in the right format? Check out the examples
at https://plotly.com/api for guidance.

Need help? Please try searching Plotly's <a
href='http://stackoverflow.com/questions/tagged/plotly'>Stack
Overflow channel</a>.

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

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

Error in plotlyfig/plotly (line 437)
                response = plotly(obj.data,
                args);

Error in fig2plotly (line 49)
p.plotly;

Error in D_swarmchart_4 (line 42)
fig2plotly();

Expected plot:
Captura de Pantalla 2021-07-26 a la(s) 12 03 52 a  m

An example using categorical data can be found on:
https://www.mathworks.com/help/matlab/ref/swarmchart.html#mw_b4fe23df-071d-4ceb-991c-c53325d89599

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.