I am trying to plot two columns from my dataset (the columns are 'cases' and 'vaccinations') on the same line graph. The x-axis only has one column (that is, 'country') that I want them to share. Is it possible to do this in Dash/Plotly? I can't find any solutions using Dash. Here's a snippet of my code:

```
                 html.Div(
                    children=dcc.Graph(
                        id="cases-chart",
                        config={"displayModeBar": False},
                        figure={
                            "data": [
                                {
                                    "x": data["country"],
                                    "y": data["cases"],
                                    "type": "lines",
                                },
                            ],
                            "layout": {
                                "title": {
                                    "text": "Cases by Country",
                                    "x": 0.05,
                                    "xanchor": "left",
                                },
                                "xaxis": {"fixedrange": True},
                                "yaxis": {"fixedrange": True},
                                "colorway": ["#17B897"],
                            },
                        },
                    ),
                    className="card",
                ),

```

Thanks.
['https://Stackoverflow.com/questions/68178782', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11845398/']
I hope this solves your problem.

This is implemented in Python.

First, we use imageio to import the image as an array. We need to use a modified version of your image (I filled the interior region in white).

[![enter image description here](https://i.stack.imgur.com/rVHKd.png)](https://i.stack.imgur.com/rVHKd.png)

Then, we transform the RGBA matrix into a binary matrix with a 0 contour defining your interface (phi in the code snippet)

Here's phi from the snippet below (interior region value = +0.5, exterior region value = -0.5):
[![enter image description here](https://i.stack.imgur.com/lNR1m.png)](https://i.stack.imgur.com/lNR1m.png)

```py
import imageio
import numpy as np
import matplotlib.pyplot as plt
import skfmm

# Load image
im = imageio.imread("0WmVI_filled.png")
ima = np.array(im)

# Differentiate the inside / outside region
phi = np.int64(np.any(ima[:, :, :3], axis = 2))
# The array will go from - 1 to 0. Add 0.5(arbitrary) so there 's a 0 contour.
phi = np.where(phi, 0, -1) + 0.5

# Show phi
plt.imshow(phi)
plt.xticks([])
plt.yticks([])
plt.colorbar()
plt.show()

# Compute signed distance
# dx = cell(pixel) size
sd = skfmm.distance(phi, dx = 1)

# Plot results
plt.imshow(sd)
plt.colorbar()
plt.show()

```

Finally, we use the scikit-fmm module to compute the signed distance.

Here's the resulting signed distance field:

[![enter image description here](https://i.stack.imgur.com/w1iJQ.png)](https://i.stack.imgur.com/w1iJQ.png)
For closed, non-intersecting and well oriented polygons, you can speed up the calculation of a signed distance field by limiting the work to feature extrusions based on [this paper](https://www.researchgate.net/publication/2393786_A_Fast_Algorithm_for_Computing_the_Closest_Point_and_Distance_Transform).

The closest point to a line lies within the edge extrusion as you have shown in your image (regions A and E). The closest feature for the points in B, C and D are not the edges but the vertex.

The algorithm is:

* for each edge and vertex construct negative and positive extrusions
* for each point, determine which extrusions they are in and find the smallest magnitude distance of the correct sign.

The work is reduced to a point-in-polygon test and distance calculations to lines and points. For reduced work, you can consider limited extrusions of the same size to define a thin shell where distance values are calculated. This seems the desired functionality for your halo shading example.

While you still have to iterate over all features, both extrusion types are always convex so you can have early exits from quad trees, half-plane tests and other optimisations, especially with limited extrusion distances.

The extrusions of edges are rectangles in the surface normal direction (negative normal for interior distances).

From [1](https://www.researchgate.net/publication/2393786_A_Fast_Algorithm_for_Computing_the_Closest_Point_and_Distance_Transform):

[![edge extrusions](https://i.stack.imgur.com/GtE3e.png)](https://i.stack.imgur.com/GtE3e.png)

The extrusions for vertices are wedges whose sides are the normals of the edges that meet at that vertex. Vertices have either positive or negative extrusions depending on the angle between the edges. Flat vertices will have no extrusions as the space is covered by the edge extrusions.

From [1](https://www.researchgate.net/publication/2393786_A_Fast_Algorithm_for_Computing_the_Closest_Point_and_Distance_Transform):

[![enter image description here](https://i.stack.imgur.com/s9xS1.png)](https://i.stack.imgur.com/s9xS1.png)