Hi,
I am trying to replicate the code that produces a faceted density heatmap using the “tips” data frame. The code I am trying to replicate is this:
using PlotlyJS, CSV, DataFrames
df = dataset(DataFrame, "tips")
plot(
df, x=:total_bill, y=:tip, xbingroyp="x", ybingroup="y", kind="histogram2d",
facet_row=:sex, facet_col=:smoker
)
The plot associated with that code is next:
The data frame, named by me as dftips
, looks like this (just the first 10 rows out of 244):
244×8 DataFrame
Row │ total_bill tip sex smoker day time size Column8
│ Float64 Float64 String String String String Int64 Missing
─────┼─────────────────────────────────────────────────────────────────────
1 │ 16.99 1.01 Female No Sun Dinner 2 missing
2 │ 10.34 1.66 Male No Sun Dinner 3 missing
3 │ 21.01 3.5 Male No Sun Dinner 3 missing
4 │ 23.68 3.31 Male No Sun Dinner 2 missing
5 │ 24.59 3.61 Female No Sun Dinner 4 missing
6 │ 25.29 4.71 Male No Sun Dinner 4 missing
7 │ 8.77 2.0 Male No Sun Dinner 2 missing
8 │ 26.88 3.12 Male No Sun Dinner 4 missing
9 │ 15.04 1.96 Male No Sun Dinner 2 missing
10 │ 14.78 3.23 Male No Sun Dinner 2 missing
My adapted piece of code that does not run is:
Plot(dftips, x=dftips.total_bill, y=dftips.tip, xbingroyp="x", ybingroup="y", kind="histogram2d",
facet_row=dftips.sex, facet_col=dftips.smoker)
However, I get the error:
TypeError: in keyword argument facet_row, expected Union{Missing, Symbol},
got a value of type PooledArrays.PooledVector{String, UInt32, Vector{UInt32}}
I replicated all the other examples using this data frame and PlotlyJS. I have no idea how to overcome this obstacle. Help will be very much appreciated.