glue-viz / glue-plotly

Experimental plot.ly plugin for glue
BSD 3-Clause "New" or "Revised" License
2 stars 8 forks source link

Allow exporting of plots with a categorical size attribute. #14

Closed Carifio24 closed 2 years ago

Carifio24 commented 2 years ago

While working on adding the perspective option, I noticed that 3d plots will not export if the size attribute is categorical, despite the fact that this is allowed in glue. This is due to the subtraction in the numerator here being undefined (since the first array is non-numeric).

This PR fixes this issue by using ensure_numerical on the categorical data. This is the same technique used in the 2d scatter layer artist, as well as in the 3d scatter layer artist (it doesn't make a call to ensure_numerical there, but it performs the same operation here).

This shouldn't be an issue for the 2d scatter export (the 2d scatter viewer restricts the possible size attributes to numerical ones, which the 3d viewer doesn't), but I've added the same operation there for good measure.

codecov[bot] commented 2 years ago

Codecov Report

Merging #14 (128045e) into main (7d3eddf) will decrease coverage by 0.36%. The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
- Coverage   86.11%   85.75%   -0.37%     
==========================================
  Files           8        8              
  Lines         396      400       +4     
==========================================
+ Hits          341      343       +2     
- Misses         55       57       +2     
Impacted Files Coverage Δ
glue_plotly/html_exporters/scatter2d.py 81.55% <33.33%> (-0.63%) :arrow_down:
glue_plotly/html_exporters/scatter3d.py 76.40% <33.33%> (-0.61%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7d3eddf...128045e. Read the comment docs.