Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Parallel coordinates plot with some lines dotted

I’m trying to make a parallel coordinate plot in Python with lines that fall into two categories. I was hoping to plot them all together, but make lines for one category dotted so you can tell the difference. I was using Plotly but it looks like it doesn’t support modifying lines like that. Would any other tools support this? I was thinking about Pandas but couldn’t find information on whether Pandas would support this. Thank you!

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Try . It provides more flexibility in customizing line styles than Plotly. Here’s how you would do this with matplotlib:

import pandas as pd
import matplotlib.pyplot as plt
from pandas.plotting import parallel_coordinates

# Sample data
data = {
    'Category': ['A', 'A', 'B', 'B'],
    'Feature1': [1, 2, 3, 4],
    'Feature2': [4, 3, 2, 1],
    'Feature3': [2, 3, 4, 1]
}
df = pd.DataFrame(data)

# Plotting
plt.figure(figsize=(10, 6))

# Plot category A with solid lines
parallel_coordinates(df[df['Category'] == 'A'], 'Category', color=['b'], linestyle='-')

# Plot category B with dotted lines
parallel_coordinates(df[df['Category'] == 'B'], 'Category', color=['r'], linestyle=':')

plt.title('Parallel Coordinate Plot with Different Line Styles')
plt.xlabel('Features')
plt.ylabel('Values')
plt.show()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading