line gaps if time series interval is irregular #299
              
                
                  
                  
                    Answered
                  
                  by
                    jonasvdd
                  
              
          
                  
                    
                      miloaissatu
                    
                  
                
                  asked this question in
                Q&A
              
            -
| 
         python3.11, plotly_resampler 0.9.2 when plotting a time series with irregular intervals there's line gaps when zooming is. is this expected behaviour? are there any configs to have it connect the datapoints?  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            jonasvdd
          
      
      
        Mar 4, 2024 
      
    
    Replies: 1 comment 2 replies
-
| 
         Hi @miloaissatu, Yes there is! import numpy as np; import pandas as pd
from plotly_resampler import register_plotly_resampler
# NOTE: I added this import to the original example
from plotly_resampler.aggregation import NoGapHandler
# And added the `default_gap_handler` argument to the `register_plotly_resampler` call
register_plotly_resampler(mode='widget', default_gap_handler=NoGapHandler())
pd.options.plotting.backend = 'plotly'
x = pd.DataFrame(np.random.normal(0, 0.01, 4000))
x.index = pd.Timestamp('2023-01-01') + (pd.Timedelta('1s') * np.random.rand(4000) * 20)
x = x.sort_index()
x[0] = x[0].cumsum()
x.plot(line_shape='hv')Hope this resolves your issue,  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    2 replies
                  
                
            
      Answer selected by
        miloaissatu
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Hi @miloaissatu,
Yes there is!
You can use the
NoGapHandler(docs), which can be passed to thedefault_gap_handlerproperty ofAbstractFigureAggregatorits constructor (docs).