MulaiMulai sekarang secara gratis

Upcharging older smokers

In this exercise, your objective is to examine how age and smoker status influence the cost of insurance premium charges. To achieve this, you will create a scatter plot that showcases insurance charges against age, grouped by smoker status. The DataFrame recipe will be employed to facilitate this process.

You can leverage the pre-loaded insurance DataFrame, which contains the requisite data for the analysis. The DataFrames and StatsPlots packages have been imported.

Latihan ini adalah bagian dari kursus

Introduction to Data Visualization with Julia

Lihat Kursus

Petunjuk latihan

  • Utilize the recipe to create a scatter plot of the insurance DataFrame.
  • Plot the :Charges (y-axis) versus :Age (x-axis) grouping by the :Smoker column.
  • Customize the plot by setting the markershape to :rect, the markersize to 5, and using marker colors :lightseagreen and :crimson.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Use recipe
____ ____ scatter(
	# Pass columns
	:____,
    :____,
    group=:____,
    legend_title="Smoker",
	# Customize markers
    markershape=:____,
    markersize=____,
    markercolor=[:____ :____]
)
xlabel!("Age")
ylabel!("Insurance Premium (USD)")
Edit dan Jalankan Kode