1
$\begingroup$

I'm interested in masking all non-zero values in a plotly time series plot.

Is there a way to simply not include the zeroes when rendering the plot, and connect all data points greater than zero?

I tried limiting the range in the layout, but this did not change what was plotted:

import plotly.graph_objs as go
import plotly.plotly as py

data = [go.Scatter(
          x=data['timestamp'],
          y=data['units_sold'])]

layout = go.Layout(
    yaxis=dict(
        range=[2, 15]))

fig = go.Figure(data=data, layout=layout)

py.iplot(data)

Here is the general structure of my code as a Pandas dataframe:

import pandas as pd    

d = {'timeseries' : [801, 802, 803, 804, 805],
         'units_sold' : [0, 0, 1, 3, 0]}

pd.DataFrame(d)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.