How to plot lines between all countries with hover text been connected to the lines

Hi @this_josh welcome to the forums. I don’t know about plotly.express but here is a way to do something like this with plotly.graph_objects. You will have to update the hovertemplate to display what you want it to display.

import plotly.graph_objects as go
import plotly.express as px
import itertools as it
import numpy as np

# generate data
x = np.arange(10)
y = np.arange(10)


# create coordinate  pairs
x_pairs = list(it.pairwise(x))
y_pairs = list(it.pairwise(y))

# create mid points
x_mid = [sum(mid)/2 for mid in x_pairs]
y_mid = [sum(mid)/2 for mid in y_pairs]

# create base figure
fig = go.Figure()

# add traces (line segments)
for x, y, color in zip(x_pairs, y_pairs, px.colors.sequential.deep):
    fig.add_trace(
        go.Scatter(
            x=x,
            y=y, 
            mode='lines', 
            line={'color': color},
            hoverinfo='skip'
        )
    )
# add trace of midpoints for hover information
fig.add_scatter(
    x=x_mid,
    y=y_mid,
    mode='markers',
    marker_color='rgba(0,0,0,0.0)', # set alpha channel to 0.0 --> transparent 
    hovertemplate = "x: %{x} <br> y: %{y} <extra></extra>", # show midpoint coordinates, hide trace name
    hoverlabel = {'bgcolor': px.colors.sequential.deep} 
)    

fig.update_layout(showlegend=False)

newplot (12)
mrep line_color