Project 1 resubmitted
Project 3
Offense Code Crime Trends
A line plot is created to visualize the crime trend over the years for all offense code groups. The plt.figure(figsize=(15, 18)) line sets the size of the figure to be created, specifying a width of 15 units and a height of 18 units. The sns.lineplot function is utilized for generating the line plot, where the x-axis represents the years (‘YEAR’), the y-axis represents the count of crimes (‘COUNT’), and different offense code groups are distinguished by color, thanks to the ‘hue’ parameter. The data used for plotting is sourced from the crimedf_new DataFrame.
The legend function is applied to place the legend outside the plot area, specifically to the left of the plot. Additional adjustments to the legend’s appearance are made using parameters such as loc, bbox_to_anchor, fancybox, shadow, and borderpad.
In summary, this code produces a comprehensive line plot that visually depicts the crime trend over the years, considering various offense code groups. By incorporating different colors for each offense code group and providing a clear legend, the plot facilitates the interpretation of how different types of crimes have evolved over the specified time period. The figure size ensures that the plot is appropriately scaled to accommodate the complexity of visualizing multiple offense code groups over the years.
Crime Occurrences
A line graph is generated to visualize the pattern of crime occurrences over the years. The lineplot3 variable is assigned the result of plotting a line graph based on the crime_count_by_year DataFrame. In this plot, the x-axis represents the years, while the y-axis indicates the count of crimes for each respective year. The figure size is set to 12 units in width and 6 units in height, optimizing the visual representation of the line graph.
The primary objective of this visualization is to observe and interpret the temporal patterns and trends in crime incidents over the specified time period. A line graph is particularly effective in showcasing trends, allowing for the identification of any upward or downward trajectories in crime rates over the years.
In summary, this code contributes to a comprehensive analysis of the temporal dynamics within the crime dataset by extending the visualization to focus on annual trends. The line graph serves as a valuable tool for interpreting patterns and gaining insights into the overall trajectory of crime occurrences across different years.