Created
October 27, 2022 14:12
-
-
Save AnupJoseph/15cce9261b3dce63c7ab3effd92df92d to your computer and use it in GitHub Desktop.
Countplot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gadfly.with_theme(:dark) do # Dark theme cause dark theme looks great with pluto | |
set_default_plot_size(25cm ,15cm) | |
# Think if this as pandas value_counts function | |
value_counts = sort(countmap(dataset[!,4]),byvalue=true) | |
states = collect(keys(value_counts)) | |
# Going to use a dotplot for the visual | |
# Using a log scale here as the graph's boring otherwise | |
count_plot = plot( | |
x=1:length(keys(value_counts)), | |
y=collect(values(value_counts)), | |
Scale.y_log10, | |
Scale.x_discrete(labels=i->length(states[i])<=15 ? states[i] : "$(states[i][1:15])..."), | |
Guide.xlabel("Countries"), | |
Geom.hair, # Hair for a thin bar | |
Geom.point # Dot to ensure that each are separately visible | |
) | |
# draw(SVG("kaggle_countplot.svg"),count_plot) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment