Any idea how to do scatterplot with marginal histograms in Gadfly or Plots. Preference is Gadfly. Found similar post in forum below, but it was done in R/ggplot2. Technically, each histograms may have (normalized) cumulative distribution line (not shown in image below).
In Gadfly, something (less) similar can be done with Guide.xrug and Guide.yrug. It is possible that subplot_grid or gridstack functions might do it. Histograms make it perfect.
Cool! Thanks @davidanthoff for sharing this. Seems a pretty matured product. I would investigate/ experiment VegaLite.jl. Yesterday, I also learned that there is Gnuplot.jl which linked to Gnuplot, which I’ve used in the past. Just realized that Julia have many choices in visualization space - Plots, Gaston, Gadfly, VegaLite, Gnuplot, and more.
Thanks @mkborregaard for sharing this. This is a neat solution as it uses pure Julia language.
On slightly different topic, Gadfly, like ggplot2 in R, by default, produced beautiful (or colorful) plots. Other plotting packages (equal or more capable/ features), e.g. VegaLite.jl (@davidanthoff above), Gnuplot.jl and Plots.jl, by default output dull (black and white) plots. Of course, with a bit of tweak, the plot will be colorful, but still feel missing “anti-alias”. These are the differentiators, OR could be just my biases.
The reason the plot produced by Michael’s example is dull is that he chose the parameters to match the appearance of the plot you provided in the first post. If you omit the quoted line above, the plot will be colorful.
Exactly, most of that code was formatting code to achieve the look of your image. The plot really only needs the link attribute (linking the axes of subplots), and the orientation attribute (to flip the last histogram). The layout and other things are just for prettyness. The simplest way would be a one-liner
using Distributions, Plots
x, y = rand(Normal(), 300), rand(TDist(2), 300)
plot( histogram(x), plot(framestyle = :none),
scatter(x,y), histogram(y, orientation = :horizontal),
link = :both)
For the VegaLite.jl example I actually had to manually tweak some of the parameters to make it match the example you had originally posted, the default is nice and colorful and not black and white Same for Plots.jl, I believe.
The only format one can upload here to the forum seems PNG images, which is really not ideal for plots because things can look a bit pixely. You can export VegaLite.jl figures to png, svg, pdf, vegalite or html, and everyone format other than PNG will actually look much better because it will be a vector format.
And there are even more: Makie.jl, Plotly.jl, Winston.jl, at least one PGF wrapper (if not two), Vega.jl, PyPlot.jl and I’m sure I still forgot some. Many of them are really very useful and feature rich at this point, I think plotting is actually in pretty good shape on Julia now.
I think actually the only package that can truly claim to be pure Julia is probably UnicodePlots.jl, I think pretty much every other plotting package uses non-Julia code at least for some things. My guess is that the next most pure Julia packages are Gadfly.jl and Winston.jl, as far as I know they only use cairo (the C library) for export to various image formats. Then maybe Makie.jl, which uses a GL (C based) or cairo for rendering, as far as I can tell, but is otherwise mostly Julia? I think all other packages (including Plots.jl) use even more non Julia. For example, the default backend for Plots.jl is GR (implemented in C), and I think most (if not all) other popular backends are also not Julia. The vega family of packages obviously also uses a lot of non Julia code etc.
On some level I think this is good: creating a robust plotting solution from scratch is clearly a many person many year project, and at the same time there are excellent non-Julia solutions out there. If we can make them available with a lot less work, hurray!
Another aspect is that I think I wouldn’t worry at all whether a package uses non-Julia code or not, as long as deployment is reliable and it supports the same platforms as Julia does. That situation has improved a lot with the whole artifacts story.
I’ve (today) searched Internet for Julia plotting packages, read posts in various forums to understand these packages, including the packages you mentioned above. Vegalite and Makie are two interesting plotting packages that I might invest more time. Vegalite for the GOG-like and Makie (require extra package to make it GOG-like) for seemingly exciting future.