Closed
Description
Here are the relevant codepens to reproduce:
http://codepen.io/andrewkfiedler/pen/XNqMeW?editors=0010
http://codepen.io/andrewkfiedler/pen/ObZpzv?editors=0010
In the first codepen, you can see that plotting a histogram of type 'Number' causes future histograms to be assumed to be of type 'Number' as well. As such it throws an error (the second plot is attempted 5 seconds after the first, so wait 5 seconds).
In the second codepen, you can see that plotting a histogram of type 'String' causes future histograms to be assumed to be of type 'String' as well. As such, the numbers are binned as though they are strings.
Both are examples are using Plotly.newPlot.
Activity
etpinard commentedon Dec 7, 2016
What is the desired behavior here in your mind?
andrewkfiedler commentedon Dec 7, 2016
In my mind, Plotly should not crash when switching the type of data used in a histogram. 'Strings' are useful in histograms to bin things into categories, while 'Numbers' are useful to group things into ranges.
Using one type should not cause Plotly to assume that's the type for all future histograms.
I'd actually prefer being allowed to specify the type instead of allowing Plotly to make the decision for me, as right now I have to append a https://en.wikipedia.org/wiki/Zero-width_space in order to force String types that sometimes involve Numbers to be seen as such.
andrewkfiedler commentedon Dec 14, 2016
Anything else I can provide to help out on this?
etpinard commentedon Dec 14, 2016
Oh. You're using
newPlot
. Ok that's bad. Sorry I thought you were complaining about multi-trace graphs being cast to the same axis type.newPlot
(as the name suggests) should clean up everything about the previous graphs.Thanks for the report.
etpinard commentedon Dec 15, 2016
Changing the issue title to attract more attention.
[-]Previous histograms affect future histograms[/-][+]`newPlot` does not clear histogram axis type!!![/+]etpinard commentedon Dec 15, 2016
The issue can be replicated all the back be to
v1.0.0
: not a regression.etpinard commentedon Dec 16, 2016
We haven't fixed the bug yet, but here's a workaround: http://codepen.io/etpinard/pen/dOwJoZ
Our poor user input object management is responsible for this bug.
Update histogram to handle issues with Plotly
Update histogram to handle issues with Plotly
DDF-2644 Update histogram to handle issues with Plotly
DDF-2644 Update histogram to handle issues with Plotly
DDF-2644 Update histogram to handle issues with Plotly
DDF-2644 Update histogram to handle issues with Plotly
DDF-2644 Update histogram to handle issues with Plotly
Plotly.newPlot
#1285DDF-2644 Update histogram to handle issues with Plotly
alexcjohnson commentedon Sep 29, 2017
Just to be clear what @etpinard means by "poor user input object management" - the issue is that we mutate the
layout
object you pass in, so the workaround is to create a newlayout
object for eachnewPlot
call.We can only fix this in v2, at which point we can clone
data
andlayout
and mutate those rather than the ones you pass in.etpinard commentedon Mar 28, 2019
Merging into #2234
DDF-2644 Update histogram to handle issues with Plotly