-1

In python matplotlib, it is possible to define a figure and its axes in variables; then progressively add different types of plots to that one variable/change that plot's parameters throughout the code by refering to those variables.

Is there anything similar in Julia (use a variable to reference some plot to add datasets to it). And does it have some kind of special treatment of data frames?

I know there is something similar, where you can use plot!(myPlot, some new data), but what if I wanted to use a scatter? Would it work the same way?

Is this compatible with the @df operator? (where you generate a plot via something like: @df plotDat2 plot(:a,:b);

  • 1
    Have you read the docs of Plots.jl? You can create a plot object using `p = plot(...)`, and then make changes to it using the in-place version `plot!(p, ...)`. Is this what you're looking for? – loonatick Jun 27 '23 at 13:22
  • @loonatick Yes. At the time of posting I knew about it, but just didn't quite understand it (thought there were a few things it couldn't do), but now I think that is more or less what I want. Thank you. – Mstislav Keldysh Jun 27 '23 at 18:49

1 Answers1

2

I suggest the AlgebraOfGraphics package. It allows you to plot data frame columns with very nice syntax similar to what you have written. Typically, with AlgebraOfGraphics you do not need to interact with the figure and axes directly, but that is possible since AlegbraOfGraphics is built on top of the Makie package. You could also just use Makie directly if you like building the figures and axes objects manually. It just does not have the same convenience for working with data frames.

Nathan Boyer
  • 1,412
  • 1
  • 6
  • 20