Figure Friday 2025 - week 11

Actually, what @adamschroeder remarked is what I deleted. The lat, ,lon part. Even if my “thing” would work I would have the same problem as you have. . My grid was a quickfix to show what actually happened in the state. What maybe would work is if you add a summary of the second part of your app (if you scroll down) as hoverinfo, it would solve a lot of confusion. Or, there is an option that you have a number in the dot (can not find the page at the moment, cooking) or, but that’s a stupid idea, a donut popup to summarize category, number of times it occurred. :slight_smile:

Update, I meant Dash Leaflet, somewhere @ 75% of this page, it adds the numbers if the coordinates are to close together for the zoomview but maybe, you never know, Dash

1 Like

Hi Adams,

The ‘Predictive Analysis’ section of the dashboard is not actually a prediction in the strict sense of machine learning models, but rather a visualization of historical patterns that can serve as a basis for inferences about the probability of hurricanes.

  • Bars (in blue): Represent the count of hurricanes per month.
  • Dashed line (in red): Shows the frequency trend between months.

Basic Interpretation: Months with higher bars indicate a greater historical frequency of hurricanes, implying a higher seasonal probability."

Possible improvements for a real prediction:
If you wanted to turn this section into a true predictive tool, you could:
Incorporate time series models (ARIMA, Prophet, etc.) to project future trends.
May be in the near future take these ideas for other apps.

2 Likes

Absolutely, that’s why I added a polar chart to complement the map information. Of course, this dashboard/app, due to time constraints, is always an initial step. Ideally, I would create a map chart showing the route of each hurricane, but that requires more work. If you use the Plotly side button and click on each category, you can see the other circles. In this case, of course, they are overlapping :muscle: :winking_face_with_tongue:

2 Likes

About th button Adams the ideal would be combined with a modal to avoid this happens to you.

1 Like

Excellent, thanks so much for all your comments and suggestions! I really appreciate them.

2 Likes

This visualization uses an invented metric of “weighted strength by decade”, where each decade gets 1 point for every cat 1, 2 points for every cat 2, up to 5 points for every cat 5. My null hypotheses that hurricane strengths have increased over the years due to global warming is not proven in this data set. I still believe that global warming is real.

Here is a screen shot:

Here is the code:

import polars as pl
import plotly.express as px

# ----- READ AND CLEAN DATA ----------------------------------------------------
df = (
    pl.scan_csv('us-hurricanes.csv', ignore_errors=True)
    .select(
        DECADE = (
            pl.col('year')
            .cast(pl.String)
            .str.slice(0,3) + pl.lit('0s')
        ),
        CATEGORY = pl.col('category').cast(pl.String),      
        # NAME = pl.col('name')
    )
    .filter(pl.col('CATEGORY').is_in([str(i+1) for i in range(5)]))
    .with_columns(
          COUNT = (
              pl.col('DECADE')
                .count()
                .over('DECADE','CATEGORY')
          )
    )
    
    .unique(['DECADE', 'CATEGORY'])
    .sort('DECADE', 'CATEGORY')
    .collect()
    .pivot(
        on='CATEGORY',
        index='DECADE'
    )
    .with_columns(pl.col([str(i+1) for i in range(5)]).fill_null(0))
    .with_columns(
        WEIGHTED_STRENGTH = (
            (pl.col('1') * 1) +
            (pl.col('2') * 2) +
            (pl.col('3') * 3) +
            (pl.col('4') * 4) +
            (pl.col('5') * 5)
        )
    )
)

# ----- BAR CHART OF HURRICANE STRENGTH BY DECADE ------------------------------
fig=px.bar(
    df,
    'DECADE',
    'WEIGHTED_STRENGTH',
    template='simple_white',
    title=(
        'HURRICANE WEIGHTED STRENGTH BY DECADE<br>' +
        '<sup>' + 
            'Weighted Strength = ' +
            'n(cat1)*1 + n(cat2)*2 + n(cat3)*3 + n(cat4)*5 + n(cat5)*5<br>'
            'DATA_SOURCE: NOAA HurricaneReserach Division' +
        '</sup>'
    ),
    height=500, width=800
)
# ---- ADD HORIZONTAL LINE AT MEAN VALUE, WITH LABEL ---------------------------
fig.add_hline(
    y=df['WEIGHTED_STRENGTH'].mean(),
    line_width=3, line_dash='dash', 
    line_color='green',
    annotation_text='Mean', 
)
fig.show()

3 Likes

I think it’s a bug with Dash 3.0. If I put dash<3 in @marieanne 's example it works fine. If I run it locally with dash==3.0 I also get the same error.

1 Like

@maartenbreddels you’re correct.
Compatibility with Dash 3.0 was added in Dash Ag Grid 31.3.1.

This should be fixed (@marieanne ). Upgrading to Dash-AG-Grid==31.3.1 should solve it.

1 Like

And to @maartenbreddels , changing the line in the requirements to Dash-AG-Grid==31.3.1, worked.

Hi1

I apologize for the delayed response—I’ve had an incredibly hectic week at work. I’ll look into the error with the dash_bootstrap_components package and see what I can do to resolve it.