Commit f9f0bce
committed
Raise a clear error for unsupported marginal plot types
Closes #4654.
Passing an unsupported value to marginal_x, marginal_y or marginal in
Plotly Express (for example marginal_x="density") left trace_spec as None
in make_trace_spec, which later failed deep inside make_figure with a
confusing "'NoneType' object has no attribute 'constructor'".
make_trace_spec now raises a ValueError naming the offending value and
listing the supported marginal plot types: rug, box, violin and
histogram. The singular `marginal` argument is normalised to marginal_x
or marginal_y before this point, so the single check covers all three
parameters.
Adds a regression test in tests/test_optional/test_px/test_marginals.py.1 parent 2a91b77 commit f9f0bce
3 files changed
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
974 | 980 | | |
975 | 981 | | |
976 | 982 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments