Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plot DataFrames in Julia using Plots

In Julia, is there a way to plot a dataframe similarly to df.plot() in Python's Pandas?

More specifically, I am using Plots, plotlyjs() and the DataFrames package.

like image 815
Joris Limonier Avatar asked Aug 28 '26 13:08

Joris Limonier


1 Answers

Just to add to Przemyslaw answer, there's an extension of Plots.jl called StatsPlots.jl which provides lots of extra methods and macros to plot DataFrames in a concise way while also including things like grouping variables in the data etc.

Worth checking out the full readme over there to see what it can do, but two equivalent ways of achieving the same output you see in Prezemyslaw's answer are:

julia> @df df plot([:series1 :series2 :series3])

or, more concisely:

julia> @df df plot(cols())

Note in either case StatsPlots will label the series according to the names of their respective source columns automatically.

like image 166
Nils Gudat Avatar answered Aug 31 '26 23:08

Nils Gudat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!