import pandas as pd
import plotly.express as px
import numpy as np
# Load the dataset
file_path = 'C:\\Users\\loydt\\Downloads\\Superstore Sales Dataset.csv'
data = pd.read_csv(file_path)
# Convert 'Order Date' to a datetime format
data['Order Date'] = pd.to_datetime(data['Order Date'], format='%d/%m/%Y',
errors='coerce')
# Create a scatter plot with 'Order Date' on the x-axis and 'Sales' on the y-axis
fig2 = px.scatter(data, x='Order Date', y='Sales', title='Sales Over Time', opacity=0.7)
# Customize the scatter plot's color and marker size
fig2.update_traces(marker_color='orange', marker_size=6)
# Updating the layout to set a darker background and other enhancements
fig2.update_layout(
xaxis_title='Order Date',
yaxis_title='Sales',
title='Sales Over Time',
xaxis_title_font=dict(size=14),
yaxis_title_font=dict(size=14),
title_font=dict(size=18),
xaxis_showgrid=True,
yaxis_showgrid=True,
xaxis_gridcolor='gray',
yaxis_gridcolor='gray',
# Set the background color to a darker shade
paper_bgcolor='rgba(45, 45, 45, 1)', # Background outside the plot area
plot_bgcolor='rgba(40, 40, 40, 1)', # Background inside the plot area
# Customize font colors to ensure readability on a dark background
font=dict(color='white')
)
# Show the plot
fig2.show()