{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "- By [lazarusA](https://lazarusa.github.io/Webpage/index.html)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "Figure()" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "using RDatasets, StatsBase, KernelDensity, Colors\n", "using CairoMakie, ColorSchemes\n", "include(\"makieTheme6.jl\") # don't forget to include the theme\n", "\n", "airquality = dataset(\"datasets\", \"airquality\")\n", "categories = [\"Ozone\", \"Solar.R\", \"Wind\", \"Temp\"] \n", "\n", "fig = Figure(resolution = (600, 400), font = \"sans\")\n", "ax = Axis(fig, xlabel = \"variable\", ylabel = \"\", xticks = ([1,2,3,4],categories))\n", "colors = ColorScheme(range(colorant\"yellow\", colorant\"red\", length=length(categories)))\n", "\n", "for (indx,f) in enumerate(categories)\n", " testm = []\n", " for v in airquality[:,f]\n", " if v !== missing\n", " push!(testm, v)\n", " end\n", " end\n", " a = fill(indx, length(testm))\n", " b = testm\n", " boxplot!(a, b; whiskerwidth = 1, width = 0.35, color = (colors[indx], 0.45), \n", " whiskercolor = (colors[indx], 1), mediancolor = :black) #show_outliers=false\n", "end\n", "fig[1,1] = ax\n", "#save(\"./results/FigAirqualityBox.png\", fig, px_per_unit = 2)\n", "fig" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "Figure()" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fig = Figure(resolution = (600, 400), font = \"sans\")\n", "ax = Axis(fig, xlabel = \"\", ylabel = \"\", xticks = ([1,2,3,4], categories) )\n", "colors = ColorScheme(range(colorant\"black\", colorant\"red\", length=length(categories)))\n", "\n", "for (indx,f) in enumerate(categories)\n", " testm = []\n", " for v in airquality[:,f]\n", " if v !== missing\n", " push!(testm, v)\n", " end\n", " end\n", " a = repeat([indx], inner = length(testm))\n", " b = testm\n", " violin!(a, b; width = 0.35, color = (colors[indx], 0.45), \n", " strokecolor = colors[indx], show_median = true, mediancolor = :black)\n", "end\n", "fig[1,1] = ax\n", "#save(\"./results/FigAirqualityViolin.png\", fig, px_per_unit = 2)\n", "fig" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.6.0", "language": "julia", "name": "julia-1.6" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.6.0" } }, "nbformat": 4, "nbformat_minor": 2 }