You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the bar chart, I noticed if the difference between the smallest and largest values is large enough then the bars corresponding to small values completely vanish. I haven't probed too deeply into the bar chart implementation, but I'm guessing this has to do with how the combination of the value scale and available pixels to plot the bar chart essentially erases insignificant bar chart values.
In my particular use case, it's crucial that any non-zero bar chart values remain visually apparent (e.g. single pixel height bar) because the apparent absence might mislead users into thinking that a data point has no value at all.
I haven't been able to find any bar chart configuration properties that might help me with this either. Is this an option that can be introduced? Or perhaps there's a workaround I'm unaware of?
An example to demonstrate this effect:
<!DOCTYPE html><html><head><title>Plotly.js Example</title><metacharset="UTF-8" /></head><body><buttonid="button">Increase Last Value</button><divid="plot"></div><scriptsrc="src/index.js"></script></body></html>
#2941 seems to express a somewhat similar request. However, in my case, I make no distinction between 0 and null—I'd view both as "zero" bar chart values.
The text was updated successfully, but these errors were encountered:
Thanks for using plotly.
You could set marker.line.width similar to this demo.
For questions like this in future we appreciate if you use the community website at https://community.plot.ly
@archmoj, thanks for setting up that demo, but it wasn't exactly what I was after.
In the demo, every bar chart value (even zero) has a visible bar height. I specifically indicated that in the latter case, it's desirable to have no visual indication of a bar.
However, I can still see a workaround for my case from your suggestion since you've opted to close the issue.
For anybody else landing on this issue in the future, one solution is to use the array form for marker.line.width and to simply map from your actual y values to either 0 or 1 based on whether a y value is non-zero. However, if you also need to deal with negative y values, then this won't work without some additional hackery (i.e. possibly needing to use arbitrary base adjustments).
In the demo, every bar chart value (even zero) has a visible bar height. I specifically indicated that in the latter case, it's desirable to have no visual indication of a bar.
You may also consider passing null instead of zero values similar to this demo.
Hello,
When using the bar chart, I noticed if the difference between the smallest and largest values is large enough then the bars corresponding to small values completely vanish. I haven't probed too deeply into the bar chart implementation, but I'm guessing this has to do with how the combination of the value scale and available pixels to plot the bar chart essentially erases insignificant bar chart values.
In my particular use case, it's crucial that any non-zero bar chart values remain visually apparent (e.g. single pixel height bar) because the apparent absence might mislead users into thinking that a data point has no value at all.
I haven't been able to find any bar chart configuration properties that might help me with this either. Is this an option that can be introduced? Or perhaps there's a workaround I'm unaware of?
An example to demonstrate this effect:
Here's a CodeSandbox setup with the above.
#2941 seems to express a somewhat similar request. However, in my case, I make no distinction between
0
andnull
—I'd view both as "zero" bar chart values.The text was updated successfully, but these errors were encountered: