using CairoMakie, ColorSchemes using DataFramesMeta using AlgebraOfGraphics, PalmerPenguins ENV["COLUMNS"] = 1000; x = range(0, 10, length=100) y = sin.(x) lines(x, y) f, ax, pltobject = lines(x, y) pltobject.attributes x = range(0, 10, length=100) y1 = sin.(x) y2 = cos.(x) scatter(x, y1, color = :red, markersize = 5, figure=(; resolution=(600, 400))) scatter!(x, y2, color = :blue, markersize = 10) current_figure() lines(1:10, (1:10).^2; color=:black, linewidth=2, linestyle=:dash, figure=(; figure_padding=5, resolution=(600, 400), font="Arial", backgroundcolor=:grey90, fontsize=16), axis=(; xlabel=L"x", ylabel=L"x^{2}", title="Chart Title", xgridstyle=:dash, ygridstyle=:dash)) current_figure() num_lines = 12 dat2 = cumsum(randn(num_lines, 101), dims = 2) labels=["label $i" for i in 1:num_lines] # See available_gradients() for a list of available colors you can use # Makie will error if you don't have enough colors here fig, ax, sp = series(dat2, labels=labels, color=:tableau_20, figure=(; resolution=(640,400))) axislegend(ax) current_figure() num_lines = 12 cbarPal = :viridis cmap = cgrad(colorschemes[cbarPal], num_lines, categorical = false) xs = 0:100 fig = Figure(resolution = (600, 400), font = "CMU Serif") ax = Axis(fig[1, 1], aspect = 1, xlabel = L"x", ylabel = L"x^{p}", xlabelsize = 20, ylabelsize = 20) [lines!(xs, dat2[i, :], color=cmap[i], label="Row $i") for i in 1:num_lines] Legend(fig[1, 2], ax, nbanks = 2) display(fig) # https://juliadatascience.io/makie_colors function new_cycle_theme() # https://nanx.me/ggsci/reference/pal_locuszoom.html my_colors = ["#D43F3AFF", "#EEA236FF", "#5CB85CFF", "#46B8DAFF", "#357EBDFF", "#9632B8FF", "#B8B8B8FF"] cycle = Cycle([:color, :linestyle, :marker], covary=true) # alltogether my_markers = [:circle, :rect, :utriangle, :dtriangle, :diamond, :pentagon, :cross, :xcross] my_linestyle = [nothing, :dash, :dot, :dashdot, :dashdotdot] Theme( fontsize=16, font="CMU Serif", colormap=:linear_bmy_10_95_c78_n256, palette=(color=my_colors, marker=my_markers, linestyle=my_linestyle), Lines=(cycle=cycle,), Scatter=(cycle=cycle,), Axis=(xlabelsize=20, xgridstyle=:dash, ygridstyle=:dash, xtickalign=1, ytickalign=1, yticksize=10, xticksize=10, xlabelpadding=-5, xlabel="x", ylabel="y"), Legend=(framecolor=(:black, 0.5), bgcolor=(:white, 0.5)), Colorbar=(ticksize=16, tickalign=1, spinewidth=0.5), ) end function scatters_and_lines() x = collect(0:10) xh = LinRange(4, 6, 25) yh = LinRange(70, 95, 25) h = randn(25, 25) fig = Figure(resolution=(600, 400), font="CMU Serif") ax = Axis(fig[1, 1], xlabel=L"x", ylabel=L"f(x,a)") for i in x lines!(ax, x, i .* x; label=L"$(i) x") scatter!(ax, x, i .* x; markersize=13, strokewidth=0.25, label=L"$(i) x") end hm = heatmap!(xh, yh, h) axislegend(L"f(x)"; merge=true, position=:lt, nbanks=2, labelsize=14) Colorbar(fig[1, 2], hm, label="new default colormap") limits!(ax, -0.5, 10.5, -5, 105) colgap!(fig.layout, 5) fig end with_theme(scatters_and_lines, new_cycle_theme()) # on the first run, if it asks for stdin type in 'y' and hit enter to download penguins = dropmissing(DataFrame(PalmerPenguins.load())) first(penguins, 6) set_aog_theme!() # just like seaborn's sns.set() axis = (width = 225, height = 225) penguin_frequency = data(penguins) * frequency() * mapping(:species) draw(penguin_frequency; axis) df = DataFrame(x = range(0, 10, length=100), y = sin.(x)) plt = data(df) * mapping(:x, :y) draw(plt * visual(Lines); axis) df = DataFrame(dat, :auto) x2 = data(df) * mapping(:x1, :x2) * visual(Lines, color="orange") x3 = data(df) * mapping(:x1, :x3) * visual(Lines, color="green", linewidth=3) # Use the addition operator to combine our two Layer(s) draw(x2 + x3; axis)