英文:
Looking for similar Plotting functionality to matplotlib's figures
问题
在Python的Matplotlib中,可以将图形和其坐标轴定义为变量,然后通过引用这些变量在代码中逐渐添加不同类型的图表或更改图表参数。
在Julia中是否有类似的功能(使用变量引用图表以添加数据集)?
对数据框有特殊处理吗?
我知道有类似的功能,可以使用plot!(myPlot, some new data)
,但如果我想使用散点图呢?它是否能以相同的方式工作?
这是否与@df
操作符兼容?(通过类似以下方式生成图表:@df plotDat2 plot(:a,:b);
)
英文:
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
得分: 2
我建议使用AlgebraOfGraphics包。它允许您使用非常好的语法绘制数据框列,与您所写的类似。通常情况下,使用AlgebraOfGraphics时,您不需要直接与图形和坐标轴进行交互,但这是可能的,因为AlgebraOfGraphics是建立在Makie包之上的。如果您喜欢手动构建图形和坐标轴对象,您也可以直接使用Makie。但对于与数据框一起工作,它没有相同的便利性。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论