Skip to content

Scatter and density are different colours #90

@MitchellAcoustics

Description

@MitchellAcoustics

A pretty consistent bug resulting from indexing through the colour palette incorrectly. Happens most often when looping to create subplots.

import soundscapy as sspy
import matplotlib.pyplot as plt
import pandas as pd

data = sspy.isd.load()
data = sspy.surveys.add_iso_coords(data, overwrite=True)

sample_data = sspy.isd.select_location_ids(data, ['CamdenTown'])
sample_data_2 = sspy.isd.select_location_ids(data, ['SanMarco'])

# %%

fig, axes = plt.subplots(1, 2, figsize=(12, 6))

sspy.density_plot(
    sample_data, incl_scatter=True, title="San Marco\nEmpirical Density", ax=axes[0]
)

sspy.density_plot(
    pd.DataFrame(sample_data_2, columns=["ISOPleasant", "ISOEventful"]),
    incl_scatter=True,
    title="Target Density",
    ax=axes[1],
)
plt.show()

image

Show blue scatters and orange density. Should all be blue (first colour of colourblind palette).

Metadata

Metadata

Labels

bugSomething isn't working

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions